parent
5ad9746747
commit
0ddc1bc087
|
|
@ -244,7 +244,7 @@ function! s:GetPrompt()
|
||||||
let first_line = max([1, line('.') - max_lines])
|
let first_line = max([1, line('.') - max_lines])
|
||||||
let lines = getbufline('%', first_line, line('.'))
|
let lines = getbufline('%', first_line, line('.'))
|
||||||
let lines[-1] = lines[-1][:col('.') - 2]
|
let lines[-1] = lines[-1][:col('.') - 2]
|
||||||
return join(lines, '\n')
|
return join(lines, "\n")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:GetLanguage()
|
function! s:GetLanguage()
|
||||||
|
|
@ -275,7 +275,7 @@ function! tabby#Show()
|
||||||
if (type(choice.text) != v:t_string) || (len(choice.text) == 0)
|
if (type(choice.text) != v:t_string) || (len(choice.text) == 0)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
let lines = split(choice.text, '\\n')
|
let lines = split(choice.text, "\n")
|
||||||
call prop_add(line('.'), col('.'), #{
|
call prop_add(line('.'), col('.'), #{
|
||||||
\ type: s:prop_type,
|
\ type: s:prop_type,
|
||||||
\ text: lines[0],
|
\ text: lines[0],
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
"description": "Tabby client for vim.",
|
"description": "Tabby client for vim.",
|
||||||
"main": "./dist/tabby.js",
|
"main": "./dist/tabby.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"watch": "webpack --watch",
|
"dev": "webpack --watch",
|
||||||
"build": "webpack --mode=production"
|
"build": "webpack --mode=production"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
||||||
|
|
@ -80,12 +80,17 @@ export class TabbyClient extends EventEmitter {
|
||||||
return this.tabbyServerUrl;
|
return this.tabbyServerUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getCompletion(request: TabbyCompletionRequest): Promise<TabbyCompletion | null> {
|
public async getCompletion(
|
||||||
|
request: TabbyCompletionRequest
|
||||||
|
): Promise<TabbyCompletion | null> {
|
||||||
if (this.status == "disconnected") {
|
if (this.status == "disconnected") {
|
||||||
this.ping();
|
this.ping();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const response = await axios.post<TabbyCompletion>(`${this.tabbyServerUrl}/v1/completions`, request);
|
const response = await axios.post<TabbyCompletion>(
|
||||||
|
`${this.tabbyServerUrl}/v1/completions`,
|
||||||
|
request
|
||||||
|
);
|
||||||
assert(response.status == 200);
|
assert(response.status == 200);
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ Below is the URL for your API endpoint.
|
||||||
|
|
||||||
### Clients
|
### Clients
|
||||||
|
|
||||||
|
* [Vim](https://github.com/TabbyML/tabby/tree/main/clients/vim)
|
||||||
* [VSCode](https://marketplace.visualstudio.com/items?itemName=TabbyML.vscode-tabby)
|
* [VSCode](https://marketplace.visualstudio.com/items?itemName=TabbyML.vscode-tabby)
|
||||||
|
|
||||||
""".replace(
|
""".replace(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue