Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lsp: handle some null arrays #2703

Merged
merged 1 commit into from
Feb 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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