Fixup lsp_location_item_to_vim (#657)

Refactoring introduced an additional +1 to line numbers; correct it for `PeekDefinition`.

see discussion on https://github.com/prabirshrestha/vim-lsp/pull/647
This commit is contained in:
Christian Clason
2020-01-05 20:13:33 +01:00
committed by Prabir Shrestha
parent 730f1c40f0
commit 8f48b74e55

View File

@@ -81,13 +81,14 @@ function! s:lsp_location_item_to_vim(loc, cache) abort
endif
if l:use_link
" viewstart/end decremented to account for incrementing in _lsp_to_vim
return {
\ 'filename': l:path,
\ 'lnum': l:line,
\ 'col': l:col,
\ 'text': l:text,
\ 'viewstart': lsp#utils#position#_lsp_to_vim(l:path, a:loc['targetRange']['start'])[0],
\ 'viewend': lsp#utils#position#_lsp_to_vim(l:path, a:loc['targetRange']['end'])[0],
\ 'viewstart': lsp#utils#position#_lsp_to_vim(l:path, a:loc['targetRange']['start'])[0] - 1,
\ 'viewend': lsp#utils#position#_lsp_to_vim(l:path, a:loc['targetRange']['end'])[0] - 1,
\ }
else
return {