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

Update treesitter parsing with text buffer chunk api #215471

Merged
merged 2 commits into from
Jun 18, 2024

Conversation

rebornix
Copy link
Member

@rebornix rebornix commented Jun 13, 2024

Introduced a new getNearChunk api to get the minimal text after index offset. Adopted this in branch https://github.com/microsoft/vscode/tree/alexr00/gettingStartedWithTreeSitter and I can see the perf difference for editing

Before

image

After

image

@alexr00 I tried to adopt this change in #213565 but I didn't see the incremental parsing, even a single type will trigger the whole document to be re-parsed (from index: 0). We can catch up and see what's going on and what else you potentially need from the text buffer side.

@rebornix rebornix self-assigned this Jun 13, 2024
@rebornix rebornix requested a review from alexr00 June 13, 2024 19:22
Copy link
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rebornix this looks great! Would you consider merging it to main? #213565 needs some work still but I can adopt your chunk API there when I merge main into that PR. Or, if you'd prefer, I can just cherry-pick your changes into that PR.

@rebornix
Copy link
Member Author

@alexr00 it's already in main so the only change you need in @213565 is https://github.com/microsoft/vscode/pull/215471/files#diff-57fe96385cfa45838fd3f40c7e745756d14de8201b073b8d46bd8bd8edb2e43e once you merge main into it.

@rebornix rebornix changed the base branch from alexr00/gettingStartedWithTreeSitter to alexr00/treeSitterParserService June 18, 2024 15:21
@rebornix
Copy link
Member Author

@alexr00 I updated the PR against alexr00/treeSitterParserService, we can merge it anytime. I'll do some benchmark and see if incremental parsing is still working.

@jrieken jrieken removed request for jrieken and mjbvz June 18, 2024 16:43
@rebornix
Copy link
Member Author

It's actually doing great with the latest code

image

I'm merging this into your PR @alexr00 first and we can see what else we can improve.

@rebornix rebornix merged commit eb265f5 into alexr00/treeSitterParserService Jun 18, 2024
4 checks passed
@rebornix rebornix deleted the rebornix/right-cricket branch June 18, 2024 17:17
@alexr00
Copy link
Member

alexr00 commented Jun 19, 2024

Great, thanks for doing that!

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.

None yet

2 participants