diff options
author | w0rp <devw0rp@gmail.com> | 2020-08-27 08:57:12 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2020-08-27 08:57:12 +0100 |
commit | a955f5dfa8811a44c9e871b06b55c0bcad13f0d9 (patch) | |
tree | 1b590afa6f9d8651be5027156452876b1acba9d2 /autoload | |
parent | 396fba7cca5bb6cd5774173241e3e606045e1c46 (diff) | |
download | ale-a955f5dfa8811a44c9e871b06b55c0bcad13f0d9.zip |
#3312 - Just check if additionalTextEdits is non-empty
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/completion.vim | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim index 87efd191..f6a0c350 100644 --- a/autoload/ale/completion.vim +++ b/autoload/ale/completion.vim @@ -496,18 +496,6 @@ function! ale#completion#NullFilter(buffer, item) abort return 1 endfunction -" Check if additional text edits make changes starting on lines other than the -" one you're asking for completions on. -function! s:TextEditsChangeOtherLines(line, text_edit_list) abort - for l:edit in a:text_edit_list - if l:edit.range.start.line + 1 isnot a:line - return 1 - endif - endfor - - return 0 -endfunction - function! ale#completion#ParseLSPCompletions(response) abort let l:buffer = bufnr('') let l:info = get(b:, 'ale_completion_info', {}) @@ -552,9 +540,8 @@ function! ale#completion#ParseLSPCompletions(response) abort " Don't use LSP items with additional text edits when autoimport for " completions is turned off. - if has_key(l:item, 'additionalTextEdits') + if !empty(get(l:item, 'additionalTextEdits')) \&& !g:ale_completion_autoimport - \&& s:TextEditsChangeOtherLines(l:info.line, l:item.additionalTextEdits) continue endif @@ -576,15 +563,6 @@ function! ale#completion#ParseLSPCompletions(response) abort let l:text_changes = [] for l:edit in l:item.additionalTextEdits - " Don't apply additional text edits that are identical to the - " word we're going to insert anyway. - if l:edit.newText is# l:word - \&& l:edit.range.start.line + 1 is l:info.line - \&& l:edit.range.end.line + 1 is l:info.line - \&& l:edit.range.start.character is l:edit.range.end.character - continue - endif - call add(l:text_changes, { \ 'start': { \ 'line': l:edit.range.start.line + 1, |