Skip to content

Commit b2b3199

Browse files
authored
Handle empty buffer-name (#730)
1 parent 80ec75e commit b2b3199

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

autoload/lsp.vim

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,12 @@ function! s:ensure_changed(buf, server_name, cb) abort
601601
let l:path = lsp#utils#get_buffer_uri(a:buf)
602602

603603
let l:buffers = l:server['buffers']
604+
if !has_key(l:buffers, l:path)
605+
let l:msg = s:new_rpc_success('file is not managed', { 'server_name': a:server_name, 'path': l:path })
606+
call lsp#log(l:msg)
607+
call a:cb(l:msg)
608+
return
609+
endif
604610
let l:buffer_info = l:buffers[l:path]
605611

606612
let l:changed_tick = getbufvar(a:buf, 'changedtick')
@@ -634,7 +640,7 @@ function! s:ensure_open(buf, server_name, cb) abort
634640
let l:path = lsp#utils#get_buffer_uri(a:buf)
635641

636642
if empty(l:path)
637-
let l:msg = s:new_rpc_error('ignore open since not a valid uri', { 'server_name': a:server_name, 'path': l:path })
643+
let l:msg = s:new_rpc_success('ignore open since not a valid uri', { 'server_name': a:server_name, 'path': l:path })
638644
call lsp#log(l:msg)
639645
call a:cb(l:msg)
640646
return

0 commit comments

Comments
 (0)