Skip to content

Commit 27756be

Browse files
mattnprabirshrestha
authored andcommitted
Use BufWipeout
1 parent 6eee2bf commit 27756be

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

autoload/lsp.vim

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ function! s:register_events() abort
135135
autocmd BufReadPost * call s:on_text_document_did_open()
136136
autocmd BufWritePost * call s:on_text_document_did_save()
137137
autocmd BufWinLeave * call s:on_text_document_did_close()
138+
autocmd BufWipeout * call s:on_buf_wipeout(bufnr('<afile>'))
138139
autocmd InsertLeave * call s:on_text_document_did_change()
139140
autocmd CursorMoved * call s:on_cursor_moved()
140141
augroup END
@@ -216,8 +217,11 @@ endfunction
216217
function! s:on_text_document_did_close() abort
217218
let l:buf = bufnr('%')
218219
call lsp#log('s:on_text_document_did_close()', l:buf)
219-
if has_key(s:file_content, l:buf)
220-
call remove(s:file_content, l:buf)
220+
endfunction
221+
222+
function! s:on_buf_wipeout(buf) abort
223+
if has_key(s:file_content, a:buf)
224+
call remove(s:file_content, a:buf)
221225
endif
222226
endfunction
223227

0 commit comments

Comments
 (0)