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:
parent
79874872cb
commit
25f407baab
10 changed files with 180 additions and 32 deletions
|
@ -17,7 +17,6 @@ client.workspace = true
|
|||
collections.workspace = true
|
||||
db.workspace = true
|
||||
editor.workspace = true
|
||||
extension.workspace = true
|
||||
extension_host.workspace = true
|
||||
feature_flags.workspace = true
|
||||
fs.workspace = true
|
||||
|
|
|
@ -9,7 +9,6 @@ use std::{ops::Range, sync::Arc};
|
|||
use client::{ExtensionMetadata, ExtensionProvides};
|
||||
use collections::{BTreeMap, BTreeSet};
|
||||
use editor::{Editor, EditorElement, EditorStyle};
|
||||
use extension::ExtensionEvents;
|
||||
use extension_host::{ExtensionManifest, ExtensionOperation, ExtensionStore};
|
||||
use feature_flags::FeatureFlagAppExt as _;
|
||||
use fuzzy::{match_strings, StringMatchCandidate};
|
||||
|
@ -213,7 +212,7 @@ pub struct ExtensionsPage {
|
|||
query_editor: Entity<Editor>,
|
||||
query_contains_error: bool,
|
||||
provides_filter: Option<ExtensionProvides>,
|
||||
_subscriptions: Vec<gpui::Subscription>,
|
||||
_subscriptions: [gpui::Subscription; 2],
|
||||
extension_fetch_task: Option<Task<()>>,
|
||||
upsells: BTreeSet<Feature>,
|
||||
}
|
||||
|
@ -227,12 +226,15 @@ impl ExtensionsPage {
|
|||
cx.new(|cx| {
|
||||
let store = ExtensionStore::global(cx);
|
||||
let workspace_handle = workspace.weak_handle();
|
||||
let subscriptions = vec![
|
||||
let subscriptions = [
|
||||
cx.observe(&store, |_: &mut Self, _, cx| cx.notify()),
|
||||
cx.subscribe_in(
|
||||
&store,
|
||||
window,
|
||||
move |this, _, event, window, cx| match event {
|
||||
extension_host::Event::ExtensionsUpdated => {
|
||||
this.fetch_extensions_debounced(cx)
|
||||
}
|
||||
extension_host::Event::ExtensionInstalled(extension_id) => this
|
||||
.on_extension_installed(
|
||||
workspace_handle.clone(),
|
||||
|
@ -243,15 +245,6 @@ impl ExtensionsPage {
|
|||
_ => {}
|
||||
},
|
||||
),
|
||||
cx.subscribe_in(
|
||||
&ExtensionEvents::global(cx),
|
||||
window,
|
||||
move |this, _, event, _window, cx| match event {
|
||||
extension::Event::ExtensionsUpdated => {
|
||||
this.fetch_extensions_debounced(cx);
|
||||
}
|
||||
},
|
||||
),
|
||||
];
|
||||
|
||||
let query_editor = cx.new(|cx| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue