mirror of
https://github.com/dense-analysis/ale
synced 2025-01-31 04:24:05 +00:00
Fix completion with langserver (autoimport in go)
This commit is contained in:
parent
7265ceb6d0
commit
4062b05669
@ -523,13 +523,45 @@ function! ale#completion#ParseLSPCompletions(response) abort
|
||||
let l:doc = l:doc.value
|
||||
endif
|
||||
|
||||
call add(l:results, {
|
||||
let l:result = {
|
||||
\ 'word': l:word,
|
||||
\ 'kind': ale#completion#GetCompletionSymbols(get(l:item, 'kind', '')),
|
||||
\ 'icase': 1,
|
||||
\ 'menu': get(l:item, 'detail', ''),
|
||||
\ 'info': (type(l:doc) is v:t_string ? l:doc : ''),
|
||||
\})
|
||||
\}
|
||||
|
||||
if has_key(l:item, 'additionalTextEdits')
|
||||
let l:text_changes = []
|
||||
for l:edit in l:item.additionalTextEdits
|
||||
let l:range = l:edit.range
|
||||
call add(l:text_changes, {
|
||||
\ 'start': {
|
||||
\ 'line': l:range.start.line + 1,
|
||||
\ 'offset': l:range.start.character + 1,
|
||||
\ },
|
||||
\ 'end': {
|
||||
\ 'line': l:range.end.line + 1,
|
||||
\ 'offset': l:range.end.character + 1,
|
||||
\ },
|
||||
\ 'newText': l:edit.newText,
|
||||
\})
|
||||
endfor
|
||||
|
||||
let l:changes = [{
|
||||
\ 'fileName': expand('%:p'),
|
||||
\ 'textChanges': l:text_changes,
|
||||
\}]
|
||||
\
|
||||
let l:result.user_data = json_encode({
|
||||
\ 'codeActions': [{
|
||||
\ 'description': 'completion',
|
||||
\ 'changes': l:changes,
|
||||
\ }],
|
||||
\ })
|
||||
endif
|
||||
|
||||
call add(l:results, l:result)
|
||||
endfor
|
||||
|
||||
if has_key(l:info, 'prefix')
|
||||
|
Loading…
Reference in New Issue
Block a user