diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-03-04 12:34:31 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-04 17:34:31 +0000 |
commit | 902a1137ea6021af8c56b82fa38b8084a89a4bb1 (patch) | |
tree | da83a61ba60f6ebd15e6474197c7016853704a20 /tests/integration/lsp_tests.rs | |
parent | 5a28d70e05d9854102e983a4c4fd1cf4238361dc (diff) |
fix(lsp): do not warn about local file "redirects" from .js to .d.ts files (#22670)
The diagnostic was incorrect when importing a `.js` file with a
corresponding `.d.ts` file with sloppy imports because it would say to
change the `.js` extension to `.d.ts`, which is incorrect. We might as
well just hide this diagnostic.
Diffstat (limited to 'tests/integration/lsp_tests.rs')
-rw-r--r-- | tests/integration/lsp_tests.rs | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs index 0c4c1544f..9300413b5 100644 --- a/tests/integration/lsp_tests.rs +++ b/tests/integration/lsp_tests.rs @@ -11318,12 +11318,38 @@ fn lsp_sloppy_imports_warn() { "text": "export class B {}", }, })); + client.did_open(json!({ + "textDocument": { + "uri": temp_dir.join("c.js").uri_file(), + "languageId": "typescript", + "version": 1, + "text": "export class C {}", + }, + })); + client.did_open(json!({ + "textDocument": { + "uri": temp_dir.join("c.d.ts").uri_file(), + "languageId": "typescript", + "version": 1, + "text": "export class C {}", + }, + })); let diagnostics = client.did_open(json!({ "textDocument": { "uri": temp_dir.join("file.ts").uri_file(), "languageId": "typescript", "version": 1, - "text": "import * as a from './a';\nimport * as b from './b.js';\nconsole.log(a)\nconsole.log(b);\n", + "text": concat!( + "import * as a from './a';\n", + "import * as b from './b.js';\n", + // this one's types resolve to a .d.ts file and we don't + // bother warning about it because it's a bit complicated + // to explain to use @deno-types in a diagnostic + "import * as c from './c.js';\n", + "console.log(a)\n", + "console.log(b);\n", + "console.log(c);\n", + ), }, })); assert_eq!( |