cursorless-dev / cursorless

Don't let the cursor slow you down
https://www.cursorless.org/
MIT License
1.14k stars 79 forks source link

Narrow search range for tree-sitter queries #1769

Open pokey opened 1 year ago

pokey commented 1 year ago

In #1800, we introduced a workaround for https://github.com/tree-sitter/tree-sitter/issues/2484, which means that we no longer restrict the search range for our tree-sitter queries. That workaround has no impact on correctness, but could have performance implications for large files, as we get all matches and then filter them after the fact, rather than restricting to the range we care about. Once https://github.com/tree-sitter/tree-sitter/issues/2484 is fixed, we'd like to reactivate our code that restricts the search range, by rolling back #1800

josharian commented 1 year ago

In the meantime, If the file is particularly large, it might be better to disable treesitter scopes entirely, similarly to how VS code disable syntax highlighting on massive files.

pokey commented 1 year ago

Fwiw we're already parsing the file; this issue is just about running the tree query, which is likely many orders of magnitude faster

josharian commented 1 year ago

1889 removes some of the code that we will need to resume restricting the search tree.