settings: Auto-update JSON schemas for settings when extensions are un/installed (#26633)

Because of #26562, it is now possible to subscribe to extension update
events within the LSP store, where we can then update the Schemas sent
to the JSON LSP resulting in dynamic updates to the auto-complete
suggestions and diagnostics in settings. Notably, this means newly
installed languages and (icon) themes will auto-complete correctly as
soon as the extension is installed.

Closes #15436

Release Notes:

- Fixed an issue where autocomplete suggestions and diagnostics for
languages and (icon) themes in settings would not update when the
extension with which they were added was installed or uninstalled
This commit is contained in:
Ben Kunkle 2025-03-13 11:50:07 -05:00 committed by GitHub
parent 79874872cb
commit 25f407baab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 180 additions and 32 deletions

View file

@ -555,6 +555,23 @@ pub trait LspAdapter: 'static + Send + Sync {
// By default all language servers are rooted at the root of the worktree.
Some(Arc::from("".as_ref()))
}
/// Method only implemented by the default JSON language server adapter.
/// Used to provide dynamic reloading of the JSON schemas used to
/// provide autocompletion and diagnostics in Zed setting and keybind
/// files
fn is_primary_zed_json_schema_adapter(&self) -> bool {
false
}
/// Method only implemented by the default JSON language server adapter.
/// Used to clear the cache of JSON schemas that are used to provide
/// autocompletion and diagnostics in Zed settings and keybinds files.
/// Should not be called unless the callee is sure that
/// `Self::is_primary_zed_json_schema_adapter` returns `true`
async fn clear_zed_json_schema_cache(&self) {
unreachable!("Not implemented for this adapter. This method should only be called on the default JSON language server adapter");
}
}
async fn try_fetch_server_binary<L: LspAdapter + 'static + Send + Sync + ?Sized>(