From f8956eb763159f325d5cb0d4c4281d2e640e2e71 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Thu, 16 May 2024 22:12:25 +0100 Subject: fix(lsp): respect types dependencies for tsc roots (#23825) --- tests/integration/lsp_tests.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'tests') diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs index 2d5bb2e24..1f7758a9d 100644 --- a/tests/integration/lsp_tests.rs +++ b/tests/integration/lsp_tests.rs @@ -8954,6 +8954,34 @@ fn lsp_diagnostics_deno_types() { client.shutdown(); } +#[test] +fn lsp_root_with_global_reference_types() { + let context = TestContextBuilder::new() + .use_http_server() + .use_temp_cwd() + .build(); + let temp_dir = context.temp_dir(); + let file = source_file( + temp_dir.path().join("file.ts"), + "import 'http://localhost:4545/subdir/foo_types.d.ts'; Foo.bar;", + ); + let file2 = source_file( + temp_dir.path().join("file2.ts"), + r#"/// "#, + ); + let mut client = context.new_lsp_command().build(); + client.initialize_default(); + client.write_request( + "workspace/executeCommand", + json!({ + "command": "deno.cache", + "arguments": [[], file2.uri()], + }), + ); + let diagnostics = client.did_open_file(&file); + assert_eq!(json!(diagnostics.all()), json!([])); +} + #[test] fn lsp_diagnostics_refresh_dependents() { let context = TestContextBuilder::new().use_temp_cwd().build(); -- cgit v1.2.3