Closed tigersoldier closed 5 years ago
Fixes #110
@yyoncho this should also handle the XML case in #103
I tried it with xml language server and it works fine. One issue though - among with filtering we should do sorting based on the match. For example, if we have the items (abc bcd)
and the pattern is bc
we should put bcd
first in the list.
Here it is how vscode does that.
https://github.com/Microsoft/vscode/blob/master/src/vs/base/common/filters.ts#L524
@yyoncho Added sorting. It's different from VS Code because the flex matching algorithm is a simple O(M+N) greedy match instead of O(M * N) dynamic programming. Performance wise it's better but some candidates may result in sub-optimal scoring. Hopefully it's sufficient for common cases.
Hm, I tried the PR but I still get the items unsorted but I can see that the sort method is called. I will investigate further and let you know.
@yyoncho Try clearing company-transformers
. If you use spacemacs it will be set to some value that re-orders the candidates by occurance
@tigersoldier thank you, that was the case. It works very well! Now, will it be fine to turn on client filtering by default for all clients?
Adding a customizable option
company-lsp-match-candidate-predicate
. The default value is set tocompany-lsp-match-candidate-flex
. Also providecompany-lsp-match-candidate-prefix
in case some people prefer the old way.