Make class search range larger #1192
Merged
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.
After doing an admittedly quite small amount of benchmarking it seems that expanding the search range does have a perf impact but it's not so much of one that we shouldn't increase it. Though this very likely depends on the regex in use.
I've done a few major things in this PR:
cva
(the same reason it was expanded for completions in ExpandclassRegex
search range #840)Fixes #1032
Fixes #984
This is a mostly a stop-gap measure until I can land a better system for "parsing" documents that aims to make most class detection trivial and quite fast.
Custom regexes won't necessarily be able to take advantage of that but if I can get some perf wins elsewhere I might be able to expand the search range even further. Ideally I'd figure out a way to run regexes in a worker thread and allow them to be "cancelled" when they take too long but that is a fairly major-ish undertaking.