From 4aac5642c13faabf2a2d6bd765ff95fbf55259ab Mon Sep 17 00:00:00 2001 From: Ben Kunkle Date: Fri, 26 Sep 2025 10:41:26 -0500 Subject: [PATCH] JSON Schema URIs (#38916) Closes #ISSUE Improves the efficiency of our interactions with the Zed language server. Previously, on startup and after every workspace configuration changed notification, we would send >1MB of JSON Schemas to the JSON LSP. The only reason this had to happen was due to the case where an extension was installed that would result in a change to the JSON schema for settings (i.e. added language, theme, etc). This PR changes the behavior to use the URI LSP extensions of `vscode-json-language-server` in order to send the server URI's that it can then use to fetch the schemas as needed (i.e. the settings schema is only generated and sent when `settings.json` is opened. This brings the JSON we send to on startup and after every workspace configuration changed notification down to a couple of KB. Additionally, using another LSP extension request we can notify the server when a schema has changed using the URI as a key, so we no longer have to send a workspace configuration changed notification, and the schema contents will only be re-requested and regenerated if the schema is in use. Release Notes: - Improved the efficiency of communication with the builtin JSON LSP. JSON Schemas are no longer sent to the JSON language server in their full form. If you wish to view a builtin JSON schema in the language server info tab of the language server logs (`dev: open language server logs`), you must now use the `editor: open url` action with your cursor over the URL that is sent to the server. - Made it so that Zed urls (`zed://...`) are resolved locally when opened within the editor instead of being resolved through the OS. Users who could not previously open `zed://*` URLs in the editor can now do so by pasting the link into a buffer and using the `editor: open url` action (please open an issue if this is the case for you!). --------- Co-authored-by: Michael --- Cargo.lock | 31 +- Cargo.toml | 3 + crates/dap/src/registry.rs | 12 +- crates/editor/src/editor.rs | 18 +- crates/extension/src/extension_events.rs | 2 +- crates/json_schema_store/Cargo.toml | 41 +++ crates/json_schema_store/LICENSE-GPL | 1 + .../src/json_schema_store.rs | 299 ++++++++++++++++++ .../src}/schemas/package.json | 0 .../src}/schemas/tsconfig.json | 225 +++++++++---- crates/keymap_editor/Cargo.toml | 5 +- crates/keymap_editor/src/keymap_editor.rs | 5 +- crates/language/src/language.rs | 11 - crates/languages/Cargo.toml | 5 +- crates/languages/src/json.rs | 211 ++---------- crates/languages/src/lib.rs | 2 +- crates/project/src/lsp_store.rs | 103 ------ .../src/lsp_store/json_language_server_ext.rs | 139 ++++---- crates/remote_server/Cargo.toml | 1 + crates/remote_server/src/unix.rs | 2 + crates/settings/src/settings_store.rs | 4 +- crates/snippet_provider/Cargo.toml | 1 + crates/snippet_provider/src/format.rs | 5 +- crates/task/src/task_template.rs | 4 +- crates/zed/Cargo.toml | 1 + crates/zed/src/main.rs | 54 ++++ crates/zed/src/zed/open_listener.rs | 5 + crates/zlog/src/zlog.rs | 32 +- 28 files changed, 738 insertions(+), 484 deletions(-) create mode 100644 crates/json_schema_store/Cargo.toml create mode 120000 crates/json_schema_store/LICENSE-GPL create mode 100644 crates/json_schema_store/src/json_schema_store.rs rename crates/{languages/src/json => json_schema_store/src}/schemas/package.json (100%) rename crates/{languages/src/json => json_schema_store/src}/schemas/tsconfig.json (81%) diff --git a/Cargo.lock b/Cargo.lock index cc72d569f421cd1a97051538e75deded357e8ea2..7be9a9024000e399d08eb53350e04d8a93c68d3e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8390,6 +8390,28 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "json_schema_store" +version = "0.1.0" +dependencies = [ + "anyhow", + "dap", + "extension", + "gpui", + "language", + "paths", + "project", + "schemars 1.0.1", + "serde", + "serde_json", + "settings", + "snippet_provider", + "task", + "theme", + "util", + "workspace-hack", +] + [[package]] name = "jsonschema" version = "0.30.0" @@ -8477,6 +8499,7 @@ dependencies = [ "fuzzy", "gpui", "itertools 0.14.0", + "json_schema_store", "language", "log", "menu", @@ -8794,17 +8817,16 @@ dependencies = [ "async-trait", "chrono", "collections", - "dap", "futures 0.3.31", "gpui", "http_client", "itertools 0.14.0", + "json_schema_store", "language", "log", "lsp", "node_runtime", "parking_lot", - "paths", "pet", "pet-conda", "pet-core", @@ -8817,7 +8839,6 @@ dependencies = [ "regex", "rope", "rust-embed", - "schemars 1.0.1", "serde", "serde_json", "serde_json_lenient", @@ -8825,7 +8846,6 @@ dependencies = [ "sha2", "shlex", "smol", - "snippet_provider", "task", "tempfile", "text", @@ -13043,6 +13063,7 @@ dependencies = [ "gpui", "gpui_tokio", "http_client", + "json_schema_store", "language", "language_extension", "language_model", @@ -14810,6 +14831,7 @@ dependencies = [ "paths", "schemars 1.0.1", "serde", + "serde_json", "serde_json_lenient", "snippet", "util", @@ -20240,6 +20262,7 @@ dependencies = [ "install_cli", "itertools 0.14.0", "journal", + "json_schema_store", "keymap_editor", "language", "language_extension", diff --git a/Cargo.toml b/Cargo.toml index 60722aca42712698912cf600ccb867b97a16d8b2..8873ca5c51e8e1f88ab26e7e1df0fd8144c0de24 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -91,6 +91,7 @@ members = [ "crates/inspector_ui", "crates/install_cli", "crates/journal", + "crates/json_schema_store", "crates/keymap_editor", "crates/language", "crates/language_extension", @@ -322,6 +323,7 @@ zeta2_tools = { path = "crates/zeta2_tools" } inspector_ui = { path = "crates/inspector_ui" } install_cli = { path = "crates/install_cli" } journal = { path = "crates/journal" } +json_schema_store = { path = "crates/json_schema_store" } keymap_editor = { path = "crates/keymap_editor" } language = { path = "crates/language" } language_extension = { path = "crates/language_extension" } @@ -811,6 +813,7 @@ image_viewer = { codegen-units = 1 } edit_prediction_button = { codegen-units = 1 } install_cli = { codegen-units = 1 } journal = { codegen-units = 1 } +json_schema_store = { codegen-units = 1 } lmstudio = { codegen-units = 1 } menu = { codegen-units = 1 } notifications = { codegen-units = 1 } diff --git a/crates/dap/src/registry.rs b/crates/dap/src/registry.rs index 212fa2bc239bb5180274ae482f3d39082a16dd3f..d578b41762ec51569ec4c853777b3a8daffa9531 100644 --- a/crates/dap/src/registry.rs +++ b/crates/dap/src/registry.rs @@ -64,19 +64,19 @@ impl DapRegistry { .and_then(|adapter| adapter.adapter_language_name()) } - pub async fn adapters_schema(&self) -> task::AdapterSchemas { - let mut schemas = AdapterSchemas(vec![]); + pub fn adapters_schema(&self) -> task::AdapterSchemas { + let mut schemas = vec![]; - let adapters = self.0.read().adapters.clone(); + let adapters = &self.0.read().adapters; for (name, adapter) in adapters.into_iter() { - schemas.0.push(AdapterSchema { - adapter: name.into(), + schemas.push(AdapterSchema { + adapter: name.clone().into(), schema: adapter.dap_schema(), }); } - schemas + AdapterSchemas(schemas) } pub fn locators(&self) -> FxHashMap> { diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index b9fe990dcabf512d0505f9a7abc5a6502c5ace95..51734da461a7d6dc7601576f456a9a5f75b7d7e6 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -83,7 +83,7 @@ use aho_corasick::AhoCorasick; use anyhow::{Context as _, Result, anyhow}; use blink_manager::BlinkManager; use buffer_diff::DiffHunkStatus; -use client::{Collaborator, ParticipantIndex}; +use client::{Collaborator, ParticipantIndex, parse_zed_link}; use clock::{AGENT_REPLICA_ID, ReplicaId}; use code_context_menus::{ AvailableCodeAction, CodeActionContents, CodeActionsItem, CodeActionsMenu, CodeContextMenu, @@ -16326,7 +16326,7 @@ impl Editor { None }; - let url_finder = cx.spawn_in(window, async move |editor, cx| { + let url_finder = cx.spawn_in(window, async move |_editor, cx| { let url = if let Some(end_pos) = end_position { find_url_from_range(&buffer, start_position..end_pos, cx.clone()) } else { @@ -16334,12 +16334,16 @@ impl Editor { }; if let Some(url) = url { - editor.update(cx, |_, cx| { - cx.open_url(&url); - }) - } else { - Ok(()) + cx.update(|window, cx| { + if parse_zed_link(&url, cx).is_some() { + window.dispatch_action(Box::new(zed_actions::OpenZedUrl { url }), cx); + } else { + cx.open_url(&url); + } + })?; } + + anyhow::Ok(()) }); url_finder.detach(); diff --git a/crates/extension/src/extension_events.rs b/crates/extension/src/extension_events.rs index 94f3277b05b76aa93717458c57d0280a15b8435f..6dc99470dfb5abad524e5a7cbc326b2dd5e0bd26 100644 --- a/crates/extension/src/extension_events.rs +++ b/crates/extension/src/extension_events.rs @@ -32,7 +32,7 @@ impl ExtensionEvents { } } -#[derive(Clone)] +#[derive(Clone, Debug)] pub enum Event { ExtensionInstalled(Arc), ExtensionUninstalled(Arc), diff --git a/crates/json_schema_store/Cargo.toml b/crates/json_schema_store/Cargo.toml new file mode 100644 index 0000000000000000000000000000000000000000..05c8cbfd9d5a83011f51b6a38f0f776e535c732f --- /dev/null +++ b/crates/json_schema_store/Cargo.toml @@ -0,0 +1,41 @@ +[package] +name = "json_schema_store" +version = "0.1.0" +edition.workspace = true +publish.workspace = true +license = "GPL-3.0-or-later" + +[lints] +workspace = true + +[lib] +path = "src/json_schema_store.rs" + +[features] +default = [] + +[dependencies] +anyhow.workspace = true +dap.workspace = true +extension.workspace = true +gpui.workspace = true +language.workspace = true +paths.workspace = true +project.workspace = true +schemars.workspace = true +serde_json.workspace = true +serde.workspace = true +settings.workspace = true +snippet_provider.workspace = true +task.workspace = true +theme.workspace = true +util.workspace = true +workspace-hack.workspace = true + + + +# Uncomment other workspace dependencies as needed +# assistant.workspace = true +# client.workspace = true +# project.workspace = true +# settings.workspace = true diff --git a/crates/json_schema_store/LICENSE-GPL b/crates/json_schema_store/LICENSE-GPL new file mode 120000 index 0000000000000000000000000000000000000000..89e542f750cd3860a0598eff0dc34b56d7336dc4 --- /dev/null +++ b/crates/json_schema_store/LICENSE-GPL @@ -0,0 +1 @@ +../../LICENSE-GPL \ No newline at end of file diff --git a/crates/json_schema_store/src/json_schema_store.rs b/crates/json_schema_store/src/json_schema_store.rs new file mode 100644 index 0000000000000000000000000000000000000000..21a20418c1507ff5f2410c7b62085d439643faa6 --- /dev/null +++ b/crates/json_schema_store/src/json_schema_store.rs @@ -0,0 +1,299 @@ +//! # json_schema_store +use std::{str::FromStr, sync::Arc}; + +use anyhow::{Context as _, Result}; +use gpui::{App, AsyncApp, BorrowAppContext as _, Entity, SharedString, WeakEntity}; +use language::LanguageRegistry; +use project::LspStore; + +// Origin: https://github.com/SchemaStore/schemastore +const TSCONFIG_SCHEMA: &str = include_str!("schemas/tsconfig.json"); +const PACKAGE_JSON_SCHEMA: &str = include_str!("schemas/package.json"); + +pub fn init(cx: &mut App) { + cx.set_global(SchemaStore::default()); + project::lsp_store::json_language_server_ext::register_schema_handler( + handle_schema_request, + cx, + ); + + cx.observe_new(|_, _, cx| { + let lsp_store = cx.weak_entity(); + cx.global_mut::().lsp_stores.push(lsp_store); + }) + .detach(); + + if let Some(extension_events) = extension::ExtensionEvents::try_global(cx) { + cx.subscribe(&extension_events, |_, evt, cx| { + match evt { + extension::Event::ExtensionInstalled(_) + | extension::Event::ExtensionUninstalled(_) + | extension::Event::ConfigureExtensionRequested(_) => return, + extension::Event::ExtensionsInstalledChanged => {} + } + cx.update_global::(|schema_store, cx| { + schema_store.notify_schema_changed("zed://schemas/settings", cx); + }); + }) + .detach(); + } + + cx.observe_global::(|cx| { + cx.update_global::(|schema_store, cx| { + schema_store.notify_schema_changed("zed://schemas/debug_tasks", cx); + }); + }) + .detach(); +} + +#[derive(Default)] +pub struct SchemaStore { + lsp_stores: Vec>, +} + +impl gpui::Global for SchemaStore {} + +impl SchemaStore { + fn notify_schema_changed(&mut self, uri: &str, cx: &mut App) { + let uri = uri.to_string(); + self.lsp_stores.retain(|lsp_store| { + let Some(lsp_store) = lsp_store.upgrade() else { + return false; + }; + project::lsp_store::json_language_server_ext::notify_schema_changed( + lsp_store, &uri, cx, + ); + true + }) + } +} + +fn handle_schema_request( + lsp_store: Entity, + uri: String, + cx: &mut AsyncApp, +) -> Result { + let languages = lsp_store.read_with(cx, |lsp_store, _| lsp_store.languages.clone())?; + let schema = resolve_schema_request(&languages, uri, cx)?; + serde_json::to_string(&schema).context("Failed to serialize schema") +} + +pub fn resolve_schema_request( + languages: &Arc, + uri: String, + cx: &mut AsyncApp, +) -> Result { + let path = uri.strip_prefix("zed://schemas/").context("Invalid URI")?; + resolve_schema_request_inner(languages, path, cx) +} + +pub fn resolve_schema_request_inner( + languages: &Arc, + path: &str, + cx: &mut AsyncApp, +) -> Result { + let (schema_name, rest) = path.split_once('/').unzip(); + let schema_name = schema_name.unwrap_or(path); + + let schema = match schema_name { + "settings" => cx.update(|cx| { + let font_names = &cx.text_system().all_font_names(); + let language_names = &languages + .language_names() + .into_iter() + .map(|name| name.to_string()) + .collect::>(); + let icon_theme_names = &theme::ThemeRegistry::global(cx) + .list_icon_themes() + .into_iter() + .map(|icon_theme| icon_theme.name) + .collect::>(); + let theme_names = &theme::ThemeRegistry::global(cx).list_names(); + cx.global::().json_schema( + &settings::SettingsJsonSchemaParams { + language_names, + font_names, + theme_names, + icon_theme_names, + }, + ) + })?, + "keymap" => cx.update(settings::KeymapFile::generate_json_schema_for_registered_actions)?, + "action" => { + let normalized_action_name = rest.context("No Action name provided")?; + let action_name = denormalize_action_name(normalized_action_name); + let mut generator = settings::KeymapFile::action_schema_generator(); + let schema = cx + // PERF: cx.action_schema_by_name(action_name, &mut generator) + .update(|cx| cx.action_schemas(&mut generator))? + .into_iter() + .find_map(|(name, schema)| (name == action_name).then_some(schema)) + .flatten(); + root_schema_from_action_schema(schema, &mut generator).to_value() + } + "tasks" => task::TaskTemplates::generate_json_schema(), + "debug_tasks" => { + let adapter_schemas = cx.read_global::(|dap_registry, _| { + dap_registry.adapters_schema() + })?; + task::DebugTaskFile::generate_json_schema(&adapter_schemas) + } + "package_json" => package_json_schema(), + "tsconfig" => tsconfig_schema(), + "zed_inspector_style" => { + if cfg!(debug_assertions) { + generate_inspector_style_schema() + } else { + schemars::json_schema!(true).to_value() + } + } + "snippets" => snippet_provider::format::VsSnippetsFile::generate_json_schema(), + _ => { + anyhow::bail!("Unrecognized builtin JSON schema: {}", schema_name); + } + }; + Ok(schema) +} + +pub fn all_schema_file_associations(cx: &mut App) -> serde_json::Value { + let mut file_associations = serde_json::json!([ + { + "fileMatch": [ + schema_file_match(paths::settings_file()), + paths::local_settings_file_relative_path() + ], + "url": "zed://schemas/settings", + }, + { + "fileMatch": [schema_file_match(paths::keymap_file())], + "url": "zed://schemas/keymap", + }, + { + "fileMatch": [ + schema_file_match(paths::tasks_file()), + paths::local_tasks_file_relative_path() + ], + "url": "zed://schemas/tasks", + }, + { + "fileMatch": [ + schema_file_match(paths::debug_scenarios_file()), + paths::local_debug_file_relative_path() + ], + "url": "zed://schemas/debug_tasks", + }, + { + "fileMatch": [ + schema_file_match( + paths::snippets_dir() + .join("*.json") + .as_path() + ) + ], + "url": "zed://schemas/snippets", + }, + { + "fileMatch": ["tsconfig.json"], + "url": "zed://schemas/tsconfig" + }, + { + "fileMatch": ["package.json"], + "url": "zed://schemas/package_json" + }, + ]); + + #[cfg(debug_assertions)] + { + file_associations + .as_array_mut() + .unwrap() + .push(serde_json::json!({ + "fileMatch": [ + "zed-inspector-style.json" + ], + "url": "zed://schemas/zed_inspector_style" + })); + } + + file_associations.as_array_mut().unwrap().extend( + // ?PERF: use all_action_schemas() and don't include action schemas with no arguments + cx.all_action_names().into_iter().map(|&name| { + let normalized_name = normalize_action_name(name); + let file_name = normalized_action_name_to_file_name(normalized_name.clone()); + serde_json::json!({ + "fileMatch": [file_name], + "url": format!("zed://schemas/action/{}", normalized_name) + }) + }), + ); + + file_associations +} + +fn tsconfig_schema() -> serde_json::Value { + serde_json::Value::from_str(TSCONFIG_SCHEMA).unwrap() +} + +fn package_json_schema() -> serde_json::Value { + serde_json::Value::from_str(PACKAGE_JSON_SCHEMA).unwrap() +} + +fn generate_inspector_style_schema() -> serde_json::Value { + let schema = schemars::generate::SchemaSettings::draft2019_09() + .with_transform(util::schemars::DefaultDenyUnknownFields) + .into_generator() + .root_schema_for::(); + + serde_json::to_value(schema).unwrap() +} + +pub fn normalize_action_name(action_name: &str) -> String { + action_name.replace("::", "__") +} + +pub fn denormalize_action_name(action_name: &str) -> String { + action_name.replace("__", "::") +} + +pub fn normalized_action_file_name(action_name: &str) -> String { + normalized_action_name_to_file_name(normalize_action_name(action_name)) +} + +pub fn normalized_action_name_to_file_name(mut normalized_action_name: String) -> String { + normalized_action_name.push_str(".json"); + normalized_action_name +} + +fn root_schema_from_action_schema( + action_schema: Option, + generator: &mut schemars::SchemaGenerator, +) -> schemars::Schema { + let Some(mut action_schema) = action_schema else { + return schemars::json_schema!(false); + }; + let meta_schema = generator + .settings() + .meta_schema + .as_ref() + .expect("meta_schema should be present in schemars settings") + .to_string(); + let defs = generator.definitions(); + let mut schema = schemars::json_schema!({ + "$schema": meta_schema, + "allowTrailingCommas": true, + "$defs": defs, + }); + schema + .ensure_object() + .extend(std::mem::take(action_schema.ensure_object())); + schema +} + +#[inline] +fn schema_file_match(path: &std::path::Path) -> String { + path.strip_prefix(path.parent().unwrap().parent().unwrap()) + .unwrap() + .display() + .to_string() + .replace('\\', "/") +} diff --git a/crates/languages/src/json/schemas/package.json b/crates/json_schema_store/src/schemas/package.json similarity index 100% rename from crates/languages/src/json/schemas/package.json rename to crates/json_schema_store/src/schemas/package.json diff --git a/crates/languages/src/json/schemas/tsconfig.json b/crates/json_schema_store/src/schemas/tsconfig.json similarity index 81% rename from crates/languages/src/json/schemas/tsconfig.json rename to crates/json_schema_store/src/schemas/tsconfig.json index e734062d65b1f330495e96ea55c2e28388e5bcc8..4b9088725401e27dfc24c14d7c58acfae4355631 100644 --- a/crates/languages/src/json/schemas/tsconfig.json +++ b/crates/json_schema_store/src/schemas/tsconfig.json @@ -1,6 +1,5 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "$comment": "Note that this schema uses 'null' in various places. The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058)", "allowTrailingCommas": true, "allOf": [ { @@ -50,6 +49,7 @@ "filesDefinition": { "properties": { "files": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "If no 'files' or 'include' property is present in a tsconfig.json, the compiler defaults to including all files in the containing directory and subdirectories except those specified by 'exclude'. When a 'files' property is specified, only those files and those specified by 'include' are included.", "type": ["array", "null"], "uniqueItems": true, @@ -62,6 +62,7 @@ "excludeDefinition": { "properties": { "exclude": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specifies a list of files to be excluded from compilation. The 'exclude' property only affects the files included via the 'include' property and not the 'files' property. Glob patterns require TypeScript version 2.0 or later.", "type": ["array", "null"], "uniqueItems": true, @@ -74,6 +75,7 @@ "includeDefinition": { "properties": { "include": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specifies a list of glob patterns that match files to be included in compilation. If no 'files' or 'include' property is present in a tsconfig.json, the compiler defaults to including all files in the containing directory and subdirectories except those specified by 'exclude'. Requires TypeScript version 2.0 or later.", "type": ["array", "null"], "uniqueItems": true, @@ -116,35 +118,41 @@ "buildOptions": { "properties": { "dry": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "~", "type": ["boolean", "null"], "default": false }, "force": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Build all projects, including those that appear to be up to date", "type": ["boolean", "null"], "default": false, "markdownDescription": "Build all projects, including those that appear to be up to date\n\nSee more: https://www.typescriptlang.org/tsconfig#force" }, "verbose": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Enable verbose logging", "type": ["boolean", "null"], "default": false, "markdownDescription": "Enable verbose logging\n\nSee more: https://www.typescriptlang.org/tsconfig#verbose" }, "incremental": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Save .tsbuildinfo files to allow for incremental compilation of projects.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Save .tsbuildinfo files to allow for incremental compilation of projects.\n\nSee more: https://www.typescriptlang.org/tsconfig#incremental" }, "assumeChangesOnlyAffectDirectDependencies": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Have recompiles in projects that use `incremental` and `watch` mode assume that changes within a file will only affect files directly depending on it.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Have recompiles in projects that use `incremental` and `watch` mode assume that changes within a file will only affect files directly depending on it.\n\nSee more: https://www.typescriptlang.org/tsconfig#assumeChangesOnlyAffectDirectDependencies" }, "traceResolution": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Log paths used during the `moduleResolution` process.", "type": ["boolean", "null"], "default": false, @@ -157,6 +165,7 @@ "watchOptionsDefinition": { "properties": { "watchOptions": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "type": ["object", "null"], "description": "Settings for the watch mode in TypeScript.", "properties": { @@ -165,26 +174,31 @@ "type": ["string", "null"] }, "watchFile": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify how the TypeScript watch mode works.", "type": ["string", "null"], "markdownDescription": "Specify how the TypeScript watch mode works.\n\nSee more: https://www.typescriptlang.org/tsconfig#watchFile" }, "watchDirectory": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify how directories are watched on systems that lack recursive file-watching functionality.", "type": ["string", "null"], "markdownDescription": "Specify how directories are watched on systems that lack recursive file-watching functionality.\n\nSee more: https://www.typescriptlang.org/tsconfig#watchDirectory" }, "fallbackPolling": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify what approach the watcher should use if the system runs out of native file watchers.", "type": ["string", "null"], "markdownDescription": "Specify what approach the watcher should use if the system runs out of native file watchers.\n\nSee more: https://www.typescriptlang.org/tsconfig#fallbackPolling" }, "synchronousWatchDirectory": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Synchronously call callbacks and update the state of directory watchers on platforms that don`t support recursive watching natively.", "type": ["boolean", "null"], "markdownDescription": "Synchronously call callbacks and update the state of directory watchers on platforms that don`t support recursive watching natively.\n\nSee more: https://www.typescriptlang.org/tsconfig#synchronousWatchDirectory" }, "excludeFiles": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Remove a list of files from the watch mode's processing.", "type": ["array", "null"], "uniqueItems": true, @@ -194,6 +208,7 @@ "markdownDescription": "Remove a list of files from the watch mode's processing.\n\nSee more: https://www.typescriptlang.org/tsconfig#excludeFiles" }, "excludeDirectories": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Remove a list of directories from the watch process.", "type": ["array", "null"], "uniqueItems": true, @@ -209,31 +224,37 @@ "compilerOptionsDefinition": { "properties": { "compilerOptions": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "type": ["object", "null"], "description": "Instructs the TypeScript compiler how to compile .ts files.", "properties": { "allowArbitraryExtensions": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Enable importing files with any extension, provided a declaration file is present.", "type": ["boolean", "null"], "markdownDescription": "Enable importing files with any extension, provided a declaration file is present.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowArbitraryExtensions" }, "allowImportingTsExtensions": { - "description": "Allow imports to include TypeScript file extensions. Requires either '--noEmit' or '--emitDeclarationOnly' to be set.", + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", + "description": "Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set.", "type": ["boolean", "null"], - "markdownDescription": "Allow imports to include TypeScript file extensions. Requires either '--noEmit' or '--emitDeclarationOnly' to be set.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowImportingTsExtensions" + "markdownDescription": "Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowImportingTsExtensions" }, "charset": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "No longer supported. In early versions, manually set the text encoding for reading files.", "type": ["string", "null"], "markdownDescription": "No longer supported. In early versions, manually set the text encoding for reading files.\n\nSee more: https://www.typescriptlang.org/tsconfig#charset" }, "composite": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Enable constraints that allow a TypeScript project to be used with project references.", "type": ["boolean", "null"], "default": true, "markdownDescription": "Enable constraints that allow a TypeScript project to be used with project references.\n\nSee more: https://www.typescriptlang.org/tsconfig#composite" }, "customConditions": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Conditions to set in addition to the resolver-specific defaults when resolving imports.", "type": ["array", "null"], "uniqueItems": true, @@ -243,50 +264,52 @@ "markdownDescription": "Conditions to set in addition to the resolver-specific defaults when resolving imports.\n\nSee more: https://www.typescriptlang.org/tsconfig#customConditions" }, "declaration": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Generate .d.ts files from TypeScript and JavaScript files in your project.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Generate .d.ts files from TypeScript and JavaScript files in your project.\n\nSee more: https://www.typescriptlang.org/tsconfig#declaration" }, "declarationDir": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify the output directory for generated declaration files.", "type": ["string", "null"], "markdownDescription": "Specify the output directory for generated declaration files.\n\nSee more: https://www.typescriptlang.org/tsconfig#declarationDir" }, "diagnostics": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Output compiler performance information after building.", "type": ["boolean", "null"], "markdownDescription": "Output compiler performance information after building.\n\nSee more: https://www.typescriptlang.org/tsconfig#diagnostics" }, "disableReferencedProjectLoad": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Reduce the number of projects loaded automatically by TypeScript.", "type": ["boolean", "null"], "markdownDescription": "Reduce the number of projects loaded automatically by TypeScript.\n\nSee more: https://www.typescriptlang.org/tsconfig#disableReferencedProjectLoad" }, "noPropertyAccessFromIndexSignature": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Enforces using indexed accessors for keys declared using an indexed type", "type": ["boolean", "null"], "markdownDescription": "Enforces using indexed accessors for keys declared using an indexed type\n\nSee more: https://www.typescriptlang.org/tsconfig#noPropertyAccessFromIndexSignature" }, "emitBOM": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.\n\nSee more: https://www.typescriptlang.org/tsconfig#emitBOM" }, "emitDeclarationOnly": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Only output d.ts files and not JavaScript files.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Only output d.ts files and not JavaScript files.\n\nSee more: https://www.typescriptlang.org/tsconfig#emitDeclarationOnly" }, - "erasableSyntaxOnly": { - "description": "Do not allow runtime constructs that are not part of ECMAScript.", - "type": ["boolean", "null"], - "default": false, - "markdownDescription": "Do not allow runtime constructs that are not part of ECMAScript.\n\nSee more: https://www.typescriptlang.org/tsconfig#erasableSyntaxOnly" - }, "exactOptionalPropertyTypes": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Differentiate between undefined and not present when type checking", "type": ["boolean", "null"], "default": false, @@ -297,18 +320,21 @@ "type": ["boolean", "null"] }, "tsBuildInfoFile": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify the folder for .tsbuildinfo incremental compilation files.", "default": ".tsbuildinfo", "type": ["string", "null"], "markdownDescription": "Specify the folder for .tsbuildinfo incremental compilation files.\n\nSee more: https://www.typescriptlang.org/tsconfig#tsBuildInfoFile" }, "inlineSourceMap": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Include sourcemap files inside the emitted JavaScript.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Include sourcemap files inside the emitted JavaScript.\n\nSee more: https://www.typescriptlang.org/tsconfig#inlineSourceMap" }, "inlineSources": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Include source code in the sourcemaps inside the emitted JavaScript.", "type": ["boolean", "null"], "default": false, @@ -325,70 +351,76 @@ ] }, "reactNamespace": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit.", "type": ["string", "null"], "default": "React", "markdownDescription": "Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit.\n\nSee more: https://www.typescriptlang.org/tsconfig#reactNamespace" }, "jsxFactory": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'", "type": ["string", "null"], "default": "React.createElement", "markdownDescription": "Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'\n\nSee more: https://www.typescriptlang.org/tsconfig#jsxFactory" }, "jsxFragmentFactory": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'.", "type": ["string", "null"], "default": "React.Fragment", "markdownDescription": "Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'.\n\nSee more: https://www.typescriptlang.org/tsconfig#jsxFragmentFactory" }, "jsxImportSource": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx`.", "type": ["string", "null"], "default": "react", "markdownDescription": "Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx`.\n\nSee more: https://www.typescriptlang.org/tsconfig#jsxImportSource" }, "listFiles": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Print all of the files read during the compilation.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Print all of the files read during the compilation.\n\nSee more: https://www.typescriptlang.org/tsconfig#listFiles" }, "mapRoot": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify the location where debugger should locate map files instead of generated locations.", "type": ["string", "null"], "markdownDescription": "Specify the location where debugger should locate map files instead of generated locations.\n\nSee more: https://www.typescriptlang.org/tsconfig#mapRoot" }, "module": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify what module code is generated.", "type": ["string", "null"], "anyOf": [ { "enum": [ - "commonjs", - "amd", - "system", - "umd", - "es6", - "es2015", - "es2020", - "esnext", - "none", - "es2022", - "node16", - "node18", - "node20", - "nodenext", - "preserve" + "CommonJS", + "AMD", + "System", + "UMD", + "ES6", + "ES2015", + "ES2020", + "ESNext", + "None", + "ES2022", + "Node16", + "NodeNext", + "Preserve" ] }, { - "pattern": "^([Cc][Oo][Mm][Mm][Oo][Nn][Jj][Ss]|[AaUu][Mm][Dd]|[Ss][Yy][Ss][Tt][Ee][Mm]|[Ee][Ss]([356]|20(1[567]|2[02])|[Nn][Ee][Xx][Tt])|[Nn][Oo][dD][Ee]1[68]|[Nn][Oo][Dd][Ee][Nn][Ee][Xx][Tt]|[Nn][Oo][Nn][Ee]|[Pp][Rr][Ee][Ss][Ee][Rr][Vv][Ee])$" + "pattern": "^([Cc][Oo][Mm][Mm][Oo][Nn][Jj][Ss]|[AaUu][Mm][Dd]|[Ss][Yy][Ss][Tt][Ee][Mm]|[Ee][Ss]([356]|20(1[567]|2[02])|[Nn][Ee][Xx][Tt])|[Nn][Oo][dD][Ee]16|[Nn][Oo][Dd][Ee][Nn][Ee][Xx][Tt]|[Nn][Oo][Nn][Ee]|[Pp][Rr][Ee][Ss][Ee][Rr][Vv][Ee])$" } ], "markdownDescription": "Specify what module code is generated.\n\nSee more: https://www.typescriptlang.org/tsconfig#module" }, "moduleResolution": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify how TypeScript looks up a file from a given module specifier.", "type": ["string", "null"], "anyOf": [ @@ -417,6 +449,7 @@ "markdownDescription": "Specify how TypeScript looks up a file from a given module specifier.\n\nSee more: https://www.typescriptlang.org/tsconfig#moduleResolution" }, "newLine": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Set the newline character for emitting files.", "type": ["string", "null"], "default": "lf", @@ -431,191 +464,208 @@ "markdownDescription": "Set the newline character for emitting files.\n\nSee more: https://www.typescriptlang.org/tsconfig#newLine" }, "noEmit": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Disable emitting file from a compilation.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Disable emitting file from a compilation.\n\nSee more: https://www.typescriptlang.org/tsconfig#noEmit" }, "noEmitHelpers": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Disable generating custom helper functions like `__extends` in compiled output.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Disable generating custom helper functions like `__extends` in compiled output.\n\nSee more: https://www.typescriptlang.org/tsconfig#noEmitHelpers" }, "noEmitOnError": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Disable emitting files if any type checking errors are reported.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Disable emitting files if any type checking errors are reported.\n\nSee more: https://www.typescriptlang.org/tsconfig#noEmitOnError" }, "noImplicitAny": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Enable error reporting for expressions and declarations with an implied `any` type..", "type": ["boolean", "null"], "markdownDescription": "Enable error reporting for expressions and declarations with an implied `any` type..\n\nSee more: https://www.typescriptlang.org/tsconfig#noImplicitAny" }, "noImplicitThis": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Enable error reporting when `this` is given the type `any`.", "type": ["boolean", "null"], "markdownDescription": "Enable error reporting when `this` is given the type `any`.\n\nSee more: https://www.typescriptlang.org/tsconfig#noImplicitThis" }, "noUnusedLocals": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Enable error reporting when a local variable isn't read.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Enable error reporting when a local variable isn't read.\n\nSee more: https://www.typescriptlang.org/tsconfig#noUnusedLocals" }, "noUnusedParameters": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Raise an error when a function parameter isn't read", "type": ["boolean", "null"], "default": false, "markdownDescription": "Raise an error when a function parameter isn't read\n\nSee more: https://www.typescriptlang.org/tsconfig#noUnusedParameters" }, "noLib": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Disable including any library files, including the default lib.d.ts.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Disable including any library files, including the default lib.d.ts.\n\nSee more: https://www.typescriptlang.org/tsconfig#noLib" }, "noResolve": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project.\n\nSee more: https://www.typescriptlang.org/tsconfig#noResolve" }, "noStrictGenericChecks": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Disable strict checking of generic signatures in function types.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Disable strict checking of generic signatures in function types.\n\nSee more: https://www.typescriptlang.org/tsconfig#noStrictGenericChecks" }, - "out": { - "description": "DEPRECATED. Specify an output for the build. It is recommended to use `outFile` instead.", - "type": ["string", "null"], - "markdownDescription": "Specify an output for the build. It is recommended to use `outFile` instead.\n\nSee more: https://www.typescriptlang.org/tsconfig/#out" - }, "skipDefaultLibCheck": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Skip type checking .d.ts files that are included with TypeScript.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Skip type checking .d.ts files that are included with TypeScript.\n\nSee more: https://www.typescriptlang.org/tsconfig#skipDefaultLibCheck" }, "skipLibCheck": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Skip type checking all .d.ts files.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Skip type checking all .d.ts files.\n\nSee more: https://www.typescriptlang.org/tsconfig#skipLibCheck" }, "outFile": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output.", "type": ["string", "null"], "markdownDescription": "Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output.\n\nSee more: https://www.typescriptlang.org/tsconfig#outFile" }, "outDir": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify an output folder for all emitted files.", "type": ["string", "null"], "markdownDescription": "Specify an output folder for all emitted files.\n\nSee more: https://www.typescriptlang.org/tsconfig#outDir" }, "preserveConstEnums": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Disable erasing `const enum` declarations in generated code.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Disable erasing `const enum` declarations in generated code.\n\nSee more: https://www.typescriptlang.org/tsconfig#preserveConstEnums" }, "preserveSymlinks": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Disable resolving symlinks to their realpath. This correlates to the same flag in node.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Disable resolving symlinks to their realpath. This correlates to the same flag in node.\n\nSee more: https://www.typescriptlang.org/tsconfig#preserveSymlinks" }, "preserveValueImports": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Preserve unused imported values in the JavaScript output that would otherwise be removed", "type": ["boolean", "null"], "default": false, "markdownDescription": "Preserve unused imported values in the JavaScript output that would otherwise be removed\n\nSee more: https://www.typescriptlang.org/tsconfig#preserveValueImports" }, "preserveWatchOutput": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Disable wiping the console in watch mode", "type": ["boolean", "null"], "markdownDescription": "Disable wiping the console in watch mode\n\nSee more: https://www.typescriptlang.org/tsconfig#preserveWatchOutput" }, "pretty": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Enable color and formatting in output to make compiler errors easier to read", "type": ["boolean", "null"], "default": true, "markdownDescription": "Enable color and formatting in output to make compiler errors easier to read\n\nSee more: https://www.typescriptlang.org/tsconfig#pretty" }, "removeComments": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Disable emitting comments.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Disable emitting comments.\n\nSee more: https://www.typescriptlang.org/tsconfig#removeComments" }, - "rewriteRelativeImportExtensions": { - "description": "Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files.", - "type": ["boolean", "null"], - "default": false, - "markdownDescription": "Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files.\n\nSee more: https://www.typescriptlang.org/tsconfig#rewriteRelativeImportExtensions" - }, "rootDir": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify the root folder within your source files.", "type": ["string", "null"], "markdownDescription": "Specify the root folder within your source files.\n\nSee more: https://www.typescriptlang.org/tsconfig#rootDir" }, "isolatedModules": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Ensure that each file can be safely transpiled without relying on other imports.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Ensure that each file can be safely transpiled without relying on other imports.\n\nSee more: https://www.typescriptlang.org/tsconfig#isolatedModules" }, "sourceMap": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Create source map files for emitted JavaScript files.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Create source map files for emitted JavaScript files.\n\nSee more: https://www.typescriptlang.org/tsconfig#sourceMap" }, "sourceRoot": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify the root path for debuggers to find the reference source code.", "type": ["string", "null"], "markdownDescription": "Specify the root path for debuggers to find the reference source code.\n\nSee more: https://www.typescriptlang.org/tsconfig#sourceRoot" }, "suppressExcessPropertyErrors": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Disable reporting of excess property errors during the creation of object literals.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Disable reporting of excess property errors during the creation of object literals.\n\nSee more: https://www.typescriptlang.org/tsconfig#suppressExcessPropertyErrors" }, "suppressImplicitAnyIndexErrors": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Suppress `noImplicitAny` errors when indexing objects that lack index signatures.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Suppress `noImplicitAny` errors when indexing objects that lack index signatures.\n\nSee more: https://www.typescriptlang.org/tsconfig#suppressImplicitAnyIndexErrors" }, "stripInternal": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Disable emitting declarations that have `@internal` in their JSDoc comments.", "type": ["boolean", "null"], "markdownDescription": "Disable emitting declarations that have `@internal` in their JSDoc comments.\n\nSee more: https://www.typescriptlang.org/tsconfig#stripInternal" }, "target": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Set the JavaScript language version for emitted JavaScript and include compatible library declarations.", "type": ["string", "null"], - "default": "es3", + "default": "ES3", "anyOf": [ { "enum": [ - "es3", - "es5", - "es6", - "es2015", - "es2016", - "es2017", - "es2018", - "es2019", - "es2020", - "es2021", - "es2022", - "es2023", - "es2024", - "esnext" + "ES3", + "ES5", + "ES6", + "ES2015", + "ES2016", + "ES2017", + "ES2018", + "ES2019", + "ES2020", + "ES2021", + "ES2022", + "ES2023", + "ES2024", + "ESNext" ] }, { @@ -625,6 +675,7 @@ "markdownDescription": "Set the JavaScript language version for emitted JavaScript and include compatible library declarations.\n\nSee more: https://www.typescriptlang.org/tsconfig#target" }, "useUnknownInCatchVariables": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Default catch clause variables as `unknown` instead of `any`.", "type": ["boolean", "null"], "default": false, @@ -669,72 +720,86 @@ "default": "useFsEvents" }, "experimentalDecorators": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Enable experimental support for TC39 stage 2 draft decorators.", "type": ["boolean", "null"], "markdownDescription": "Enable experimental support for TC39 stage 2 draft decorators.\n\nSee more: https://www.typescriptlang.org/tsconfig#experimentalDecorators" }, "emitDecoratorMetadata": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Emit design-type metadata for decorated declarations in source files.", "type": ["boolean", "null"], "markdownDescription": "Emit design-type metadata for decorated declarations in source files.\n\nSee more: https://www.typescriptlang.org/tsconfig#emitDecoratorMetadata" }, "allowUnusedLabels": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Disable error reporting for unused labels.", "type": ["boolean", "null"], "markdownDescription": "Disable error reporting for unused labels.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowUnusedLabels" }, "noImplicitReturns": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Enable error reporting for codepaths that do not explicitly return in a function.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Enable error reporting for codepaths that do not explicitly return in a function.\n\nSee more: https://www.typescriptlang.org/tsconfig#noImplicitReturns" }, "noUncheckedIndexedAccess": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Add `undefined` to a type when accessed using an index.", "type": ["boolean", "null"], "markdownDescription": "Add `undefined` to a type when accessed using an index.\n\nSee more: https://www.typescriptlang.org/tsconfig#noUncheckedIndexedAccess" }, "noFallthroughCasesInSwitch": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Enable error reporting for fallthrough cases in switch statements.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Enable error reporting for fallthrough cases in switch statements.\n\nSee more: https://www.typescriptlang.org/tsconfig#noFallthroughCasesInSwitch" }, "noImplicitOverride": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Ensure overriding members in derived classes are marked with an override modifier.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Ensure overriding members in derived classes are marked with an override modifier.\n\nSee more: https://www.typescriptlang.org/tsconfig#noImplicitOverride" }, "allowUnreachableCode": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Disable error reporting for unreachable code.", "type": ["boolean", "null"], "markdownDescription": "Disable error reporting for unreachable code.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowUnreachableCode" }, "forceConsistentCasingInFileNames": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Ensure that casing is correct in imports.", "type": ["boolean", "null"], "default": true, "markdownDescription": "Ensure that casing is correct in imports.\n\nSee more: https://www.typescriptlang.org/tsconfig#forceConsistentCasingInFileNames" }, "generateCpuProfile": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Emit a v8 CPU profile of the compiler run for debugging.", "type": ["string", "null"], "default": "profile.cpuprofile", "markdownDescription": "Emit a v8 CPU profile of the compiler run for debugging.\n\nSee more: https://www.typescriptlang.org/tsconfig#generateCpuProfile" }, "baseUrl": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify the base directory to resolve non-relative module names.", "type": ["string", "null"], "markdownDescription": "Specify the base directory to resolve non-relative module names.\n\nSee more: https://www.typescriptlang.org/tsconfig#baseUrl" }, "paths": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify a set of entries that re-map imports to additional lookup locations.", "type": ["object", "null"], "additionalProperties": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "type": ["array", "null"], "uniqueItems": true, "items": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "type": ["string", "null"], "description": "Path mapping to be computed relative to baseUrl option." } @@ -742,9 +807,11 @@ "markdownDescription": "Specify a set of entries that re-map imports to additional lookup locations.\n\nSee more: https://www.typescriptlang.org/tsconfig#paths" }, "plugins": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify a list of language service plugins to include.", "type": ["array", "null"], "items": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "type": ["object", "null"], "properties": { "name": { @@ -756,6 +823,7 @@ "markdownDescription": "Specify a list of language service plugins to include.\n\nSee more: https://www.typescriptlang.org/tsconfig#plugins" }, "rootDirs": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Allow multiple folders to be treated as one when resolving modules.", "type": ["array", "null"], "uniqueItems": true, @@ -765,6 +833,7 @@ "markdownDescription": "Allow multiple folders to be treated as one when resolving modules.\n\nSee more: https://www.typescriptlang.org/tsconfig#rootDirs" }, "typeRoots": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify multiple folders that act like `./node_modules/@types`.", "type": ["array", "null"], "uniqueItems": true, @@ -774,6 +843,7 @@ "markdownDescription": "Specify multiple folders that act like `./node_modules/@types`.\n\nSee more: https://www.typescriptlang.org/tsconfig#typeRoots" }, "types": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify type package names to be included without being referenced in a source file.", "type": ["array", "null"], "uniqueItems": true, @@ -783,50 +853,59 @@ "markdownDescription": "Specify type package names to be included without being referenced in a source file.\n\nSee more: https://www.typescriptlang.org/tsconfig#types" }, "traceResolution": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Enable tracing of the name resolution process. Requires TypeScript version 2.0 or later.", "type": ["boolean", "null"], "default": false }, "allowJs": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowJs" }, "noErrorTruncation": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Disable truncating types in error messages.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Disable truncating types in error messages.\n\nSee more: https://www.typescriptlang.org/tsconfig#noErrorTruncation" }, "allowSyntheticDefaultImports": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Allow 'import x from y' when a module doesn't have a default export.", "type": ["boolean", "null"], "markdownDescription": "Allow 'import x from y' when a module doesn't have a default export.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowSyntheticDefaultImports" }, "noImplicitUseStrict": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Disable adding 'use strict' directives in emitted JavaScript files.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Disable adding 'use strict' directives in emitted JavaScript files.\n\nSee more: https://www.typescriptlang.org/tsconfig#noImplicitUseStrict" }, "listEmittedFiles": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Print the names of emitted files after a compilation.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Print the names of emitted files after a compilation.\n\nSee more: https://www.typescriptlang.org/tsconfig#listEmittedFiles" }, "disableSizeLimit": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server.\n\nSee more: https://www.typescriptlang.org/tsconfig#disableSizeLimit" }, "lib": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify a set of bundled library declaration files that describe the target runtime environment.", "type": ["array", "null"], "uniqueItems": true, "items": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "type": ["string", "null"], "anyOf": [ { @@ -875,7 +954,6 @@ "ESNext.BigInt", "ESNext.Collection", "ESNext.Intl", - "ESNext.Iterator", "ESNext.Object", "ESNext.Promise", "ESNext.Regexp", @@ -923,9 +1001,7 @@ "ES2017.Date", "ES2023.Collection", "ESNext.Decorators", - "ESNext.Disposable", - "ESNext.Error", - "ESNext.Sharedmemory" + "ESNext.Disposable" ] }, { @@ -980,29 +1056,26 @@ }, "markdownDescription": "Specify a set of bundled library declaration files that describe the target runtime environment.\n\nSee more: https://www.typescriptlang.org/tsconfig#lib" }, - "libReplacement": { - "description": "Enable lib replacement.", - "type": ["boolean", "null"], - "default": true, - "markdownDescription": "Enable lib replacement.\n\nSee more: https://www.typescriptlang.org/tsconfig#libReplacement" - }, "moduleDetection": { "description": "Specify how TypeScript determine a file as module.", "enum": ["auto", "legacy", "force"] }, "strictNullChecks": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "When type checking, take into account `null` and `undefined`.", "type": ["boolean", "null"], "default": false, "markdownDescription": "When type checking, take into account `null` and `undefined`.\n\nSee more: https://www.typescriptlang.org/tsconfig#strictNullChecks" }, "maxNodeModuleJsDepth": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`.", "type": ["number", "null"], "default": 0, "markdownDescription": "Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`.\n\nSee more: https://www.typescriptlang.org/tsconfig#maxNodeModuleJsDepth" }, "importHelpers": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Allow importing helper functions from tslib once per project, instead of including them per-file.", "type": ["boolean", "null"], "default": false, @@ -1014,89 +1087,104 @@ "enum": ["remove", "preserve", "error"] }, "alwaysStrict": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Ensure 'use strict' is always emitted.", "type": ["boolean", "null"], "markdownDescription": "Ensure 'use strict' is always emitted.\n\nSee more: https://www.typescriptlang.org/tsconfig#alwaysStrict" }, "strict": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Enable all strict type checking options.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Enable all strict type checking options.\n\nSee more: https://www.typescriptlang.org/tsconfig#strict" }, "strictBindCallApply": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Check that the arguments for `bind`, `call`, and `apply` methods match the original function.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Check that the arguments for `bind`, `call`, and `apply` methods match the original function.\n\nSee more: https://www.typescriptlang.org/tsconfig#strictBindCallApply" }, "downlevelIteration": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Emit more compliant, but verbose and less performant JavaScript for iteration.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Emit more compliant, but verbose and less performant JavaScript for iteration.\n\nSee more: https://www.typescriptlang.org/tsconfig#downlevelIteration" }, "checkJs": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Enable error reporting in type-checked JavaScript files.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Enable error reporting in type-checked JavaScript files.\n\nSee more: https://www.typescriptlang.org/tsconfig#checkJs" }, "strictFunctionTypes": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "When assigning functions, check to ensure parameters and the return values are subtype-compatible.", "type": ["boolean", "null"], "default": false, "markdownDescription": "When assigning functions, check to ensure parameters and the return values are subtype-compatible.\n\nSee more: https://www.typescriptlang.org/tsconfig#strictFunctionTypes" }, "strictPropertyInitialization": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Check for class properties that are declared but not set in the constructor.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Check for class properties that are declared but not set in the constructor.\n\nSee more: https://www.typescriptlang.org/tsconfig#strictPropertyInitialization" }, "esModuleInterop": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility.\n\nSee more: https://www.typescriptlang.org/tsconfig#esModuleInterop" }, "allowUmdGlobalAccess": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Allow accessing UMD globals from modules.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Allow accessing UMD globals from modules.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowUmdGlobalAccess" }, "keyofStringsOnly": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Make keyof only return strings instead of string, numbers or symbols. Legacy option.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Make keyof only return strings instead of string, numbers or symbols. Legacy option.\n\nSee more: https://www.typescriptlang.org/tsconfig#keyofStringsOnly" }, "useDefineForClassFields": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Emit ECMAScript-standard-compliant class fields.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Emit ECMAScript-standard-compliant class fields.\n\nSee more: https://www.typescriptlang.org/tsconfig#useDefineForClassFields" }, "declarationMap": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Create sourcemaps for d.ts files.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Create sourcemaps for d.ts files.\n\nSee more: https://www.typescriptlang.org/tsconfig#declarationMap" }, "resolveJsonModule": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Enable importing .json files", "type": ["boolean", "null"], "default": false, "markdownDescription": "Enable importing .json files\n\nSee more: https://www.typescriptlang.org/tsconfig#resolveJsonModule" }, "resolvePackageJsonExports": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Use the package.json 'exports' field when resolving package imports.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Use the package.json 'exports' field when resolving package imports.\n\nSee more: https://www.typescriptlang.org/tsconfig#resolvePackageJsonExports" }, "resolvePackageJsonImports": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Use the package.json 'imports' field when resolving imports.", "type": ["boolean", "null"], "default": false, @@ -1107,6 +1195,7 @@ "type": ["boolean", "null"] }, "extendedDiagnostics": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Output more detailed compiler performance information after building.", "type": ["boolean", "null"], "default": false, @@ -1117,39 +1206,46 @@ "type": ["boolean", "null"] }, "disableSourceOfProjectReferenceRedirect": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Disable preferring source files instead of declaration files when referencing composite projects", "type": ["boolean", "null"], "markdownDescription": "Disable preferring source files instead of declaration files when referencing composite projects\n\nSee more: https://www.typescriptlang.org/tsconfig#disableSourceOfProjectReferenceRedirect" }, "disableSolutionSearching": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Opt a project out of multi-project reference checking when editing.", "type": ["boolean", "null"], "markdownDescription": "Opt a project out of multi-project reference checking when editing.\n\nSee more: https://www.typescriptlang.org/tsconfig#disableSolutionSearching" }, "verbatimModuleSyntax": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting.", "type": ["boolean", "null"], "markdownDescription": "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting.\n\nSee more: https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax" }, "noCheck": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Disable full type checking (only critical parse and emit errors will be reported)", "type": ["boolean", "null"], "default": false, "markdownDescription": "Disable full type checking (only critical parse and emit errors will be reported)\n\nSee more: https://www.typescriptlang.org/tsconfig#noCheck" }, "isolatedDeclarations": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Require sufficient annotation on exports so other tools can trivially generate declaration files.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Require sufficient annotation on exports so other tools can trivially generate declaration files.\n\nSee more: https://www.typescriptlang.org/tsconfig#isolatedDeclarations" }, "noUncheckedSideEffectImports": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Check side effect imports.", "type": ["boolean", "null"], "default": false, "markdownDescription": "Check side effect imports.\n\nSee more: https://www.typescriptlang.org/tsconfig#noUncheckedSideEffectImports" }, "strictBuiltinIteratorReturn": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'.", "type": ["boolean", "null"], "default": false, @@ -1162,15 +1258,18 @@ "typeAcquisitionDefinition": { "properties": { "typeAcquisition": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "type": ["object", "null"], "description": "Auto type (.d.ts) acquisition options for this project. Requires TypeScript version 2.1 or later.", "properties": { "enable": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Enable auto type acquisition", "type": ["boolean", "null"], "default": false }, "include": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specifies a list of type declarations to be included in auto type acquisition. Ex. [\"jquery\", \"lodash\"]", "type": ["array", "null"], "uniqueItems": true, @@ -1179,6 +1278,7 @@ } }, "exclude": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "description": "Specifies a list of type declarations to be excluded from auto type acquisition. Ex. [\"jquery\", \"lodash\"]", "type": ["array", "null"], "uniqueItems": true, @@ -1193,14 +1293,17 @@ "referencesDefinition": { "properties": { "references": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "type": ["array", "null"], "uniqueItems": true, "description": "Referenced projects. Requires TypeScript version 3.0 or later.", "items": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "type": ["object", "null"], "description": "Project reference.", "properties": { "path": { + "$comment": "The value of 'null' is UNDOCUMENTED (https://github.com/microsoft/TypeScript/pull/18058).", "type": ["string", "null"], "description": "Path to referenced tsconfig or to folder containing tsconfig." } diff --git a/crates/keymap_editor/Cargo.toml b/crates/keymap_editor/Cargo.toml index ae3af21239f22a8d01ec9e792a3ab0daed6080bb..ccd42dfa01a081efe940e6f309d87d61aa9472c7 100644 --- a/crates/keymap_editor/Cargo.toml +++ b/crates/keymap_editor/Cargo.toml @@ -22,6 +22,7 @@ fs.workspace = true fuzzy.workspace = true gpui.workspace = true itertools.workspace = true +json_schema_store.workspace = true language.workspace = true log.workspace = true menu.workspace = true @@ -29,16 +30,16 @@ notifications.workspace = true paths.workspace = true project.workspace = true search.workspace = true -serde.workspace = true serde_json.workspace = true +serde.workspace = true settings.workspace = true telemetry.workspace = true tempfile.workspace = true theme.workspace = true tree-sitter-json.workspace = true tree-sitter-rust.workspace = true -ui.workspace = true ui_input.workspace = true +ui.workspace = true util.workspace = true vim.workspace = true workspace-hack.workspace = true diff --git a/crates/keymap_editor/src/keymap_editor.rs b/crates/keymap_editor/src/keymap_editor.rs index 23854df2e42c888d81db7415fc15394f6529d29a..106b50d79818d497ce66015d3f9ab039d811d5cf 100644 --- a/crates/keymap_editor/src/keymap_editor.rs +++ b/crates/keymap_editor/src/keymap_editor.rs @@ -2708,10 +2708,7 @@ impl ActionArgumentsEditor { ) })?; - let file_name = - project::lsp_store::json_language_server_ext::normalized_action_file_name( - action_name, - ); + let file_name = json_schema_store::normalized_action_file_name(action_name); let (buffer, backup_temp_dir) = Self::create_temp_buffer(temp_dir, file_name.clone(), project.clone(), fs, cx) diff --git a/crates/language/src/language.rs b/crates/language/src/language.rs index daa39788ee18e41543931d06c9309f1020825b8c..b006b2785f7be2674b23849b2418ef2c77117fa0 100644 --- a/crates/language/src/language.rs +++ b/crates/language/src/language.rs @@ -463,17 +463,6 @@ pub trait LspAdapter: 'static + Send + Sync + DynLspInstaller { 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" - ); - } - /// True for the extension adapter and false otherwise. fn is_extension(&self) -> bool { false diff --git a/crates/languages/Cargo.toml b/crates/languages/Cargo.toml index efcbaa57ef88b36820150d9634eea6b27d0969cf..d707dd6977a8d15364b52ca4315823ba1a12facf 100644 --- a/crates/languages/Cargo.toml +++ b/crates/languages/Cargo.toml @@ -41,17 +41,16 @@ async-tar.workspace = true async-trait.workspace = true chrono.workspace = true collections.workspace = true -dap.workspace = true futures.workspace = true gpui.workspace = true http_client.workspace = true +json_schema_store.workspace = true itertools.workspace = true language.workspace = true log.workspace = true lsp.workspace = true node_runtime.workspace = true parking_lot.workspace = true -paths.workspace = true pet-conda.workspace = true pet-core.workspace = true pet-fs.workspace = true @@ -63,14 +62,12 @@ project.workspace = true regex.workspace = true rope.workspace = true rust-embed.workspace = true -schemars.workspace = true sha2.workspace = true serde.workspace = true serde_json.workspace = true serde_json_lenient.workspace = true settings.workspace = true smol.workspace = true -snippet_provider.workspace = true url.workspace = true task.workspace = true tempfile.workspace = true diff --git a/crates/languages/src/json.rs b/crates/languages/src/json.rs index e59a3693753965995eec27c8a8d06b988e47bc21..45fa2dd75cce051439980b40996dda9865246a99 100644 --- a/crates/languages/src/json.rs +++ b/crates/languages/src/json.rs @@ -3,23 +3,20 @@ use async_compression::futures::bufread::GzipDecoder; use async_tar::Archive; use async_trait::async_trait; use collections::HashMap; -use dap::DapRegistry; use futures::StreamExt; -use gpui::{App, AsyncApp, SharedString, Task}; +use gpui::{App, AsyncApp, Task}; use http_client::github::{GitHubLspBinaryVersion, latest_github_release}; use language::{ - ContextProvider, LanguageName, LanguageRegistry, LocalFile as _, LspAdapter, - LspAdapterDelegate, LspInstaller, Toolchain, + ContextProvider, LanguageName, LocalFile as _, LspAdapter, LspAdapterDelegate, LspInstaller, + Toolchain, }; use lsp::{LanguageServerBinary, LanguageServerName}; use node_runtime::{NodeRuntime, VersionStrategy}; use project::lsp_store::language_server_settings; use serde_json::{Value, json}; -use settings::{KeymapFile, SettingsJsonSchemaParams, SettingsStore}; use smol::{ fs::{self}, io::BufReader, - lock::RwLock, }; use std::{ env::consts, @@ -28,8 +25,7 @@ use std::{ str::FromStr, sync::Arc, }; -use task::{AdapterSchemas, TaskTemplate, TaskTemplates, VariableName}; -use theme::ThemeRegistry; +use task::{TaskTemplate, TaskTemplates, VariableName}; use util::{ ResultExt, archive::extract_zip, fs::remove_matching, maybe, merge_json_value_into, rel_path::RelPath, @@ -40,10 +36,6 @@ use crate::PackageJsonData; const SERVER_PATH: &str = "node_modules/vscode-langservers-extracted/bin/vscode-json-language-server"; -// Origin: https://github.com/SchemaStore/schemastore -const TSCONFIG_SCHEMA: &str = include_str!("json/schemas/tsconfig.json"); -const PACKAGE_JSON_SCHEMA: &str = include_str!("json/schemas/package.json"); - pub(crate) struct JsonTaskProvider; impl ContextProvider for JsonTaskProvider { @@ -138,173 +130,14 @@ fn server_binary_arguments(server_path: &Path) -> Vec { pub struct JsonLspAdapter { node: NodeRuntime, - languages: Arc, - workspace_config: RwLock>, } impl JsonLspAdapter { const PACKAGE_NAME: &str = "vscode-langservers-extracted"; - pub fn new(node: NodeRuntime, languages: Arc) -> Self { - Self { - node, - languages, - workspace_config: Default::default(), - } + pub fn new(node: NodeRuntime) -> Self { + Self { node } } - - fn get_workspace_config( - language_names: Vec, - adapter_schemas: AdapterSchemas, - cx: &mut App, - ) -> Value { - let keymap_schema = KeymapFile::generate_json_schema_for_registered_actions(cx); - let font_names = &cx.text_system().all_font_names(); - 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::>() - }) - .unwrap_or_default(); - let settings_schema = cx - .global::() - .json_schema(&SettingsJsonSchemaParams { - language_names: &language_names, - font_names, - theme_names, - icon_theme_names, - }); - - let tasks_schema = task::TaskTemplates::generate_json_schema(); - let debug_schema = task::DebugTaskFile::generate_json_schema(&adapter_schemas); - let snippets_schema = snippet_provider::format::VsSnippetsFile::generate_json_schema(); - let tsconfig_schema = serde_json::Value::from_str(TSCONFIG_SCHEMA).unwrap(); - let package_json_schema = serde_json::Value::from_str(PACKAGE_JSON_SCHEMA).unwrap(); - - #[allow(unused_mut)] - let mut schemas = serde_json::json!([ - { - "fileMatch": ["tsconfig*.json"], - "schema":tsconfig_schema - }, - { - "fileMatch": ["package.json"], - "schema":package_json_schema - }, - { - "fileMatch": [ - schema_file_match(paths::settings_file()), - paths::local_settings_file_relative_path() - ], - "schema": settings_schema, - }, - { - "fileMatch": [schema_file_match(paths::keymap_file())], - "schema": keymap_schema, - }, - { - "fileMatch": [ - schema_file_match(paths::tasks_file()), - paths::local_tasks_file_relative_path() - ], - "schema": tasks_schema, - }, - { - "fileMatch": [ - schema_file_match( - paths::snippets_dir() - .join("*.json") - .as_path() - ) - ], - "schema": snippets_schema, - }, - { - "fileMatch": [ - schema_file_match(paths::debug_scenarios_file()), - paths::local_debug_file_relative_path() - ], - "schema": debug_schema, - }, - ]); - - #[cfg(debug_assertions)] - { - schemas.as_array_mut().unwrap().push(serde_json::json!( - { - "fileMatch": [ - "zed-inspector-style.json" - ], - "schema": generate_inspector_style_schema(), - } - )) - } - - schemas - .as_array_mut() - .unwrap() - .extend(cx.all_action_names().iter().map(|&name| { - project::lsp_store::json_language_server_ext::url_schema_for_action(name) - })); - - // This can be viewed via `dev: open language server logs` -> `json-language-server` -> - // `Server Info` - serde_json::json!({ - "json": { - "format": { - "enable": true, - }, - "validate": - { - "enable": true, - }, - "schemas": schemas - } - }) - } - - async fn get_or_init_workspace_config(&self, cx: &mut AsyncApp) -> Result { - { - let reader = self.workspace_config.read().await; - if let Some(config) = reader.as_ref() { - return Ok(config.clone()); - } - } - let mut writer = self.workspace_config.write().await; - - let adapter_schemas = cx - .read_global::(|dap_registry, _| dap_registry.to_owned())? - .adapters_schema() - .await; - - let config = cx.update(|cx| { - Self::get_workspace_config( - self.languages - .language_names() - .into_iter() - .map(|name| name.to_string()) - .collect(), - adapter_schemas, - cx, - ) - })?; - writer.replace(config.clone()); - Ok(config) - } -} - -#[cfg(debug_assertions)] -fn generate_inspector_style_schema() -> serde_json_lenient::Value { - let schema = schemars::generate::SchemaSettings::draft2019_09() - .with_transform(util::schemars::DefaultDenyUnknownFields) - .into_generator() - .root_schema_for::(); - - serde_json_lenient::to_value(schema).unwrap() } impl LspInstaller for JsonLspAdapter { @@ -420,8 +253,23 @@ impl LspAdapter for JsonLspAdapter { _: Option, cx: &mut AsyncApp, ) -> Result { - let mut config = self.get_or_init_workspace_config(cx).await?; - + let mut config = cx.update(|cx| { + let schemas = json_schema_store::all_schema_file_associations(cx); + + // This can be viewed via `dev: open language server logs` -> `json-language-server` -> + // `Server Info` + serde_json::json!({ + "json": { + "format": { + "enable": true, + }, + "validate": { + "enable": true, + }, + "schemas": schemas + } + }) + })?; let project_options = cx.update(|cx| { language_server_settings(delegate.as_ref(), &self.name(), cx) .and_then(|s| s.settings.clone()) @@ -446,10 +294,6 @@ impl LspAdapter for JsonLspAdapter { fn is_primary_zed_json_schema_adapter(&self) -> bool { true } - - async fn clear_zed_json_schema_cache(&self) { - self.workspace_config.write().await.take(); - } } async fn get_cached_server_binary( @@ -482,15 +326,6 @@ async fn get_cached_server_binary( .log_err() } -#[inline] -fn schema_file_match(path: &Path) -> String { - path.strip_prefix(path.parent().unwrap().parent().unwrap()) - .unwrap() - .display() - .to_string() - .replace('\\', "/") -} - pub struct NodeVersionAdapter; impl NodeVersionAdapter { diff --git a/crates/languages/src/lib.rs b/crates/languages/src/lib.rs index 186d50d6ffbe9ea9861ccd5325a89c23062fd89e..9f8b4f45ecd6ad9c98090a81f4aa75c93f6a290a 100644 --- a/crates/languages/src/lib.rs +++ b/crates/languages/src/lib.rs @@ -88,7 +88,7 @@ pub fn init(languages: Arc, fs: Arc, node: NodeRuntime let go_context_provider = Arc::new(go::GoContextProvider); let go_lsp_adapter = Arc::new(go::GoLspAdapter); let json_context_provider = Arc::new(JsonTaskProvider); - let json_lsp_adapter = Arc::new(json::JsonLspAdapter::new(node.clone(), languages.clone())); + let json_lsp_adapter = Arc::new(json::JsonLspAdapter::new(node.clone())); let node_version_lsp_adapter = Arc::new(json::NodeVersionAdapter); let py_lsp_adapter = Arc::new(python::PyLspAdapter::new()); let ty_lsp_adapter = Arc::new(python::TyLspAdapter::new(fs.clone())); diff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rs index ce1b52999a795dd7e6eae7618735c63995ee5b69..f39553e1114768ea7e7f5347690f6749c528f69a 100644 --- a/crates/project/src/lsp_store.rs +++ b/crates/project/src/lsp_store.rs @@ -3707,15 +3707,6 @@ impl LspStore { .detach(); cx.subscribe(&toolchain_store, Self::on_toolchain_store_event) .detach(); - if let Some(extension_events) = extension::ExtensionEvents::try_global(cx).as_ref() { - cx.subscribe( - extension_events, - Self::reload_zed_json_schemas_on_extensions_changed, - ) - .detach(); - } else { - log::debug!("No extension events global found. Skipping JSON schema auto-reload setup"); - } cx.observe_global::(Self::on_settings_changed) .detach(); subscribe_to_binary_statuses(&languages, cx).detach(); @@ -3991,100 +3982,6 @@ impl LspStore { Ok(()) } - pub fn reload_zed_json_schemas_on_extensions_changed( - &mut self, - _: Entity, - evt: &extension::Event, - cx: &mut Context, - ) { - match evt { - extension::Event::ExtensionInstalled(_) - | extension::Event::ExtensionUninstalled(_) - | extension::Event::ConfigureExtensionRequested(_) => return, - extension::Event::ExtensionsInstalledChanged => {} - } - if self.as_local().is_none() { - return; - } - cx.spawn(async move |this, cx| { - let weak_ref = this.clone(); - - let servers = this - .update(cx, |this, cx| { - let local = this.as_local()?; - - let mut servers = Vec::new(); - for (seed, state) in &local.language_server_ids { - - let Some(states) = local.language_servers.get(&state.id) else { - continue; - }; - let (json_adapter, json_server) = match states { - LanguageServerState::Running { - adapter, server, .. - } if adapter.adapter.is_primary_zed_json_schema_adapter() => { - (adapter.adapter.clone(), server.clone()) - } - _ => continue, - }; - - let Some(worktree) = this - .worktree_store - .read(cx) - .worktree_for_id(seed.worktree_id, cx) - else { - continue; - }; - let json_delegate: Arc = - LocalLspAdapterDelegate::new( - local.languages.clone(), - &local.environment, - weak_ref.clone(), - &worktree, - local.http_client.clone(), - local.fs.clone(), - cx, - ); - - servers.push((json_adapter, json_server, json_delegate)); - - } - Some(servers) - }) - .ok() - .flatten(); - - let Some(servers) = servers else { - return; - }; - - for (adapter, server, delegate) in servers { - adapter.clear_zed_json_schema_cache().await; - - let Some(json_workspace_config) = LocalLspStore::workspace_configuration_for_adapter( - adapter, - &delegate, - None, - cx, - ) - .await - .context("generate new workspace configuration for JSON language server while trying to refresh JSON Schemas") - .ok() - else { - continue; - }; - server - .notify::( - &lsp::DidChangeConfigurationParams { - settings: json_workspace_config, - }, - ) - .ok(); - } - }) - .detach(); - } - pub(crate) fn register_buffer_with_language_servers( &mut self, buffer: &Entity, diff --git a/crates/project/src/lsp_store/json_language_server_ext.rs b/crates/project/src/lsp_store/json_language_server_ext.rs index 3eb93386a99bf40dffc5f6de75d56248936b38e3..7a8d67e79207f3bb22ecf88c6353e71b7a84ee54 100644 --- a/crates/project/src/lsp_store/json_language_server_ext.rs +++ b/crates/project/src/lsp_store/json_language_server_ext.rs @@ -1,9 +1,11 @@ -use anyhow::Context as _; -use collections::HashMap; -use gpui::WeakEntity; +use anyhow::{Context, Result}; +use gpui::{App, AsyncApp, Entity, Global, WeakEntity}; use lsp::LanguageServer; use crate::LspStore; + +const LOGGER: zlog::Logger = zlog::scoped!("json-schema"); + /// https://github.com/Microsoft/vscode/blob/main/extensions/json-language-features/server/README.md#schema-content-request /// /// Represents a "JSON language server-specific, non-standardized, extension to the LSP" with which the vscode-json-language-server @@ -20,82 +22,77 @@ impl lsp::request::Request for SchemaContentRequest { const METHOD: &'static str = "vscode/content"; } -pub fn register_requests(_lsp_store: WeakEntity, language_server: &LanguageServer) { - language_server - .on_request::(|params, cx| { - // PERF: Use a cache (`OnceLock`?) to avoid recomputing the action schemas - let mut generator = settings::KeymapFile::action_schema_generator(); - let all_schemas = cx.update(|cx| HashMap::from_iter(cx.action_schemas(&mut generator))); - async move { - let all_schemas = all_schemas?; - let Some(uri) = params.get(0) else { - anyhow::bail!("No URI"); - }; - let normalized_action_name = uri - .strip_prefix("zed://schemas/action/") - .context("Invalid URI")?; - let action_name = denormalize_action_name(normalized_action_name); - let schema = root_schema_from_action_schema( - all_schemas - .get(action_name.as_str()) - .and_then(Option::as_ref), - &mut generator, - ) - .to_value(); +type SchemaRequestHandler = fn(Entity, String, &mut AsyncApp) -> Result; +pub struct SchemaHandlingImpl(SchemaRequestHandler); - serde_json::to_string(&schema).context("Failed to serialize schema") - } - }) - .detach(); -} +impl Global for SchemaHandlingImpl {} -pub fn normalize_action_name(action_name: &str) -> String { - action_name.replace("::", "__") +pub fn register_schema_handler(handler: SchemaRequestHandler, cx: &mut App) { + debug_assert!( + !cx.has_global::(), + "SchemaHandlingImpl already registered" + ); + cx.set_global(SchemaHandlingImpl(handler)); } -pub fn denormalize_action_name(action_name: &str) -> String { - action_name.replace("__", "::") -} +struct SchemaContentsChanged {} -pub fn normalized_action_file_name(action_name: &str) -> String { - normalized_action_name_to_file_name(normalize_action_name(action_name)) +impl lsp::notification::Notification for SchemaContentsChanged { + const METHOD: &'static str = "json/schemaContent"; + type Params = String; } -pub fn normalized_action_name_to_file_name(mut normalized_action_name: String) -> String { - normalized_action_name.push_str(".json"); - normalized_action_name -} +pub fn notify_schema_changed(lsp_store: Entity, uri: &String, cx: &App) { + zlog::trace!(LOGGER => "Notifying schema changed for URI: {:?}", uri); + let servers = lsp_store.read_with(cx, |lsp_store, _| { + let mut servers = Vec::new(); + let Some(local) = lsp_store.as_local() else { + return servers; + }; -pub fn url_schema_for_action(action_name: &str) -> serde_json::Value { - let normalized_name = normalize_action_name(action_name); - let file_name = normalized_action_name_to_file_name(normalized_name.clone()); - serde_json::json!({ - "fileMatch": [file_name], - "url": format!("zed://schemas/action/{}", normalized_name) - }) -} + for states in local.language_servers.values() { + let json_server = match states { + super::LanguageServerState::Running { + adapter, server, .. + } if adapter.adapter.is_primary_zed_json_schema_adapter() => server.clone(), + _ => continue, + }; -fn root_schema_from_action_schema( - action_schema: Option<&schemars::Schema>, - generator: &mut schemars::SchemaGenerator, -) -> schemars::Schema { - let Some(action_schema) = action_schema else { - return schemars::json_schema!(false); - }; - let meta_schema = generator - .settings() - .meta_schema - .as_ref() - .expect("meta_schema should be present in schemars settings") - .to_string(); - let defs = generator.definitions(); - let mut schema = schemars::json_schema!({ - "$schema": meta_schema, - "allowTrailingCommas": true, - "$defs": defs, + servers.push(json_server); + } + servers }); - schema - .ensure_object() - .extend(std::mem::take(action_schema.clone().ensure_object())); - schema + for server in servers { + zlog::trace!(LOGGER => "Notifying server {:?} of schema change for URI: {:?}", server.server_id(), &uri); + // TODO: handle errors + server.notify::(uri).ok(); + } +} + +pub fn register_requests(lsp_store: WeakEntity, language_server: &LanguageServer) { + language_server + .on_request::(move |params, cx| { + let handler = cx.try_read_global::(|handler, _| { + handler.0 + }); + let mut cx = cx.clone(); + let uri = params.clone().pop(); + let lsp_store = lsp_store.clone(); + let resolution = async move { + let lsp_store = lsp_store.upgrade().context("LSP store has been dropped")?; + let uri = uri.context("No URI")?; + let handle_schema_request = handler.context("No schema handler registered")?; + handle_schema_request(lsp_store, uri, &mut cx) + }; + async move { + zlog::trace!(LOGGER => "Handling schema request for {:?}", ¶ms); + let result = resolution.await; + match &result { + Ok(content) => {zlog::trace!(LOGGER => "Schema request resolved with {}B schema", content.len());}, + Err(err) => {zlog::warn!(LOGGER => "Schema request failed: {}", err);}, + } + result + } + }) + .detach(); } diff --git a/crates/remote_server/Cargo.toml b/crates/remote_server/Cargo.toml index b1f12fb0a8133b95259b38bbec22dbd031937cd7..92777d1a5950cf67f5ba060e6e891ea213ea504d 100644 --- a/crates/remote_server/Cargo.toml +++ b/crates/remote_server/Cargo.toml @@ -39,6 +39,7 @@ git2 = { workspace = true, features = ["vendored-libgit2"] } gpui.workspace = true gpui_tokio.workspace = true http_client.workspace = true +json_schema_store.workspace = true language.workspace = true language_extension.workspace = true languages.workspace = true diff --git a/crates/remote_server/src/unix.rs b/crates/remote_server/src/unix.rs index eace30ffe0d1b8ae3404935f443064387614b545..3a1b6c593dcf0fe55b2232cbeb1ee592cebd2f4e 100644 --- a/crates/remote_server/src/unix.rs +++ b/crates/remote_server/src/unix.rs @@ -388,6 +388,8 @@ pub fn execute_run( extension::init(cx); let extension_host_proxy = ExtensionHostProxy::global(cx); + json_schema_store::init(cx); + let project = cx.new(|cx| { let fs = Arc::new(RealFs::new(None, cx.background_executor().clone())); let node_settings_rx = initialize_settings(session.clone(), fs.clone(), cx); diff --git a/crates/settings/src/settings_store.rs b/crates/settings/src/settings_store.rs index 3d3cb069d21b07f47a55b3a2242aff884184007a..e959756bac8aaaddd01a49b82e2dcf0ee85d1a1f 100644 --- a/crates/settings/src/settings_store.rs +++ b/crates/settings/src/settings_store.rs @@ -799,6 +799,7 @@ impl SettingsStore { let language_settings_content_ref = generator .subschema_for::() .to_value(); + replace_subschema::(&mut generator, || { json_schema!({ "type": "object", @@ -811,7 +812,8 @@ impl SettingsStore { language_settings_content_ref.clone(), ) }) - .collect::>() + .collect::>(), + "errorMessage": "No language with this name is installed." }) }); diff --git a/crates/snippet_provider/Cargo.toml b/crates/snippet_provider/Cargo.toml index 3e47c96c66c0fdea2975b168922b24c1dba775e7..af7ffcf30ef71a21a6cdfd2efaf1ce3cf763016b 100644 --- a/crates/snippet_provider/Cargo.toml +++ b/crates/snippet_provider/Cargo.toml @@ -18,6 +18,7 @@ gpui.workspace = true parking_lot.workspace = true paths.workspace = true serde.workspace = true +serde_json.workspace = true serde_json_lenient.workspace = true snippet.workspace = true util.workspace = true diff --git a/crates/snippet_provider/src/format.rs b/crates/snippet_provider/src/format.rs index 1a390aa2e17dfed69cf3b298b0d1f8dfe4e2cd1d..0bbf137aed506f4cc7793f5dbe80ee144b620bf4 100644 --- a/crates/snippet_provider/src/format.rs +++ b/crates/snippet_provider/src/format.rs @@ -1,7 +1,6 @@ use collections::HashMap; use schemars::{JsonSchema, json_schema}; use serde::Deserialize; -use serde_json_lenient::Value; use std::borrow::Cow; use util::schemars::DefaultDenyUnknownFields; @@ -12,13 +11,13 @@ pub struct VsSnippetsFile { } impl VsSnippetsFile { - pub fn generate_json_schema() -> Value { + pub fn generate_json_schema() -> serde_json::Value { let schema = schemars::generate::SchemaSettings::draft2019_09() .with_transform(DefaultDenyUnknownFields) .into_generator() .root_schema_for::(); - serde_json_lenient::to_value(schema).unwrap() + serde_json::to_value(schema).unwrap() } } diff --git a/crates/task/src/task_template.rs b/crates/task/src/task_template.rs index a57f5a175af3fd79ce6b8ef818e3fb97acdc32c2..33ff610b6e1ba509c75138ad4bf35478e69deaf1 100644 --- a/crates/task/src/task_template.rs +++ b/crates/task/src/task_template.rs @@ -115,13 +115,13 @@ pub struct TaskTemplates(pub Vec); impl TaskTemplates { /// Generates JSON schema of Tasks JSON template format. - pub fn generate_json_schema() -> serde_json_lenient::Value { + pub fn generate_json_schema() -> serde_json::Value { let schema = schemars::generate::SchemaSettings::draft2019_09() .with_transform(DefaultDenyUnknownFields) .into_generator() .root_schema_for::(); - serde_json_lenient::to_value(schema).unwrap() + serde_json::to_value(schema).unwrap() } } diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index df1445c24cb8354847b2dc72e7bc201065be8a51..5dfdfd7bf2d55944f3974a1552f0f968c0b21f74 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -81,6 +81,7 @@ image_viewer.workspace = true inspector_ui.workspace = true install_cli.workspace = true journal.workspace = true +json_schema_store.workspace = true keymap_editor.workspace = true language.workspace = true language_extension.workspace = true diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 0dac8f2d55d8fbcbe62f04520bca9fc57f847910..ec9c59fb4096043a05424bb50d898d69a6069e0d 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -619,6 +619,7 @@ pub fn main() { extensions_ui::init(cx); zeta::init(cx); inspector_ui::init(app_state.clone(), cx); + json_schema_store::init(cx); cx.observe_global::({ let fs = fs.clone(); @@ -779,6 +780,59 @@ fn handle_open_request(request: OpenRequest, app_state: Arc, cx: &mut OpenRequestKind::DockMenuAction { index } => { cx.perform_dock_menu_action(index); } + OpenRequestKind::BuiltinJsonSchema { schema_path } => { + workspace::with_active_or_new_workspace(cx, |_workspace, window, cx| { + cx.spawn_in(window, async move |workspace, cx| { + let res = async move { + let json = app_state.languages.language_for_name("JSONC").await.ok(); + let json_schema_content = + json_schema_store::resolve_schema_request_inner( + &app_state.languages, + &schema_path, + cx, + )?; + let json_schema_content = + serde_json::to_string_pretty(&json_schema_content) + .context("Failed to serialize JSON Schema as JSON")?; + let buffer_task = workspace.update(cx, |workspace, cx| { + workspace + .project() + .update(cx, |project, cx| project.create_buffer(false, cx)) + })?; + + let buffer = buffer_task.await?; + + workspace.update_in(cx, |workspace, window, cx| { + buffer.update(cx, |buffer, cx| { + buffer.set_language(json, cx); + buffer.edit([(0..0, json_schema_content)], None, cx); + buffer.edit( + [(0..0, format!("// {} JSON Schema\n", schema_path))], + None, + cx, + ); + }); + + workspace.add_item_to_active_pane( + Box::new(cx.new(|cx| { + let mut editor = + editor::Editor::for_buffer(buffer, None, window, cx); + editor.set_read_only(true); + editor + })), + None, + true, + window, + cx, + ); + }) + } + .await; + res.context("Failed to open builtin JSON Schema").log_err(); + }) + .detach(); + }); + } } return; diff --git a/crates/zed/src/zed/open_listener.rs b/crates/zed/src/zed/open_listener.rs index f2d8cd46c301c0f688d36e17ed1b7d0dcd31ec00..16bd0a1e7f9bf3837779b597729704e9580bc42d 100644 --- a/crates/zed/src/zed/open_listener.rs +++ b/crates/zed/src/zed/open_listener.rs @@ -46,6 +46,7 @@ pub enum OpenRequestKind { Extension { extension_id: String }, AgentPanel, DockMenuAction { index: usize }, + BuiltinJsonSchema { schema_path: String }, } impl OpenRequest { @@ -88,6 +89,10 @@ impl OpenRequest { }); } else if url == "zed://agent" { this.kind = Some(OpenRequestKind::AgentPanel); + } else if let Some(schema_path) = url.strip_prefix("zed://schemas/") { + this.kind = Some(OpenRequestKind::BuiltinJsonSchema { + schema_path: schema_path.to_string(), + }); } else if url.starts_with("ssh://") { this.parse_ssh_file_path(&url, cx)? } else if let Some(request_path) = parse_zed_link(&url, cx) { diff --git a/crates/zlog/src/zlog.rs b/crates/zlog/src/zlog.rs index d0e8958df5720f60abecd296576f22e684002c35..8254866b6f97f6479f55bd570d1bc63ab26b10d4 100644 --- a/crates/zlog/src/zlog.rs +++ b/crates/zlog/src/zlog.rs @@ -181,27 +181,29 @@ macro_rules! time { #[macro_export] macro_rules! scoped { ($parent:expr => $name:expr) => {{ - let parent = $parent; - let name = $name; - let mut scope = parent.scope; - let mut index = 1; // always have crate/module name - while index < scope.len() && !scope[index].is_empty() { - index += 1; - } - if index >= scope.len() { - #[cfg(debug_assertions)] - { - unreachable!("Scope overflow trying to add scope... ignoring scope"); - } - } - scope[index] = name; - $crate::Logger { scope } + $crate::scoped_logger($parent, $name) }}; ($name:expr) => { $crate::scoped!($crate::default_logger!() => $name) }; } +pub const fn scoped_logger(parent: Logger, name: &'static str) -> Logger { + let mut scope = parent.scope; + let mut index = 1; // always have crate/module name + while index < scope.len() && !scope[index].is_empty() { + index += 1; + } + if index >= scope.len() { + #[cfg(debug_assertions)] + { + panic!("Scope overflow trying to add scope... ignoring scope"); + } + } + scope[index] = name; + Logger { scope } +} + #[macro_export] macro_rules! default_logger { () => {