Trigger didOpen for buffers already loaded (#873)

This commit is contained in:
mattn
2020-07-29 20:32:31 +09:00
committed by GitHub
parent b05c8da3ec
commit 04cef02eed

View File

@@ -211,7 +211,12 @@ function! s:register_events() abort
endif
autocmd BufWinEnter,BufWinLeave,InsertEnter * call lsp#ui#vim#references#clean_references()
augroup END
call s:on_text_document_did_open()
for l:bufnr in range(1, bufnr('$'))
if bufexists(l:bufnr) && bufloaded(l:bufnr)
call s:on_text_document_did_open(l:bufnr)
endif
endfor
endfunction
function! s:unregister_events() abort
@@ -221,8 +226,8 @@ function! s:unregister_events() abort
doautocmd User lsp_unregister_server
endfunction
function! s:on_text_document_did_open() abort
let l:buf = bufnr('%')
function! s:on_text_document_did_open(...) abort
let l:buf = a:0 > 0 ? a:1 : bufnr('%')
if getbufvar(l:buf, '&buftype') ==# 'terminal' | return | endif
if getcmdwintype() !=# '' | return | endif
call lsp#log('s:on_text_document_did_open()', l:buf, &filetype, getcwd(), lsp#utils#get_buffer_uri(l:buf))