Skip to content

Commit 256a3ad

Browse files
pqnCopybara Bot
authored andcommitted
Project import generated by Copybara. (#44)
GitOrigin-RevId: e8e2a42af376bad1c816cf9bc7f62596b2d230b6 Co-authored-by: Copybara Bot <copybara@exafunction.com>
1 parent 7898ec8 commit 256a3ad

2 files changed

Lines changed: 13 additions & 27 deletions

File tree

autoload/codeium.vim

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ function! codeium#Accept() abort
7070
if start_row == end_row
7171
if end_col > start_col
7272
let delete_text = move_to_start . "\<C-O>d" . (end_col - start_col) . 'l'
73-
endif
74-
else
73+
endif
74+
else
7575
" Delete last line, then intermediate lines.
7676
let delete_text = move_to_end . "\<C-O>d0" . move_to_start . repeat("\<C-O>DJ", end_row - start_row) . "\<C-O>dl"
7777
endif
@@ -103,8 +103,8 @@ endfunction
103103

104104
function! s:GetCurrentCompletionItem() abort
105105
if exists('b:_codeium_completions') &&
106-
\ has_key(b:_codeium_completions, 'items') &&
107-
\ has_key(b:_codeium_completions, 'index') &&
106+
\ has_key(b:_codeium_completions, 'items') &&
107+
\ has_key(b:_codeium_completions, 'index') &&
108108
\ b:_codeium_completions.index < len(b:_codeium_completions.items)
109109
return get(b:_codeium_completions.items, b:_codeium_completions.index)
110110
endif
@@ -151,23 +151,9 @@ function! s:RenderCurrentCompletion() abort
151151
for part in parts
152152
let [row, col] = codeium#util#OffsetToPosition(part.offset)
153153
let text = part.text
154-
155-
if part.type ==# 'COMPLETION_PART_TYPE_INLINE' && idx == 0
156-
" For first inline completion, strip any characters the user has typed
157-
" that match the start of the completion.
158-
let cursor_col = col('.')
159-
let typed = strpart(getline('.'), col - 1, cursor_col - col)
160-
if strpart(text, 0, len(typed)) != typed
161-
call s:ClearCompletion()
162-
return ''
163-
endif
164-
let text = strpart(text, len(typed))
165-
let col += len(typed)
166-
endif
167-
168154
if has('nvim')
169-
let data = {'id': idx + 1, 'hl_mode': 'combine', 'virt_text_win_col': virtcol('.') - 1}
170-
if part.type ==# 'COMPLETION_PART_TYPE_INLINE'
155+
let data = {'id': idx + 1, 'hl_mode': 'combine', 'virt_text_win_col': col - 1}
156+
if part.type ==# 'COMPLETION_PART_TYPE_INLINE_MASK'
171157
let data.virt_text = [[text, s:hlgroup]]
172158
elseif part.type ==# 'COMPLETION_PART_TYPE_BLOCK'
173159
let lines = split(text, "\n", 1)
@@ -200,7 +186,7 @@ function! s:RenderCurrentCompletion() abort
200186
endfor
201187
endfunction
202188

203-
function! codeium#Clear(...) abort
189+
function! codeium#Clear(...) abort
204190
if exists('g:_codeium_timer')
205191
call timer_stop(remove(g:, '_codeium_timer'))
206192
endif
@@ -247,7 +233,7 @@ function! codeium#Complete(...) abort
247233
let bufnr = a:1
248234
let timer = a:2
249235

250-
if timer isnot# get(g:, '_codeium_timer', -1)
236+
if timer isnot# get(g:, '_codeium_timer', -1)
251237
return
252238
endif
253239

@@ -271,7 +257,7 @@ function! codeium#Complete(...) abort
271257
\ 'document': codeium#doc#GetCurrentDocument(),
272258
\ 'editor_options': codeium#doc#GetEditorOptions()
273259
\ }
274-
260+
275261
if exists('b:_codeium_completions.request_data') && b:_codeium_completions.request_data ==# data
276262
return
277263
endif

autoload/codeium/server.vim

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
let s:language_server_version = '1.1.24'
2-
let s:language_server_sha = 'd929e041e3d302aced22c27f8675ba2a94f37e28'
1+
let s:language_server_version = '1.1.28'
2+
let s:language_server_sha = '432f829edc3b3d25a8b895a0db8db6e348620ab3'
33
let s:root = expand('<sfile>:h:h:h')
44

55

66
if has('nvim')
77
let s:ide = 'neovim'
8-
else
8+
else
99
let s:ide = 'vim'
1010
endif
1111

@@ -65,7 +65,7 @@ function! codeium#server#Request(type, data, ...) abort
6565
if s:server_port is# v:null
6666
throw 'Server port has not been properly initialized.'
6767
endif
68-
let uri = 'http://localhost:' . s:server_port .
68+
let uri = 'http://localhost:' . s:server_port .
6969
\ '/exa.language_server_pb.LanguageServerService/' . a:type
7070
let args = [
7171
\ 'curl', uri,

0 commit comments

Comments
 (0)