From b4513fc4b0381bdff00c52e294e6da6c7f27aa19 Mon Sep 17 00:00:00 2001 From: Nick Gavalas Date: Mon, 10 Sep 2018 18:55:49 -0400 Subject: fix non-. prefix triggers overfiltering results --- autoload/ale/completion.vim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'autoload') 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] -- cgit v1.2.3