mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-18 16:04:17 +08:00
#1162 Add unfinished experimental code for supporting LSP completion, clean up the tests, and make the completion cancelling better
This commit is contained in:
@@ -86,3 +86,24 @@ function! ale#lsp#message#DidClose(buffer) abort
|
||||
\ },
|
||||
\}]
|
||||
endfunction
|
||||
|
||||
let s:COMPLETION_TRIGGER_INVOKED = 1
|
||||
let s:COMPLETION_TRIGGER_CHARACTER = 2
|
||||
|
||||
function! ale#lsp#message#Completion(buffer, line, column, trigger_character) abort
|
||||
let l:message = [0, 'textDocument/completion', {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')),
|
||||
\ },
|
||||
\ 'position': {'line': a:line - 1, 'character': a:column - 1},
|
||||
\}]
|
||||
|
||||
if !empty(a:trigger_character)
|
||||
let l:message[2].context = {
|
||||
\ 'triggerKind': s:COMPLETION_TRIGGER_CHARACTER,
|
||||
\ 'triggerCharacter': a:trigger_character,
|
||||
\}
|
||||
endif
|
||||
|
||||
return l:message
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user