-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for fuzzy completion #4796
Labels
Comments
GPT gives a working example, don't know if this the best ways to do this though. function! FuzzyMatch(word, pattern)
" Convert both word and pattern to lowercase for case-insensitive matching
let l:word = tolower(a:word)
let l:pattern = tolower(a:pattern)
" Initialize indexes for word and pattern
let l:wi = 0
let l:pi = 0
" Traverse the word
while l:wi < len(l:word) && l:pi < len(l:pattern)
if l:word[l:wi] == l:pattern[l:pi]
" Move to the next pattern character if there's a match
let l:pi += 1
endif
" Always move to the next word character
let l:wi += 1
endwhile
" If we reached the end of the pattern, it's a match
return l:pi == len(l:pattern)
endfunction
" changes to autoload/ale/completion.vim ale#completion#Filter
"
let l:filtered_suggestions = []
for l:item in a:suggestions
let l:word = type(l:item) is v:t_string ? l:item : l:item.word
if a:exact_prefix_match
if l:word is# a:prefix
call add(l:filtered_suggestions, l:item)
endif
else
if FuzzyMatch(l:word, a:prefix)
call add(l:filtered_suggestions, l:item)
endif
endif
endfor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, thanks for this amazing vim plugin.
I'm using vim-ale with gopls for my golang dev environment, switching from youcomplete, i find one little problem:
when i type something, the completion windows shows up, like:
utils.logpr , and it will show completion options, but if i type
utils.logpinfo , completion doesn't work then.
I assume it's because the completion will only use my current input as a whole word, and this can be an annoying problem if the function name if very long, and there are multiple options.
Is there anyways to improve this? or is this a gopls issue?
The text was updated successfully, but these errors were encountered: