diff options
author | Andrey Popp <8mayday@gmail.com> | 2019-01-21 17:00:23 +0300 |
---|---|---|
committer | Andrey Popp <8mayday@gmail.com> | 2019-01-21 17:40:33 +0300 |
commit | 2e85eed756f29f37cce41db6edccb40bd3f68437 (patch) | |
tree | b95d660aa304b6000e2a6a490f5bfa10e20f4b7d | |
parent | bffb26cb72017c33be08d5ee74ec56b982bdf736 (diff) | |
download | ale-2e85eed756f29f37cce41db6edccb40bd3f68437.zip |
Fix ale#lsp#message#* to convert column to 0-based
This is what LSP specifies.
-rw-r--r-- | autoload/ale/lsp/message.vim | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/autoload/ale/lsp/message.vim b/autoload/ale/lsp/message.vim index 9fffb83a..a9921478 100644 --- a/autoload/ale/lsp/message.vim +++ b/autoload/ale/lsp/message.vim @@ -3,6 +3,10 @@ " " Messages in this movie will be returned in the format " [is_notification, method_name, params?] +" +" All functions which accept line and column arguments expect them to be 1-based +" (the same format as being returned by getcurpos() and friends), those then +" will be converted to 0-based as specified by LSP. let g:ale_lsp_next_version_id = 1 " The LSP protocols demands that we send every change to a document, including @@ -98,7 +102,7 @@ function! ale#lsp#message#Completion(buffer, line, column, trigger_character) ab \ 'textDocument': { \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), \ }, - \ 'position': {'line': a:line - 1, 'character': a:column}, + \ 'position': {'line': a:line - 1, 'character': a:column - 1}, \}] if !empty(a:trigger_character) @@ -116,7 +120,7 @@ function! ale#lsp#message#Definition(buffer, line, column) abort \ 'textDocument': { \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), \ }, - \ 'position': {'line': a:line - 1, 'character': a:column}, + \ 'position': {'line': a:line - 1, 'character': a:column - 1}, \}] endfunction @@ -125,7 +129,7 @@ function! ale#lsp#message#References(buffer, line, column) abort \ 'textDocument': { \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), \ }, - \ 'position': {'line': a:line - 1, 'character': a:column}, + \ 'position': {'line': a:line - 1, 'character': a:column - 1}, \ 'context': {'includeDeclaration': v:false}, \}] endfunction @@ -141,7 +145,7 @@ function! ale#lsp#message#Hover(buffer, line, column) abort \ 'textDocument': { \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), \ }, - \ 'position': {'line': a:line - 1, 'character': a:column}, + \ 'position': {'line': a:line - 1, 'character': a:column - 1}, \}] endfunction |