You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
with defaults settings, I get an snippet completion candidate that expands the snippet. However, if I write
ul>li.item$*5
I don't get anything.
I dug into the code and play with the configuration and found that the reason for this was fuzzy_cutoff (unifying_chars could technically also help, but keep reading), if I set it to 0, I get the expected completion result in both cases. This happens because
In the first case, cword is an empty string. Since * is not isalnum and isn't in an unifyin_char (from is_word), the fuzzy matching is performed against context.l_words_before. Again, since * is a symbol because of is_word, context.l_words_before is empty. This makes ratio 1 and is passes the default fuzzy_cutoff value
In the second case, cword is 5 because 5 is isalnum. This makes ratio 0, so it doesn't pass the default fuzzy_cutoff value.
unyfing_chars
"But, that's what unyfing_chars is for, right?" I thought. For most symbols, yes. If I add all of the symbols used in the emmet syntax to unyfing_chars I always get the expected snippet completion. The problem is that said symbols contain things like ., which isn't a problem for html, but it is for other languages.
For example, lua_ls (when configured to use the Neovim runtime libraries) gives two completion candidates for
vim.keymap.
both are snippets for the functions set and del.
With the default values for unyfing_chars, set and del are matched against an empty string (because . is a symbol, but vim.keymap.set starts with a char that is is_word, so it returns context.l_words_before, which is empty), so ratio is 1. They are shown.
With the modified values for unyfing_chars, set and del are matched against vim.keymap, the ratio is 0. They aren't shown.
Proposed solutions
filetype specific configurations
Cons:
Could get cumbersome on the plugin side
Still won't work for tsx/jsx unless some kind of autocmd changes the configuration dinamically depending on the context on the user side
modify what the fuzzy matching is made against
Cons:
I can't think of a better alternative that won't also have its own limitations. In general, I thinks this is a hard problem without some kind of per-language configuration
allow manual triggered to (maybe optionally) skip fuzzy_cutoff check
would allow users to skip this kind of check manually.
possible workarounds
Using something like
ul>li.item$*5.
doesn't changes the result from the language server and (incidentally) makes coq show the completion because . makes it match against an empty string (so ratio is 1)
The text was updated successfully, but these errors were encountered:
The problem
I encountered this issue while using emmet-language-server. If I write
with defaults settings, I get an snippet completion candidate that expands the snippet. However, if I write
I don't get anything.
I dug into the code and play with the configuration and found that the reason for this was
fuzzy_cutoff
(unifying_chars
could technically also help, but keep reading), if I set it to0
, I get the expected completion result in both cases. This happens becausecoq_nvim/coq/clients/lsp/worker.py
Lines 43 to 48 in 976012b
In the first case,
cword
is an empty string. Since*
is notisalnum
and isn't in anunifyin_char
(fromis_word
), the fuzzy matching is performed againstcontext.l_words_before
. Again, since*
is a symbol because ofis_word
,context.l_words_before
is empty. This makesratio
1 and is passes the defaultfuzzy_cutoff
valuecoq_nvim/coq/clients/lsp/worker.py
Lines 51 to 55 in 976012b
In the second case,
cword
is5
because5
isisalnum
. This makesratio
0, so it doesn't pass the defaultfuzzy_cutoff
value.unyfing_chars
"But, that's what unyfing_chars is for, right?" I thought. For most symbols, yes. If I add all of the symbols used in the emmet syntax to
unyfing_chars
I always get the expected snippet completion. The problem is that said symbols contain things like.
, which isn't a problem for html, but it is for other languages.For example,
lua_ls
(when configured to use the Neovim runtime libraries) gives two completion candidates forboth are snippets for the functions
set
anddel
.With the default values for
unyfing_chars
,set
anddel
are matched against an empty string (because.
is a symbol, butvim.keymap.set
starts with a char that isis_word
, so it returnscontext.l_words_before
, which is empty), so ratio is1
. They are shown.With the modified values for
unyfing_chars
,set
anddel
are matched againstvim.keymap
, the ratio is0
. They aren't shown.Proposed solutions
filetype specific configurations
Cons:
tsx
/jsx
unless some kind of autocmd changes the configuration dinamically depending on the context on the user sidemodify what the fuzzy matching is made against
Cons:
allow manual triggered to (maybe optionally) skip
fuzzy_cutoff
checkChanging
coq_nvim/coq/clients/lsp/worker.py
Lines 56 to 61 in 976012b
to
would allow users to skip this kind of check manually.
possible workarounds
Using something like
doesn't changes the result from the language server and (incidentally) makes coq show the completion because
.
makes it match against an empty string (soratio
is 1)The text was updated successfully, but these errors were encountered: