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

@ -127,6 +127,7 @@ pub enum ExtensionOperation {
#[derive(Clone)]
pub enum Event {
ExtensionsUpdated,
StartedReloading,
ExtensionInstalled(Arc<str>),
ExtensionFailedToLoad(Arc<str>),
@ -1213,9 +1214,7 @@ impl ExtensionStore {
self.extension_index = new_index;
cx.notify();
ExtensionEvents::global(cx).update(cx, |this, cx| {
this.emit(extension::Event::ExtensionsUpdated, cx)
});
cx.emit(Event::ExtensionsUpdated);
cx.spawn(|this, mut cx| async move {
cx.background_spawn({
@ -1317,6 +1316,12 @@ impl ExtensionStore {
this.proxy.set_extensions_loaded();
this.proxy.reload_current_theme(cx);
this.proxy.reload_current_icon_theme(cx);
if let Some(events) = ExtensionEvents::try_global(cx) {
events.update(cx, |this, cx| {
this.emit(extension::Event::ExtensionsInstalledChanged, cx)
});
}
})
.ok();
})