Skip to content

Commit 8d4e845

Browse files
authored
fix: fixes #384 #381 (#388)
Better handling when there are no completions. See: #381 (comment)
1 parent 35d4a8e commit 8d4e845

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

autoload/codeium.vim

+3-9
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,12 @@ endfunction
8989

9090
function! codeium#Accept() abort
9191
let current_completion = s:GetCurrentCompletionItem()
92-
return s:CompletionInserter(current_completion, current_completion.completion.text)
92+
return s:CompletionInserter(current_completion, current_completion is v:null ? '' : current_completion.completion.text)
9393
endfunction
9494

9595
function! codeium#AcceptNextWord() abort
9696
let current_completion = s:GetCurrentCompletionItem()
97-
if current_completion is v:null
98-
return ''
99-
endif
100-
let completion_parts = get(current_completion, 'completionParts', [])
97+
let completion_parts = current_completion is v:null ? [] : get(current_completion, 'completionParts', [])
10198
if len(completion_parts) == 0
10299
return ''
103100
endif
@@ -109,10 +106,7 @@ endfunction
109106

110107
function! codeium#AcceptNextLine() abort
111108
let current_completion = s:GetCurrentCompletionItem()
112-
if current_completion is v:null
113-
return ''
114-
endif
115-
let text = substitute(current_completion.completion.text, '\v\n.*$', '', '')
109+
let text = current_completion is v:null ? '' : substitute(current_completion.completion.text, '\v\n.*$', '', '')
116110
return s:CompletionInserter(current_completion, text)
117111
endfunction
118112

0 commit comments

Comments
 (0)