language: Return early if no grammars are added#48685
language: Return early if no grammars are added#48685MrSubidubi merged 1 commit intozed-industries:mainfrom
Conversation
MrSubidubi
left a comment
There was a problem hiding this comment.
As so often, nice catch and nice digging!
I just did a quick check and it seems that
zed/crates/language_extension/src/language_extension.rs
Lines 41 to 43 in e8030ae
3a778e5 to
b2350a0
Compare
|
@MrSubidubi thanks for checking! Yes, that’s right. The check shouldn’t live in the proxy implementations. It makes more sense to handle it at the I initially added the check there because |
MrSubidubi
left a comment
There was a problem hiding this comment.
Just checked again, sorry for the back and forth and the nit here. I think it would be better if we were to add this check at the level of the language registry -
zed/crates/language/src/language_registry.rs
Lines 1251 to 1258 in e8030ae
b2350a0 to
eba42ee
Compare
|
@MrSubidubi thank you and no worries! I've added the check back into I totally missed remove_languages so it makes sense to have those checks there. |
eba42ee to
bcecac4
Compare
MrSubidubi
left a comment
There was a problem hiding this comment.
Again, nice find, thank you so much and thanks for the follow-ups!
* main: (57 commits) agent: Fix disabled MCP servers disappearing from UI after restart (zed-industries#47758) Update Rust crate git2 to v0.20.4 [SECURITY] (zed-industries#48400) Update Rust crate time to v0.3.47 [SECURITY] (zed-industries#48514) gpui: Reset `external_files_dragged` after successful drag-drop on macOS (zed-industries#48727) language: Return early if no grammars are added (zed-industries#48685) Properly handle multi-char folds (zed-industries#48721) collab: Proxy `GET /extensions` to Cloud (zed-industries#48717) git: Fix a potential misalignment in the side-by-side diff (zed-industries#48690) Move extension API DTOs into `cloud_api_types` (zed-industries#48689) git: Add a setting for the default view mode of `SplittableEditor` (zed-industries#48440) Use proper settings name for semantic tokens' settings UI (zed-industries#48686) gpui: Fix restarting panicking due to double borrows on windows (zed-industries#48667) Strip broken thinking blocks from Anthropic requests (zed-industries#48548) keymap_editor: Add `alt-l` keybinding for cycling favorite models (zed-industries#48390) Only raise Windows timer resolution while blocking with timeout (zed-industries#48379) editor: Propagate `buffer_font_features` to signatureHelp popover (zed-industries#48653) Add configurable LSP timeout setting (zed-industries#44745) editor: Use buffer_font for folds and change foreground color (zed-industries#48652) lsp: Update root_path for compatibility with language servers (zed-industries#48587) Fix panic with LSP folds on disappearing excerpts (zed-industries#48649) ...
Helps #48601
Whenever an extension is installed, we call
register_grammarseven 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
LanguageChangedevents 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.
Release Notes: