#1162 Get LSP completions working reasonably well
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user