Skip to content
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

perf(treesitter): set regions early #587

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

xzbdmw
Copy link

@xzbdmw xzbdmw commented Oct 9, 2024

The get_parser and TSHighlight:new both parse the buffer which takes a lot of time since there are many error nodes, so set regions early to prevent this.

Both get_parser and TSHighlighter.new calls this parse, which calls parse_regions, and this call to included_regions is crucial, it will return an empty range, thus parse the entire buffer.

with this change, included_regions no longer return empty range, thus result in faster highlight.

related: MagicDuck/grug-far.nvim#286

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant