Skip to content

Commit

Permalink
Merge pull request #2951 from bhcleek/lsp/definition-null
Browse files Browse the repository at this point in the history
lsp: ignore nulls in definition and type definition handlers
  • Loading branch information
bhcleek authored Jul 6, 2020
2 parents 54a49eb + 14f3684 commit 8d1552c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions autoload/go/lsp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,10 @@ function! go#lsp#Definition(fname, line, col, handler) abort
endfunction

function! s:definitionHandler(next, msg) abort dict
if a:msg is v:null || len(a:msg) == 0
return
endif

" gopls returns a []Location; just take the first one.
let l:msg = a:msg[0]
let l:args = [[printf('%s:%d:%d: %s', go#path#FromURI(l:msg.uri), l:msg.range.start.line+1, go#lsp#lsp#PositionOf(getline(l:msg.range.start.line+1), l:msg.range.start.character), 'lsp does not supply a description')]]
Expand All @@ -598,6 +602,10 @@ function! go#lsp#TypeDef(fname, line, col, handler) abort
endfunction

function! s:typeDefinitionHandler(next, msg) abort dict
if a:msg is v:null || len(a:msg) == 0
return
endif

" gopls returns a []Location; just take the first one.
let l:msg = a:msg[0]
let l:args = [[printf('%s:%d:%d: %s', go#path#FromURI(l:msg.uri), l:msg.range.start.line+1, go#lsp#lsp#PositionOf(getline(l:msg.range.start.line+1), l:msg.range.start.character), 'lsp does not supply a description')]]
Expand Down

0 comments on commit 8d1552c

Please sign in to comment.