Fuzzy matching does not work on an arbitrary parts of the compl item #1854
Replies: 7 comments 3 replies
-
I suffer from exactly the same problem. I played around with the following fuzzy matching options but none of them seem to enable the desired behavior which is to simply fuzzy match my input across all parts of each completion candidate: matching = {
disallow_fuzzy_matching = <bool>,
disallow_fullfuzzy_matching = <bool>,
disallow_partial_fuzzy_matching = <bool>,
disallow_partial_matching = <bool>,
disallow_prefix_unmatching = <bool>,
disallow_symbol_nonprefix_matching = <bool>,
} Did you find a solution to this @asmodeus812? |
Beta Was this translation helpful? Give feedback.
-
I have been using coc for a while now, one of the primary reasons being exactly this. Coc implements a much better autocomplete, ported from vscode. |
Beta Was this translation helpful? Give feedback.
-
I looked into this a bit further and the option we are interested in definitely seems to be nvim-cmp/lua/cmp/matcher_spec.lua Lines 86 to 89 in a110e12 Like you I tested this with java and even when this option is set to |
Beta Was this translation helpful? Give feedback.
-
Doubt it is the language server, the coc-java extension does not have/does anything special with the completion items. The implementation of nvim-cmp is pretty basic compared to vscode's lsp client. |
Beta Was this translation helpful? Give feedback.
-
After further investigations I am completely puzzled now. Even with java/jdtls the matching of arbitrary parts sometimes works and sometimes (most of the times) it simply doesnt. It even happened that I have a java object where some methods are matched and on the same object others are not with no clear to me pattern why. |
Beta Was this translation helpful? Give feedback.
-
I've investigated this and I know the reason. It is because jdtls does not support fuzzy match and defaults the max completion items to 50, so the cmp's fuzzy matching is applied after server's prefixed matching. For example, if you type To resovle the problem, just remove the default truncation limit of completion item for jdtls: require("lspconfig").jdtls.setup({
settings = {
java = { completion = { maxResults = 0 }}
}
})
|
Beta Was this translation helpful? Give feedback.
-
Does anyone have a solution for this? |
Beta Was this translation helpful? Give feedback.
-
I have had this annoying pet peeve which is regarding the way cmp would not allow us to complete fuzzy-ly words or parts of the completion item, be in at start mid or end, mostly mid and end. Here is an example:
Starting off from the list of
Collections
. I want to filter out all methods which are related to mapping most of which look like that{noun}{verb}Map
Writing down
map
, suggestsmax
, which is wrong, there are a ton of methods fromCollections
which end inMap
ormap
. Which is what i am aiming for here, the only way to resolve this is to remember how the method starts or what exact words follow each other to match it is a pain. But even that is not correct, since what i knowCollections
has some map methods, but i do not remember what exactly, to remind myself, I want is to see allmap
related methods, with whatever prefix strings they have.Here is a preview of some
map
related methodsHere is my config
Beta Was this translation helpful? Give feedback.
All reactions