Skip to content

Improve performance when detecting JSX auto close - #48622

Merged
smitbarmase merged 2 commits into
zed-industries:mainfrom
marcocondrache:eslosris
Feb 10, 2026
Merged

Improve performance when detecting JSX auto close#48622
smitbarmase merged 2 commits into
zed-industries:mainfrom
marcocondrache:eslosris

Conversation

@marcocondrache

@marcocondrache marcocondrache commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

Helps #48601

image

syntax_layers does some offset conversion that might require getting some chunks from the rope, which is quite expensive. For detecting autoclose, we only use the language from those syntax layers, so having a short path that skips all the conversion should skip some sum_tree traversals.

I'm pretty sure other places would benefit from this as well, but I haven't searched them yet.

Release Notes:

  • N/A

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Feb 6, 2026
@github-actions github-actions Bot added the community champion Issues filed by our amazing community champions! 🫶 label Feb 6, 2026
MrSubidubi pushed a commit that referenced this pull request Feb 8, 2026
Helps #48601

Whenever an extension is installed, we call `register_grammars` even
when the grammar list is empty. This unnecessarily increments
reload_count and notifies the LSP store, which clears all languages and
triggers a full reparse.

Clearing languages also emits `LanguageChanged` events for buffers,
causing the editor to perform expensive recomputations (like
#48622) which can block the
main thread for large multibuffers.

This PR addresses the empty-grammar case. If an extension actually adds
a grammar, the underlying issue still exists and will require additional
fixes to fully resolve.

- [ ] Tests or screenshots needed?
- [x] Code Reviewed
- [ ] Manual QA

Release Notes:

- Fixed an issue where installing theme extensions could block the main
thread

@smitbarmase smitbarmase left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@smitbarmase
smitbarmase merged commit de7f2f0 into zed-industries:main Feb 10, 2026
27 checks passed
jasonsmithio pushed a commit to paddleboarddev/paddleboard that referenced this pull request May 31, 2026
Helps #48601

Whenever an extension is installed, we call `register_grammars` even
when the grammar list is empty. This unnecessarily increments
reload_count and notifies the LSP store, which clears all languages and
triggers a full reparse.

Clearing languages also emits `LanguageChanged` events for buffers,
causing the editor to perform expensive recomputations (like
zed-industries/zed#48622) which can block the
main thread for large multibuffers.

This PR addresses the empty-grammar case. If an extension actually adds
a grammar, the underlying issue still exists and will require additional
fixes to fully resolve.

- [ ] Tests or screenshots needed?
- [x] Code Reviewed
- [ ] Manual QA

Release Notes:

- Fixed an issue where installing theme extensions could block the main
thread
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
Helps zed-industries#48601

Whenever an extension is installed, we call `register_grammars` even
when the grammar list is empty. This unnecessarily increments
reload_count and notifies the LSP store, which clears all languages and
triggers a full reparse.

Clearing languages also emits `LanguageChanged` events for buffers,
causing the editor to perform expensive recomputations (like
zed-industries#48622) which can block the
main thread for large multibuffers.

This PR addresses the empty-grammar case. If an extension actually adds
a grammar, the underlying issue still exists and will require additional
fixes to fully resolve.

- [ ] Tests or screenshots needed?
- [x] Code Reviewed
- [ ] Manual QA

Release Notes:

- Fixed an issue where installing theme extensions could block the main
thread
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
Helps zed-industries#48601

<img width="1649" height="1071" alt="image"
src="https://github.com/user-attachments/assets/ff3dfee0-cc65-430f-a5fa-b4b4c36e8183"
/>


`syntax_layers` does some offset conversion that might require getting
some chunks from the rope, which is quite expensive. For detecting
autoclose, we only use the language from those syntax layers, so having
a short path that skips all the conversion should skip some sum_tree
traversals.
   
I'm pretty sure other places would benefit from this as well, but I
haven't searched them yet.

Release Notes:

- N/A

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
Helps zed-industries#48601

<img width="1649" height="1071" alt="image"
src="https://github.com/user-attachments/assets/ff3dfee0-cc65-430f-a5fa-b4b4c36e8183"
/>


`syntax_layers` does some offset conversion that might require getting
some chunks from the rope, which is quite expensive. For detecting
autoclose, we only use the language from those syntax layers, so having
a short path that skips all the conversion should skip some sum_tree
traversals.
   
I'm pretty sure other places would benefit from this as well, but I
haven't searched them yet.

Release Notes:

- N/A

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement community champion Issues filed by our amazing community champions! 🫶

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants