Fuzzy matching instead of startsWith for filtering #734
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Experimental, subject to change
This way, when you have a function
parseJsonString
and you only typeparseString
or search forjsonString
, you will find the symbols.Additional benefit of this: we are losing a bunch of GC allocations for every request. I haven't measured what kind of improvements we would get from this yet though.
Note that without the IDE/editor sorting imports in a decent manner, this will quickly overwhelm users auto-complete.
With VSCode's default sorting and filtering this works very well though.
Feel free to give this PR a try and give your feedback. (cc @ryuukk @vushu)
Ideally for code cleanliness, prettyFuzzyMatch should not be part of dsymbol, but only of dcd.
Side-note for UFCS in dsymbol causing the fuzzymatch dependency in there:
I think we should move out the UFCS auto-complete / cursor token matching code out of dsymbol into DCD, and only let dsymbol do all the UFCS processing, e.g returning UFCS symbols joined into the regular symbols using the usual (or to-be-created) listing APIs. (indicating the UFCS symbols just using flags)
I noticed that the UFCS matcher also just started to reimplement bunch of stuff from DCD and still misses things, such as recognizing
int
as partially typed identifier. Splitting the matcher from UFCS symbol generation and moving just the matcher into DCD's existing matching code would deduplicate a lot there.