@@ -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
104104function ! 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
201187endfunction
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
0 commit comments