Skip to content

Commit bbd6e6f

Browse files
authored
Modify StartLanguageServer to be called conditionally on BufEnter. (Exafunction#344)
This is related to PR Exafunction#252 Forcing the filetype `''` to `1` had the side-effect of always enabling codeium for new empty buffers when using `codeium_filetypes_disabled_by_default`. Now that we conditionally run `StartLanguageServer` on `BufEnter`, we don't need to separately call it during startup.
1 parent 3cc779d commit bbd6e6f

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

autoload/codeium.vim

-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ function! codeium#Enabled() abort
2121

2222
let codeium_filetypes = s:default_codeium_enabled
2323
call extend(codeium_filetypes, get(g:, 'codeium_filetypes', {}))
24-
" The `''` filetype should be forced to `1`, otherwise codeium may be unable start.
25-
" This is related to the default new empty file not setting a filetype.
26-
call extend(codeium_filetypes, {'': 1})
2724

2825
let codeium_filetypes_disabled_by_default = get(g:, 'codeium_filetypes_disabled_by_default') || get(b:, 'codeium_filetypes_disabled_by_default')
2926

plugin/codeium.vim

+1-4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ endfunction
2727
augroup codeium
2828
autocmd!
2929
autocmd InsertEnter,CursorMovedI,CompleteChanged * call codeium#DebouncedComplete()
30+
autocmd BufEnter * if codeium#Enabled()|call codeium#command#StartLanguageServer()|endif
3031
autocmd BufEnter * if mode() =~# '^[iR]'|call codeium#DebouncedComplete()|endif
3132
autocmd InsertLeave * call codeium#Clear()
3233
autocmd BufLeave * if mode() =~# '^[iR]'|call codeium#Clear()|endif
@@ -61,10 +62,6 @@ endif
6162

6263
call s:SetStyle()
6364

64-
if codeium#Enabled()
65-
call codeium#command#StartLanguageServer()
66-
endif
67-
6865
let s:dir = expand('<sfile>:h:h')
6966
if getftime(s:dir . '/doc/codeium.txt') > getftime(s:dir . '/doc/tags')
7067
silent! execute 'helptags' fnameescape(s:dir . '/doc')

0 commit comments

Comments
 (0)