diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-07-26 18:52:31 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-26 22:52:31 +0000 |
commit | 56e3daa19b1a0718bbcea2beae737ce8845ceac2 (patch) | |
tree | 408138bea1dc2641b6f2ce75a6497322d27222b8 /cli/tests/integration/lsp_tests.rs | |
parent | 0e4d6d41ad64b89ab72d87a778d1bf3e516efabc (diff) |
fix(lsp): handle import mapped `node:` specifier (#19956)
Closes https://github.com/denoland/vscode_deno/issues/805
Diffstat (limited to 'cli/tests/integration/lsp_tests.rs')
-rw-r--r-- | cli/tests/integration/lsp_tests.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs index dc68ab514..15ede69ea 100644 --- a/cli/tests/integration/lsp_tests.rs +++ b/cli/tests/integration/lsp_tests.rs @@ -611,6 +611,39 @@ fn lsp_import_map_config_file_auto_discovered_symlink() { } #[test] +fn lsp_import_map_node_specifiers() { + let context = TestContextBuilder::for_npm().use_temp_cwd().build(); + let temp_dir = context.temp_dir(); + + temp_dir.write("deno.json", r#"{ "imports": { "fs": "node:fs" } }"#); + + // cache @types/node + context + .new_command() + .args("cache npm:@types/node") + .run() + .skip_output_check() + .assert_exit_code(0); + + let mut client = context.new_lsp_command().build(); + client.initialize(|builder| { + builder.set_config("./deno.json"); + }); + + let diagnostics = client.did_open(json!({ + "textDocument": { + "uri": temp_dir.uri().join("a.ts").unwrap(), + "languageId": "typescript", + "version": 1, + "text": "import fs from \"fs\";\nconsole.log(fs);" + } + })); + assert_eq!(diagnostics.all(), vec![]); + + client.shutdown(); +} + +#[test] fn lsp_deno_task() { let context = TestContextBuilder::new().use_temp_cwd().build(); let temp_dir = context.temp_dir(); |