mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 03:14:56 +07:00
Fix remote server crash with JSON files (#38678)
Closes #38594 Release Notes: - N/A
This commit is contained in:
parent
e9fbcf5abf
commit
5e502a32fb
2 changed files with 15 additions and 6 deletions
|
|
@ -157,12 +157,16 @@ impl JsonLspAdapter {
|
|||
) -> Value {
|
||||
let keymap_schema = KeymapFile::generate_json_schema_for_registered_actions(cx);
|
||||
let font_names = &cx.text_system().all_font_names();
|
||||
let theme_names = &ThemeRegistry::global(cx).list_names();
|
||||
let icon_theme_names = &ThemeRegistry::global(cx)
|
||||
.list_icon_themes()
|
||||
.into_iter()
|
||||
.map(|icon_theme| icon_theme.name)
|
||||
.collect::<Vec<SharedString>>();
|
||||
let themes = ThemeRegistry::try_global(cx);
|
||||
let theme_names = &themes.clone().map(|t| t.list_names()).unwrap_or_default();
|
||||
let icon_theme_names = &themes
|
||||
.map(|t| {
|
||||
t.list_icon_themes()
|
||||
.into_iter()
|
||||
.map(|icon_theme| icon_theme.name)
|
||||
.collect::<Vec<SharedString>>()
|
||||
})
|
||||
.unwrap_or_default();
|
||||
let settings_schema = cx
|
||||
.global::<SettingsStore>()
|
||||
.json_schema(&SettingsJsonSchemaParams {
|
||||
|
|
|
|||
|
|
@ -73,6 +73,11 @@ impl ThemeRegistry {
|
|||
cx.default_global::<GlobalThemeRegistry>().0.clone()
|
||||
}
|
||||
|
||||
/// Returns the global [`ThemeRegistry`] if it exists.
|
||||
pub fn try_global(cx: &mut App) -> Option<Arc<Self>> {
|
||||
cx.try_global::<GlobalThemeRegistry>().map(|t| t.0.clone())
|
||||
}
|
||||
|
||||
/// Sets the global [`ThemeRegistry`].
|
||||
pub(crate) fn set_global(assets: Box<dyn AssetSource>, cx: &mut App) {
|
||||
cx.set_global(GlobalThemeRegistry(Arc::new(ThemeRegistry::new(assets))));
|
||||
|
|
|
|||
Loading…
Reference in a new issue