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

Merged
merged 1 commit into from
Oct 22, 2024
Merged

perf(treesitter): set regions early #587

merged 1 commit into from
Oct 22, 2024

Conversation

xzbdmw
Copy link
Contributor

@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

@folke folke merged commit 20aa858 into folke:main Oct 22, 2024
9 checks passed
@folke
Copy link
Owner

folke commented Oct 22, 2024

ty!

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.

2 participants