Add some experimental completion code for tsserver

This commit is contained in:
w0rp
2017-07-01 01:22:03 +01:00
parent 0d8be55c51
commit 9f21e45156
5 changed files with 262 additions and 11 deletions

View File

@@ -26,7 +26,7 @@ function! ale#lsp#tsserver_message#Change(buffer) abort
\ 'file': expand('#' . a:buffer . ':p'),
\ 'line': 1,
\ 'offset': 1,
\ 'endLine': 1073741824 ,
\ 'endLine': 1073741824,
\ 'endOffset': 1,
\ 'insertString': join(l:lines, "\n"),
\}]
@@ -35,3 +35,21 @@ endfunction
function! ale#lsp#tsserver_message#Geterr(buffer) abort
return [1, 'ts@geterr', {'files': [expand('#' . a:buffer . ':p')]}]
endfunction
function! ale#lsp#tsserver_message#Completions(buffer, line, column) abort
" An optional 'prefix' key can be added here for a completion prefix.
return [0, 'ts@completions', {
\ 'line': a:line,
\ 'offset': a:column,
\ 'file': expand('#' . a:buffer . ':p'),
\}]
endfunction
function! ale#lsp#tsserver_message#CompletionEntryDetails(buffer, line, column, entry_names) abort
return [0, 'ts@completionEntryDetails', {
\ 'line': a:line,
\ 'offset': a:column,
\ 'file': expand('#' . a:buffer . ':p'),
\ 'entryNames': a:entry_names,
\}]
endfunction