diff options
author | w0rp <devw0rp@gmail.com> | 2017-11-26 13:01:01 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-11-26 13:01:01 +0000 |
commit | 8254e507d67bde88081602dbf4ff9bca03ab23cd (patch) | |
tree | 84dde1e68aab78fabf601c6fbc2b433f70499af2 /autoload | |
parent | b1a6abdda6f23ba314799f21c04d30e3411cebc7 (diff) | |
download | ale-8254e507d67bde88081602dbf4ff9bca03ab23cd.zip |
#1162 Get LSP completions working reasonably well
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/completion.vim | 12 | ||||
-rw-r--r-- | autoload/ale/lsp/message.vim | 2 |
2 files changed, 11 insertions, 3 deletions
diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim index f8143903..6a723a6c 100644 --- a/autoload/ale/completion.vim +++ b/autoload/ale/completion.vim @@ -326,6 +326,14 @@ function! s:GetLSPCompletions(linter) abort \ b:ale_completion_info.prefix, \) else + " Send a message saying the buffer has changed first, otherwise + " completions won't know what text is nearby. + call ale#lsp#Send( + \ l:id, + \ ale#lsp#message#DidChange(l:buffer), + \ l:root + \) + " For LSP completions, we need to clamp the column to the length of " the line. python-language-server and perhaps others do not implement " this correctly. @@ -334,9 +342,9 @@ function! s:GetLSPCompletions(linter) abort \ b:ale_completion_info.line, \ min([ \ b:ale_completion_info.line_length, - \ b:ale_completion_info.column + \ b:ale_completion_info.column, \ ]), - \ '', + \ ale#completion#GetTriggerCharacter(&filetype, b:ale_completion_info.prefix), \) endif diff --git a/autoload/ale/lsp/message.vim b/autoload/ale/lsp/message.vim index a90d4e75..b3a039ce 100644 --- a/autoload/ale/lsp/message.vim +++ b/autoload/ale/lsp/message.vim @@ -95,7 +95,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 - 1}, + \ 'position': {'line': a:line - 1, 'character': a:column}, \}] if !empty(a:trigger_character) |