Skip to content

Commit

Permalink
lsp: handle some null arrays
Browse files Browse the repository at this point in the history
Handle some null arrays to avoid errors.

Fixes fatih#2701
  • Loading branch information
bhcleek committed Feb 7, 2020
1 parent a086b60 commit f46bfed
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions autoload/go/lsp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,12 @@ function! s:sameIDsHandler(next, msg) abort dict
\ 'enclosing': [],
\ }

for l:loc in a:msg
let l:msg = a:msg
if a:msg is v:null
let l:msg = []
endif

for l:loc in l:msg
if l:loc.uri !=# l:furi
continue
endif
Expand Down Expand Up @@ -787,9 +792,15 @@ endfunction
function! s:referencesHandler(next, msg) abort dict
let l:result = []

call sort(a:msg, funcref('s:compareLocations'))
let l:msg = a:msg

if l:msg is v:null
let l:msg = []
endif

call sort(l:msg, funcref('s:compareLocations'))

for l:loc in a:msg
for l:loc in l:msg
let l:fname = go#path#FromURI(l:loc.uri)
let l:line = l:loc.range.start.line+1
let l:bufnr = bufnr(l:fname)
Expand Down

0 comments on commit f46bfed

Please sign in to comment.