diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2024-04-10 19:58:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-10 19:58:49 +0100 |
commit | 7c5745a204637f12e53e62821c6e7e91fee21fbe (patch) | |
tree | 6a3606330f1234aaaf02495ccba023b61c7e61e8 /tests/integration/lsp_tests.rs | |
parent | 08f46ac4467968f53400c4cf9db95f62b424a161 (diff) |
refactor(lsp): cleanup documents dependents calculation (#23295)
Diffstat (limited to 'tests/integration/lsp_tests.rs')
-rw-r--r-- | tests/integration/lsp_tests.rs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs index 6821eb8da..96fb9507a 100644 --- a/tests/integration/lsp_tests.rs +++ b/tests/integration/lsp_tests.rs @@ -7862,18 +7862,18 @@ fn lsp_npm_specifier_unopened_file() { .use_http_server() .use_temp_cwd() .build(); - let mut client = context.new_lsp_command().build(); - client.initialize_default(); - + let temp_dir = context.temp_dir(); // create other.ts, which re-exports an npm specifier - client.deno_dir().write( + temp_dir.write( "other.ts", "export { default as chalk } from 'npm:chalk@5';", ); + let mut client = context.new_lsp_command().build(); + client.initialize_default(); // cache the other.ts file to the DENO_DIR let deno = deno_cmd_with_deno_dir(client.deno_dir()) - .current_dir(client.deno_dir().path()) + .current_dir(temp_dir.path()) .arg("cache") .arg("--quiet") .arg("other.ts") @@ -7891,12 +7891,9 @@ fn lsp_npm_specifier_unopened_file() { assert!(stderr.is_empty()); // open main.ts, which imports other.ts (unopened) - let main_url = - ModuleSpecifier::from_file_path(client.deno_dir().path().join("main.ts")) - .unwrap(); client.did_open(json!({ "textDocument": { - "uri": main_url, + "uri": temp_dir.uri().join("main.ts").unwrap(), "languageId": "typescript", "version": 1, "text": "import { chalk } from './other.ts';\n\n", @@ -7907,7 +7904,7 @@ fn lsp_npm_specifier_unopened_file() { "textDocument/didChange", json!({ "textDocument": { - "uri": main_url, + "uri": temp_dir.uri().join("main.ts").unwrap(), "version": 2 }, "contentChanges": [ @@ -7925,7 +7922,7 @@ fn lsp_npm_specifier_unopened_file() { // now ensure completions work let list = client.get_completion_list( - main_url, + temp_dir.uri().join("main.ts").unwrap(), (2, 6), json!({ "triggerKind": 2, |