summaryrefslogtreecommitdiff
path: root/tests/integration/lsp_tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration/lsp_tests.rs')
-rw-r--r--tests/integration/lsp_tests.rs19
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,