-
-
Notifications
You must be signed in to change notification settings - Fork 91
Use narrow search range instead of full document for Tree sitter queries #2714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
||
;;!! aaa = 0; | ||
( | ||
(_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a common ancestor for all captures. Nodes not intersecting with the search range will not be matched.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For more information
#1769 (comment)
Note to self:
|
Possible future direction: We could make querying more incremental so it doesn't lock up with a gigantic query, but that's tricky because we don't necessarily know the tradeoff point. Multiple queries could be slower overall. Some of this is limited by the fact that the actual grammar allows you to select an infinite amount of targets if you ask for it. So there's some limit to what we can do. We discussed the idea of a configuration default limit, but it's pretty hazy. I seem to recall least one person running into a problem where VS Code became extremely laggy after they accidentally asked for hundreds of thousands of selections. OTOH it's conceivable you could want to use this to do a gigantic refactor across the whole file? |
...ine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/getQuerySearchRange.ts
Show resolved
Hide resolved
...ine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/getQuerySearchRange.ts
Show resolved
Hide resolved
…andlers/TreeSitterScopeHandler/getQuerySearchRange.ts
Today we generate all captures in the entire document whenever we do a Tree sitter query. This is of course quite expensive for large documents and it would be better if we could narrow the search range. That is what's implemented in this pull request.
I also found some incorrect scm patterns that broke with this implementation that I have fixed.
Fixes #1769
Checklist