diff options
-rw-r--r-- | cli/lsp/language_server.rs | 10 | ||||
-rw-r--r-- | cli/main.rs | 2 | ||||
-rw-r--r-- | cli/tests/integration/lsp_tests.rs | 18 | ||||
-rw-r--r-- | cli/tools/doc.rs | 7 | ||||
-rw-r--r-- | cli/tsc/mod.rs | 9 |
5 files changed, 16 insertions, 30 deletions
diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 395053fa5..a3c817526 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -1126,7 +1126,7 @@ impl Inner { "experimentalDecorators": true, "isolatedModules": true, "jsx": "react", - "lib": ["deno.ns", "deno.window"], + "lib": ["deno.ns", "deno.window", "deno.unstable"], "module": "esnext", "moduleDetection": "force", "noEmit": true, @@ -1137,14 +1137,6 @@ impl Inner { // TODO(@kitsonk) remove for Deno 1.15 "useUnknownInCatchVariables": false, })); - let config = &self.config; - let workspace_settings = config.workspace_settings(); - if workspace_settings.unstable { - let unstable_libs = json!({ - "lib": ["deno.ns", "deno.window", "deno.unstable"] - }); - tsconfig.merge(&unstable_libs); - } if let Err(err) = self.merge_user_tsconfig(&mut tsconfig) { self.client.show_message(MessageType::WARNING, err); } diff --git a/cli/main.rs b/cli/main.rs index 922a45030..6a9ac3327 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -195,7 +195,7 @@ async fn run_subcommand(flags: Flags) -> Result<i32, AnyError> { }) } DenoSubcommand::Types => spawn_subcommand(async move { - let types = tsc::get_types_declaration_file_text(flags.unstable); + let types = tsc::get_types_declaration_file_text(); display::write_to_stdout_ignore_sigpipe(types.as_bytes()) }), #[cfg(feature = "upgrade")] diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs index c287df5cd..94982c0a7 100644 --- a/cli/tests/integration/lsp_tests.rs +++ b/cli/tests/integration/lsp_tests.rs @@ -1904,7 +1904,7 @@ fn lsp_exclude_config() { } #[test] -fn lsp_hover_unstable_disabled() { +fn lsp_hover_unstable_always_enabled() { let context = TestContextBuilder::new().use_temp_cwd().build(); let mut client = context.new_lsp_command().build(); client.initialize_default(); @@ -1930,16 +1930,17 @@ fn lsp_hover_unstable_disabled() { assert_eq!( res, json!({ - "contents": [ + "contents":[ { - "language": "typescript", - "value": "type Deno.ForeignLibraryInterface = /*unresolved*/ any", + "language":"typescript", + "value":"interface Deno.ForeignLibraryInterface" }, - "", + "**UNSTABLE**: New API, yet to be vetted.\n\nA foreign library interface descriptor.", + "\n\n*@category* - FFI", ], - "range": { - "start": { "line": 0, "character": 14 }, - "end": { "line": 0, "character": 37 } + "range":{ + "start":{ "line":0, "character":14 }, + "end":{ "line":0, "character":37 } } }) ); @@ -1951,6 +1952,7 @@ fn lsp_hover_unstable_enabled() { let context = TestContextBuilder::new().use_temp_cwd().build(); let mut client = context.new_lsp_command().build(); client.initialize(|builder| { + // NOTE(bartlomieju): this is effectively not used anymore. builder.set_unstable(true); }); client.did_open(json!({ diff --git a/cli/tools/doc.rs b/cli/tools/doc.rs index 7b06dce05..5e9f32a8f 100644 --- a/cli/tools/doc.rs +++ b/cli/tools/doc.rs @@ -1,6 +1,5 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -use crate::args::CliOptions; use crate::args::DocFlags; use crate::args::DocHtmlFlag; use crate::args::DocSourceFileFlag; @@ -28,17 +27,15 @@ use indexmap::IndexMap; use std::collections::BTreeMap; use std::path::PathBuf; use std::rc::Rc; -use std::sync::Arc; async fn generate_doc_nodes_for_builtin_types( doc_flags: DocFlags, - cli_options: &Arc<CliOptions>, parser: &dyn ModuleParser, analyzer: &dyn ModuleAnalyzer, ) -> Result<IndexMap<ModuleSpecifier, Vec<doc::DocNode>>, AnyError> { let source_file_specifier = ModuleSpecifier::parse("internal://lib.deno.d.ts").unwrap(); - let content = get_types_declaration_file_text(cli_options.unstable()); + let content = get_types_declaration_file_text(); let mut loader = deno_graph::source::MemoryLoader::new( vec![( source_file_specifier.to_string(), @@ -86,7 +83,6 @@ pub async fn doc(flags: Flags, doc_flags: DocFlags) -> Result<(), AnyError> { DocSourceFileFlag::Builtin => { generate_doc_nodes_for_builtin_types( doc_flags.clone(), - cli_options, &capturing_parser, &analyzer, ) @@ -156,7 +152,6 @@ pub async fn doc(flags: Flags, doc_flags: DocFlags) -> Result<(), AnyError> { let deno_ns = if doc_flags.source_files != DocSourceFileFlag::Builtin { let deno_ns = generate_doc_nodes_for_builtin_types( doc_flags.clone(), - cli_options, &capturing_parser, &analyzer, ) diff --git a/cli/tsc/mod.rs b/cli/tsc/mod.rs index 4df841cd3..04450b8d0 100644 --- a/cli/tsc/mod.rs +++ b/cli/tsc/mod.rs @@ -78,14 +78,14 @@ pub static COMPILER_SNAPSHOT: Lazy<Box<[u8]>> = Lazy::new( }, ); -pub fn get_types_declaration_file_text(unstable: bool) -> String { +pub fn get_types_declaration_file_text() -> String { let mut assets = get_asset_texts_from_new_runtime() .unwrap() .into_iter() .map(|a| (a.specifier, a.text)) .collect::<HashMap<_, _>>(); - let mut lib_names = vec![ + let lib_names = vec![ "deno.ns", "deno.console", "deno.url", @@ -100,12 +100,9 @@ pub fn get_types_declaration_file_text(unstable: bool) -> String { "deno.shared_globals", "deno.cache", "deno.window", + "deno.unstable", ]; - if unstable { - lib_names.push("deno.unstable"); - } - lib_names .into_iter() .map(|name| { |