summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2018-09-14 13:32:25 +0100
committerGitHub <noreply@github.com>2018-09-14 13:32:25 +0100
commit0868cb769d6ca1f7815d1e17f5fa24587eec9a4b (patch)
treefec65e6de20cc15e60fae5abdaa2437edad09273 /autoload
parent7f1c411b5e5ef978e7bf4d032e6bd1ddeabb20c5 (diff)
parentb4513fc4b0381bdff00c52e294e6da6c7f27aa19 (diff)
downloadale-0868cb769d6ca1f7815d1e17f5fa24587eec9a4b.zip
Merge pull request #1906 from ngavalas/autocomplete-trigger-prefix
fix non-. prefix triggers overfiltering results
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/completion.vim8
1 files changed, 5 insertions, 3 deletions
diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim
index e96774c3..2556d50c 100644
--- a/autoload/ale/completion.vim
+++ b/autoload/ale/completion.vim
@@ -98,14 +98,15 @@ function! ale#completion#GetTriggerCharacter(filetype, prefix) abort
return ''
endfunction
-function! ale#completion#Filter(buffer, suggestions, prefix) abort
+function! ale#completion#Filter(buffer, filetype, suggestions, prefix) abort
let l:excluded_words = ale#Var(a:buffer, 'completion_excluded_words')
+ let l:triggers = s:GetFiletypeValue(s:trigger_character_map, a:filetype)
" For completing...
" foo.
" ^
" We need to include all of the given suggestions.
- if a:prefix is# '.'
+ if index(l:triggers, a:prefix) >= 0
let l:filtered_suggestions = a:suggestions
else
let l:filtered_suggestions = []
@@ -369,7 +370,7 @@ function! ale#completion#ParseLSPCompletions(response) abort
endfor
if has_key(l:info, 'prefix')
- return ale#completion#Filter(l:buffer, l:results, l:info.prefix)
+ return ale#completion#Filter(l:buffer, &filetype, l:results, l:info.prefix)
endif
return l:results
@@ -390,6 +391,7 @@ function! ale#completion#HandleTSServerResponse(conn_id, response) abort
if l:command is# 'completions'
let l:names = ale#completion#Filter(
\ l:buffer,
+ \ &filetype,
\ ale#completion#ParseTSServerCompletions(a:response),
\ b:ale_completion_info.prefix,
\)[: g:ale_completion_max_suggestions - 1]