Skip to content

Commit 8f48b74

Browse files
Christian Clasonprabirshrestha
authored andcommitted
Fixup lsp_location_item_to_vim (#657)
Refactoring introduced an additional +1 to line numbers; correct it for `PeekDefinition`. see discussion on #647
1 parent 730f1c4 commit 8f48b74

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

autoload/lsp/utils/location.vim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,14 @@ function! s:lsp_location_item_to_vim(loc, cache) abort
8181
endif
8282

8383
if l:use_link
84+
" viewstart/end decremented to account for incrementing in _lsp_to_vim
8485
return {
8586
\ 'filename': l:path,
8687
\ 'lnum': l:line,
8788
\ 'col': l:col,
8889
\ 'text': l:text,
89-
\ 'viewstart': lsp#utils#position#_lsp_to_vim(l:path, a:loc['targetRange']['start'])[0],
90-
\ 'viewend': lsp#utils#position#_lsp_to_vim(l:path, a:loc['targetRange']['end'])[0],
90+
\ 'viewstart': lsp#utils#position#_lsp_to_vim(l:path, a:loc['targetRange']['start'])[0] - 1,
91+
\ 'viewend': lsp#utils#position#_lsp_to_vim(l:path, a:loc['targetRange']['end'])[0] - 1,
9192
\ }
9293
else
9394
return {

0 commit comments

Comments
 (0)