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
|
@ -1,4 +1,4 @@
|
|||
use gpui::{App, AppContext as _, Context, Entity, EventEmitter, Global, ReadGlobal as _};
|
||||
use gpui::{App, AppContext as _, Context, Entity, EventEmitter, Global};
|
||||
|
||||
pub fn init(cx: &mut App) {
|
||||
let extension_events = cx.new(ExtensionEvents::new);
|
||||
|
@ -14,8 +14,10 @@ pub struct ExtensionEvents;
|
|||
|
||||
impl ExtensionEvents {
|
||||
/// Returns the global [`ExtensionEvents`].
|
||||
pub fn global(cx: &App) -> Entity<Self> {
|
||||
GlobalExtensionEvents::global(cx).0.clone()
|
||||
pub fn try_global(cx: &App) -> Option<Entity<Self>> {
|
||||
return cx
|
||||
.try_global::<GlobalExtensionEvents>()
|
||||
.map(|g| g.0.clone());
|
||||
}
|
||||
|
||||
fn new(_cx: &mut Context<Self>) -> Self {
|
||||
|
@ -29,7 +31,7 @@ impl ExtensionEvents {
|
|||
|
||||
#[derive(Clone)]
|
||||
pub enum Event {
|
||||
ExtensionsUpdated,
|
||||
ExtensionsInstalledChanged,
|
||||
}
|
||||
|
||||
impl EventEmitter<Event> for ExtensionEvents {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue