summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2019-01-21 21:11:02 +0000
committerGitHub <noreply@github.com>2019-01-21 21:11:02 +0000
commita4932679b5c0d2917a399614a25c9827d63eecb1 (patch)
tree827bc197e9fe6aa7864645cf1e52883a4b2d81d5 /autoload
parent37107df6f37a63f4e8e7fc8d08ef9ea7c0398a88 (diff)
parentbcf63eea96ae83a5557a779324b3c1c5ec59f990 (diff)
downloadale-a4932679b5c0d2917a399614a25c9827d63eecb1.zip
Merge pull request #2224 from andreypopp/andreypopp/lsp-hover-fix-column
Adjust column to be 0-based for LSP messages
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/completion.vim2
-rw-r--r--autoload/ale/lsp/message.vim12
2 files changed, 9 insertions, 5 deletions
diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim
index 157cac36..9baf29fd 100644
--- a/autoload/ale/completion.vim
+++ b/autoload/ale/completion.vim
@@ -480,7 +480,7 @@ function! s:OnReady(linter, lsp_details, ...) abort
\ b:ale_completion_info.line,
\ min([
\ b:ale_completion_info.line_length,
- \ b:ale_completion_info.column,
+ \ b:ale_completion_info.column + 1,
\ ]),
\ ale#completion#GetTriggerCharacter(&filetype, b:ale_completion_info.prefix),
\)
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