Skip to content

Commit 1acd906

Browse files
committed
Remove content when buffer is closed
1 parent 7fd75b2 commit 1acd906

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

autoload/lsp.vim

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,18 +157,18 @@ function! s:on_text_document_did_open() abort
157157
endfunction
158158

159159
function! s:on_text_document_did_save() abort
160-
call lsp#log('s:on_text_document_did_save()', bufnr('%'))
161160
let l:buf = bufnr('%')
161+
call lsp#log('s:on_text_document_did_save()', l:buf)
162162
for l:server_name in lsp#get_whitelisted_servers()
163-
call s:ensure_flush(bufnr('%'), l:server_name, {result->s:call_did_save(l:buf, l:server_name, result, function('s:Noop'))})
163+
call s:ensure_flush(:buf, l:server_name, {result->s:call_did_save(l:buf, l:server_name, result, function('s:Noop'))})
164164
endfor
165165
endfunction
166166

167167
function! s:on_text_document_did_change() abort
168-
call lsp#log('s:on_text_document_did_change()', bufnr('%'))
169168
let l:buf = bufnr('%')
169+
call lsp#log('s:on_text_document_did_change()', l:buf)
170170
for l:server_name in lsp#get_whitelisted_servers()
171-
call s:ensure_flush(bufnr('%'), l:server_name, function('s:Noop'))
171+
call s:ensure_flush(l:buf, l:server_name, function('s:Noop'))
172172
endfor
173173
endfunction
174174

@@ -214,7 +214,9 @@ function! s:call_did_save(buf, server_name, result, cb) abort
214214
endfunction
215215

216216
function! s:on_text_document_did_close() abort
217-
call lsp#log('s:on_text_document_did_close()', bufnr('%'))
217+
let l:buf = bufnr('%')
218+
call lsp#log('s:on_text_document_did_close()', l:buf)
219+
call remove(s:file_content, l:buf)
218220
endfunction
219221

220222
function! s:ensure_flush_all(buf, server_names) abort

0 commit comments

Comments
 (0)