From 67dd6f4a23c9f85412f12779d44df00545c82f31 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Wed, 12 Feb 2020 09:42:29 +0900 Subject: Check FileType in little later --- autoload/lsp_settings.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/autoload/lsp_settings.vim b/autoload/lsp_settings.vim index 913c798..4057260 100644 --- a/autoload/lsp_settings.vim +++ b/autoload/lsp_settings.vim @@ -333,8 +333,12 @@ function! s:vim_lsp_suggest_plugin() abort endfor endfunction +function! s:vim_lsp_load_or_suggest_delay(ft) abort + call timer_start(0, {timer -> s:vim_lsp_load_or_suggest(a:ft)}) +endfunction + function! s:vim_lsp_load_or_suggest(ft) abort - if !has_key(s:settings, a:ft) + if &filetype !=# a:ft || !has_key(s:settings, a:ft) return endif @@ -431,7 +435,7 @@ function! lsp_settings#init() abort endif exe 'augroup' lsp_settings#utils#group_name(l:ft) autocmd! - exe 'autocmd FileType' l:ft printf("call s:vim_lsp_load_or_suggest('%s')", l:ft) + exe 'autocmd FileType' l:ft 'call' printf("s:vim_lsp_load_or_suggest_delay('%s')", l:ft) augroup END endfor augroup vim_lsp_suggest -- cgit v1.2.3-54-g00ecf