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.rs612
1 files changed, 308 insertions, 304 deletions
diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs
index a0d12da3a..5d4640ce6 100644
--- a/tests/integration/lsp_tests.rs
+++ b/tests/integration/lsp_tests.rs
@@ -8,6 +8,7 @@ use deno_core::serde_json::Value;
use deno_core::url::Url;
use pretty_assertions::assert_eq;
use std::fs;
+use std::str::FromStr;
use test_util::assert_starts_with;
use test_util::assertions::assert_json_subset;
use test_util::deno_cmd_with_deno_dir;
@@ -91,7 +92,7 @@ fn lsp_tsconfig_types() {
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("test.ts").unwrap(),
+ "uri": temp_dir.url().join("test.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "console.log(a);\n"
@@ -136,7 +137,7 @@ fn lsp_tsconfig_types_config_sub_dir() {
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("test.ts").unwrap(),
+ "uri": temp_dir.url().join("test.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "console.log(a);\n"
@@ -159,7 +160,7 @@ fn lsp_triple_slash_types() {
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("test.ts").unwrap(),
+ "uri": temp_dir.url().join("test.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "/// <reference types=\"./a.d.ts\" />\n\nconsole.log(a);\n"
@@ -206,13 +207,13 @@ fn unadded_dependency_message_with_import_map() {
"workspace/executeCommand",
json!({
"command": "deno.cache",
- "arguments": [[], temp_dir.uri().join("file.ts").unwrap()],
+ "arguments": [[], temp_dir.url().join("file.ts").unwrap()],
}),
);
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": temp_dir.read_to_string("file.ts"),
@@ -265,13 +266,13 @@ fn unadded_dependency_message() {
"workspace/executeCommand",
json!({
"command": "deno.cache",
- "arguments": [[], temp_dir.uri().join("file.ts").unwrap()],
+ "arguments": [[], temp_dir.url().join("file.ts").unwrap()],
}),
);
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": temp_dir.read_to_string("file.ts"),
@@ -314,7 +315,7 @@ fn lsp_import_map() {
builder.set_import_map("import-map.json");
});
- let uri = temp_dir.uri().join("a.ts").unwrap();
+ let uri = temp_dir.url().join("a.ts").unwrap();
let diagnostics = client.did_open(json!({
"textDocument": {
@@ -386,13 +387,13 @@ fn lsp_import_map_remote() {
"workspace/executeCommand",
json!({
"command": "deno.cache",
- "arguments": [[], temp_dir.uri().join("file.ts").unwrap()],
+ "arguments": [[], temp_dir.url().join("file.ts").unwrap()],
}),
);
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": temp_dir.read_to_string("file.ts"),
@@ -412,7 +413,7 @@ fn lsp_import_map_data_url() {
});
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import example from \"example\";\n"
@@ -454,7 +455,7 @@ fn lsp_import_map_config_file() {
builder.set_config("./deno.import_map.jsonc");
});
- let uri = temp_dir.uri().join("a.ts").unwrap();
+ let uri = temp_dir.url().join("a.ts").unwrap();
let diagnostics = client.did_open(json!({
"textDocument": {
@@ -516,7 +517,7 @@ fn lsp_import_map_embedded_in_config_file() {
builder.set_config("./deno.embedded_import_map.jsonc");
});
- let uri = temp_dir.uri().join("a.ts").unwrap();
+ let uri = temp_dir.url().join("a.ts").unwrap();
let diagnostics = client.did_open(json!({
"textDocument": {
@@ -570,7 +571,7 @@ fn lsp_import_map_embedded_in_config_file_after_initialize() {
builder.set_config("./deno.embedded_import_map.jsonc");
});
- let uri = temp_dir.uri().join("a.ts").unwrap();
+ let uri = temp_dir.url().join("a.ts").unwrap();
let diagnostics = client.did_open(json!({
"textDocument": {
@@ -595,7 +596,7 @@ fn lsp_import_map_embedded_in_config_file_after_initialize() {
client.did_change_watched_files(json!({
"changes": [{
- "uri": temp_dir.uri().join("deno.embedded_import_map.jsonc").unwrap(),
+ "uri": temp_dir.url().join("deno.embedded_import_map.jsonc").unwrap(),
"type": 2
}]
}));
@@ -644,7 +645,7 @@ fn lsp_import_map_config_file_auto_discovered() {
temp_dir.write("deno.jsonc", r#"{ "imports": { "/~/": "./lib/" } }"#);
client.did_change_watched_files(json!({
"changes": [{
- "uri": temp_dir.uri().join("deno.jsonc").unwrap(),
+ "uri": temp_dir.url().join("deno.jsonc").unwrap(),
"type": 2
}]
}));
@@ -652,7 +653,7 @@ fn lsp_import_map_config_file_auto_discovered() {
line.contains(" Resolved Deno configuration file:")
});
- let uri = temp_dir.uri().join("a.ts").unwrap();
+ let uri = temp_dir.url().join("a.ts").unwrap();
let diagnostics = client.did_open(json!({
"textDocument": {
@@ -695,7 +696,7 @@ fn lsp_import_map_config_file_auto_discovered() {
temp_dir.write("deno.jsonc", r#",,#,#,,"#);
client.did_change_watched_files(json!({
"changes": [{
- "uri": temp_dir.uri().join("deno.jsonc").unwrap(),
+ "uri": temp_dir.url().join("deno.jsonc").unwrap(),
"type": 2
}]
}));
@@ -705,7 +706,7 @@ fn lsp_import_map_config_file_auto_discovered() {
temp_dir.write("deno.jsonc", r#"{ "imports": { "/~/": "./lib/" } }"#);
client.did_change_watched_files(json!({
"changes": [{
- "uri": temp_dir.uri().join("deno.jsonc").unwrap(),
+ "uri": temp_dir.url().join("deno.jsonc").unwrap(),
"type": 2
}]
}));
@@ -771,7 +772,7 @@ fn lsp_import_map_config_file_auto_discovered_symlink() {
client.did_change_watched_files(json!({
"changes": [{
// the client will give a watched file changed event for the symlink's target
- "uri": temp_dir.path().join("subdir/deno.json").canonicalize().uri_file(),
+ "uri": temp_dir.path().join("subdir/deno.json").canonicalize().url_file(),
"type": 2
}]
}));
@@ -779,14 +780,14 @@ fn lsp_import_map_config_file_auto_discovered_symlink() {
// this will discover the deno.json in the root
let search_line = format!(
" Resolved Deno configuration file: \"{}\"",
- temp_dir.uri().join("deno.json").unwrap().as_str()
+ temp_dir.url().join("deno.json").unwrap().as_str()
);
client.wait_until_stderr_line(|line| line.contains(&search_line));
// now open a file which will cause a diagnostic because the import map is empty
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("a.ts").unwrap(),
+ "uri": temp_dir.url().join("a.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import { b } from \"/~/b.ts\";\n\nconsole.log(b);\n"
@@ -799,7 +800,7 @@ fn lsp_import_map_config_file_auto_discovered_symlink() {
client.did_change_watched_files(json!({
"changes": [{
// now still say that the target path has changed
- "uri": temp_dir.path().join("subdir/deno.json").canonicalize().uri_file(),
+ "uri": temp_dir.path().join("subdir/deno.json").canonicalize().url_file(),
"type": 2
}]
}));
@@ -837,13 +838,13 @@ fn lsp_deno_json_imports_comments_cache() {
"workspace/executeCommand",
json!({
"command": "deno.cache",
- "arguments": [[], temp_dir.uri().join("file.ts").unwrap()],
+ "arguments": [[], temp_dir.url().join("file.ts").unwrap()],
}),
);
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": temp_dir.read_to_string("file.ts"),
@@ -875,7 +876,7 @@ fn lsp_import_map_node_specifiers() {
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("a.ts").unwrap(),
+ "uri": temp_dir.url().join("a.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import fs from \"fs\";\nconsole.log(fs);"
@@ -906,7 +907,7 @@ fn lsp_format_vendor_path() {
client.initialize_default();
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": r#"import "http://localhost:4545/run/002_hello.ts";"#,
@@ -928,7 +929,7 @@ fn lsp_format_vendor_path() {
"workspace/executeCommand",
json!({
"command": "deno.cache",
- "arguments": [[], temp_dir.uri().join("file.ts").unwrap()],
+ "arguments": [[], temp_dir.url().join("file.ts").unwrap()],
}),
);
assert!(temp_dir
@@ -937,7 +938,7 @@ fn lsp_format_vendor_path() {
.exists());
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("vendor/http_localhost_4545/run/002_hello.ts").unwrap(),
+ "uri": temp_dir.url().join("vendor/http_localhost_4545/run/002_hello.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": r#"console.log("Hello World");"#,
@@ -947,7 +948,7 @@ fn lsp_format_vendor_path() {
"textDocument/formatting",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("vendor/http_localhost_4545/run/002_hello.ts").unwrap(),
+ "uri": temp_dir.url().join("vendor/http_localhost_4545/run/002_hello.ts").unwrap(),
},
"options": {
"tabSize": 2,
@@ -993,13 +994,13 @@ fn lsp_workspace_enable_paths_no_workspace_configuration() {
uri: temp_dir.uri(),
name: "project".to_string(),
}]);
- builder.set_root_uri(temp_dir.uri());
+ builder.set_root_uri(temp_dir.url());
builder.set_enable_paths(vec!["./main_enabled.ts".to_string()]);
});
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("main_disabled.ts").unwrap(),
+ "uri": temp_dir.url().join("main_disabled.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": temp_dir.read_to_string("main_disabled.ts"),
@@ -1008,7 +1009,7 @@ fn lsp_workspace_enable_paths_no_workspace_configuration() {
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("main_enabled.ts").unwrap(),
+ "uri": temp_dir.url().join("main_enabled.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": temp_dir.read_to_string("main_enabled.ts"),
@@ -1019,7 +1020,7 @@ fn lsp_workspace_enable_paths_no_workspace_configuration() {
"textDocument/hover",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("main_disabled.ts").unwrap(),
+ "uri": temp_dir.url().join("main_disabled.ts").unwrap(),
},
"position": { "line": 0, "character": 5 }
}),
@@ -1030,7 +1031,7 @@ fn lsp_workspace_enable_paths_no_workspace_configuration() {
"textDocument/hover",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("main_enabled.ts").unwrap(),
+ "uri": temp_dir.url().join("main_enabled.ts").unwrap(),
},
"position": { "line": 0, "character": 5 }
}),
@@ -1071,14 +1072,14 @@ fn lsp_did_change_deno_configuration_notification() {
Some(json!({
"changes": [
{
- "scopeUri": temp_dir.uri(),
- "fileUri": temp_dir.uri().join("deno.json").unwrap(),
+ "scopeUri": temp_dir.url(),
+ "fileUri": temp_dir.url().join("deno.json").unwrap(),
"type": "added",
"configurationType": "denoJson"
},
{
- "scopeUri": temp_dir.uri(),
- "fileUri": temp_dir.uri().join("package.json").unwrap(),
+ "scopeUri": temp_dir.url(),
+ "fileUri": temp_dir.url().join("package.json").unwrap(),
"type": "added",
"configurationType": "packageJson"
},
@@ -1092,7 +1093,7 @@ fn lsp_did_change_deno_configuration_notification() {
);
client.did_change_watched_files(json!({
"changes": [{
- "uri": temp_dir.uri().join("deno.json").unwrap(),
+ "uri": temp_dir.url().join("deno.json").unwrap(),
"type": 2,
}],
}));
@@ -1102,8 +1103,8 @@ fn lsp_did_change_deno_configuration_notification() {
res,
Some(json!({
"changes": [{
- "scopeUri": temp_dir.uri(),
- "fileUri": temp_dir.uri().join("deno.json").unwrap(),
+ "scopeUri": temp_dir.url(),
+ "fileUri": temp_dir.url().join("deno.json").unwrap(),
"type": "changed",
"configurationType": "denoJson"
}],
@@ -1113,7 +1114,7 @@ fn lsp_did_change_deno_configuration_notification() {
temp_dir.remove_file("deno.json");
client.did_change_watched_files(json!({
"changes": [{
- "uri": temp_dir.uri().join("deno.json").unwrap(),
+ "uri": temp_dir.url().join("deno.json").unwrap(),
"type": 3,
}],
}));
@@ -1123,8 +1124,8 @@ fn lsp_did_change_deno_configuration_notification() {
res,
Some(json!({
"changes": [{
- "scopeUri": temp_dir.uri(),
- "fileUri": temp_dir.uri().join("deno.json").unwrap(),
+ "scopeUri": temp_dir.url(),
+ "fileUri": temp_dir.url().join("deno.json").unwrap(),
"type": "removed",
"configurationType": "denoJson"
}],
@@ -1134,7 +1135,7 @@ fn lsp_did_change_deno_configuration_notification() {
temp_dir.write("package.json", json!({ "type": "module" }).to_string());
client.did_change_watched_files(json!({
"changes": [{
- "uri": temp_dir.uri().join("package.json").unwrap(),
+ "uri": temp_dir.url().join("package.json").unwrap(),
"type": 2,
}],
}));
@@ -1144,8 +1145,8 @@ fn lsp_did_change_deno_configuration_notification() {
res,
Some(json!({
"changes": [{
- "scopeUri": temp_dir.uri(),
- "fileUri": temp_dir.uri().join("package.json").unwrap(),
+ "scopeUri": temp_dir.url(),
+ "fileUri": temp_dir.url().join("package.json").unwrap(),
"type": "changed",
"configurationType": "packageJson"
}],
@@ -1155,7 +1156,7 @@ fn lsp_did_change_deno_configuration_notification() {
temp_dir.remove_file("package.json");
client.did_change_watched_files(json!({
"changes": [{
- "uri": temp_dir.uri().join("package.json").unwrap(),
+ "uri": temp_dir.url().join("package.json").unwrap(),
"type": 3,
}],
}));
@@ -1165,8 +1166,8 @@ fn lsp_did_change_deno_configuration_notification() {
res,
Some(json!({
"changes": [{
- "scopeUri": temp_dir.uri(),
- "fileUri": temp_dir.uri().join("package.json").unwrap(),
+ "scopeUri": temp_dir.url(),
+ "fileUri": temp_dir.url().join("package.json").unwrap(),
"type": "removed",
"configurationType": "packageJson"
}],
@@ -1202,11 +1203,11 @@ fn lsp_deno_task() {
{
"name": "build",
"detail": "deno test",
- "sourceUri": temp_dir.uri().join("deno.jsonc").unwrap(),
+ "sourceUri": temp_dir.url().join("deno.jsonc").unwrap(),
}, {
"name": "some:test",
"detail": "deno bundle mod.ts",
- "sourceUri": temp_dir.uri().join("deno.jsonc").unwrap(),
+ "sourceUri": temp_dir.url().join("deno.jsonc").unwrap(),
}
])
);
@@ -1368,7 +1369,7 @@ fn lsp_import_map_import_completions() {
let mut client = context.new_lsp_command().build();
client.initialize_default();
- let uri = temp_dir.uri().join("a.ts").unwrap();
+ let uri = temp_dir.url().join("a.ts").unwrap();
client.did_open(json!({
"textDocument": {
@@ -1551,7 +1552,7 @@ fn lsp_hover_asset() {
client.initialize_default();
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "console.log(Date.now());\n"
@@ -1561,7 +1562,7 @@ fn lsp_hover_asset() {
"textDocument/definition",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap()
+ "uri": temp_dir.url().join("file.ts").unwrap()
},
"position": { "line": 0, "character": 14 }
}),
@@ -1795,7 +1796,7 @@ fn lsp_workspace_disable_enable_paths() {
temp_dir.write("worker/other.ts", "import { a } from './shared.ts';\na;");
temp_dir.write("worker/node.ts", "Buffer.alloc(1);");
- let root_specifier = temp_dir.uri();
+ let root_specifier = temp_dir.url();
let mut client = context.new_lsp_command().build();
client.initialize_with_config(
@@ -1806,9 +1807,9 @@ fn lsp_workspace_disable_enable_paths() {
.set_root_uri(root_specifier.clone())
.set_workspace_folders(vec![lsp::WorkspaceFolder {
uri: if use_trailing_slash {
- root_specifier.clone()
+ lsp::Uri::from_str(root_specifier.as_str()).unwrap()
} else {
- ModuleSpecifier::parse(
+ lsp::Uri::from_str(
root_specifier.as_str().strip_suffix('/').unwrap(),
)
.unwrap()
@@ -2022,7 +2023,7 @@ fn lsp_exclude_config() {
"exclude": ["other"],
}"#,
);
- let root_specifier = temp_dir.uri();
+ let root_specifier = temp_dir.url();
let mut client = context.new_lsp_command().build();
client.initialize_default();
@@ -2298,8 +2299,8 @@ fn lsp_hover_closed_document() {
temp_dir.write("b.ts", r#"export * from "./a.ts";"#);
temp_dir.write("c.ts", "import { a } from \"./b.ts\";\nconsole.log(a);\n");
- let b_specifier = temp_dir.uri().join("b.ts").unwrap();
- let c_specifier = temp_dir.uri().join("c.ts").unwrap();
+ let b_specifier = temp_dir.url().join("b.ts").unwrap();
+ let c_specifier = temp_dir.url().join("c.ts").unwrap();
let mut client = context.new_lsp_command().build();
client.initialize_default();
@@ -2656,7 +2657,7 @@ fn lsp_rename_synbol_file_scheme_edits_only() {
client.initialize_default();
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": r#"
@@ -2669,7 +2670,7 @@ fn lsp_rename_synbol_file_scheme_edits_only() {
"textDocument/rename",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
},
"position": { "line": 1, "character": 17 },
"newName": "PATH_SEPARATOR",
@@ -2681,7 +2682,7 @@ fn lsp_rename_synbol_file_scheme_edits_only() {
"documentChanges": [
{
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"version": 1,
},
"edits": [
@@ -2726,8 +2727,8 @@ fn lsp_document_preload_limit_zero_deno_json_detection() {
res,
Some(json!({
"changes": [{
- "scopeUri": temp_dir.uri(),
- "fileUri": temp_dir.uri().join("deno.json").unwrap(),
+ "scopeUri": temp_dir.url(),
+ "fileUri": temp_dir.url().join("deno.json").unwrap(),
"type": "added",
"configurationType": "denoJson",
}],
@@ -2761,7 +2762,7 @@ fn lsp_import_map_setting_with_deno_json() {
});
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import \"file2\";\n",
@@ -2835,7 +2836,7 @@ fn lsp_hover_jsr() {
client.initialize_default();
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import \"jsr:@denotest/add@1.0.0\";\n",
@@ -2845,14 +2846,14 @@ fn lsp_hover_jsr() {
"workspace/executeCommand",
json!({
"command": "deno.cache",
- "arguments": [[], temp_dir.uri().join("file.ts").unwrap()],
+ "arguments": [[], temp_dir.url().join("file.ts").unwrap()],
}),
);
let res = client.write_request(
"textDocument/hover",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
},
"position": { "line": 0, "character": 7 },
}),
@@ -5202,7 +5203,7 @@ fn lsp_code_actions_deno_cache_jsr() {
client.initialize_default();
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": r#"
@@ -5214,7 +5215,7 @@ fn lsp_code_actions_deno_cache_jsr() {
assert_eq!(
json!(diagnostics.messages_with_source("deno")),
json!({
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"diagnostics": [{
"range": {
"start": { "line": 1, "character": 28 },
@@ -5232,7 +5233,7 @@ fn lsp_code_actions_deno_cache_jsr() {
let res = client.write_request(
"textDocument/codeAction",
json!({
- "textDocument": { "uri": temp_dir.uri().join("file.ts").unwrap() },
+ "textDocument": { "uri": temp_dir.url().join("file.ts").unwrap() },
"range": {
"start": { "line": 1, "character": 28 },
"end": { "line": 1, "character": 49 },
@@ -5274,7 +5275,7 @@ fn lsp_code_actions_deno_cache_jsr() {
"command": "deno.cache",
"arguments": [
["jsr:@denotest/add@1"],
- temp_dir.uri().join("file.ts").unwrap(),
+ temp_dir.url().join("file.ts").unwrap(),
],
},
}])
@@ -5285,7 +5286,7 @@ fn lsp_code_actions_deno_cache_jsr() {
"command": "deno.cache",
"arguments": [
["jsr:@denotest/add@1"],
- temp_dir.uri().join("file.ts").unwrap(),
+ temp_dir.url().join("file.ts").unwrap(),
],
}),
);
@@ -5321,7 +5322,7 @@ fn lsp_jsr_lockfile() {
client.initialize_default();
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": r#"
@@ -5336,7 +5337,7 @@ fn lsp_jsr_lockfile() {
"command": "deno.cache",
"arguments": [
[],
- temp_dir.uri().join("file.ts").unwrap(),
+ temp_dir.url().join("file.ts").unwrap(),
],
}),
);
@@ -5366,20 +5367,20 @@ fn lsp_jsr_auto_import_completion() {
"command": "deno.cache",
"arguments": [
[],
- temp_dir.uri().join("main.ts").unwrap(),
+ temp_dir.url().join("main.ts").unwrap(),
],
}),
);
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": r#"add"#,
}
}));
let list = client.get_completion_list(
- temp_dir.uri().join("file.ts").unwrap(),
+ temp_dir.url().join("file.ts").unwrap(),
(0, 3),
json!({ "triggerKind": 1 }),
);
@@ -5446,20 +5447,20 @@ fn lsp_jsr_auto_import_completion_import_map() {
"command": "deno.cache",
"arguments": [
[],
- temp_dir.uri().join("main.ts").unwrap(),
+ temp_dir.url().join("main.ts").unwrap(),
],
}),
);
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": r#"add"#,
}
}));
let list = client.get_completion_list(
- temp_dir.uri().join("file.ts").unwrap(),
+ temp_dir.url().join("file.ts").unwrap(),
(0, 3),
json!({ "triggerKind": 1 }),
);
@@ -5523,13 +5524,13 @@ fn lsp_jsr_auto_import_completion_import_map_sub_path() {
"workspace/executeCommand",
json!({
"command": "deno.cache",
- "arguments": [[], file.uri()],
+ "arguments": [[], file.url()],
}),
);
client.read_diagnostics();
client.did_open_file(&file);
let list = client.get_completion_list(
- file.uri(),
+ file.url(),
(3, 15),
json!({ "triggerKind": 1 }),
);
@@ -5587,7 +5588,7 @@ fn lsp_jsr_code_action_missing_declaration() {
"workspace/executeCommand",
json!({
"command": "deno.cache",
- "arguments": [[], file.uri()],
+ "arguments": [[], file.url()],
}),
);
client.did_open_file(&file);
@@ -5595,7 +5596,7 @@ fn lsp_jsr_code_action_missing_declaration() {
"textDocument/codeAction",
json!({
"textDocument": {
- "uri": file.uri(),
+ "uri": file.url(),
},
"range": {
"start": { "line": 2, "character": 6 },
@@ -5648,7 +5649,7 @@ fn lsp_jsr_code_action_missing_declaration() {
"documentChanges": [
{
"textDocument": {
- "uri": file.uri(),
+ "uri": file.url(),
"version": 1,
},
"edits": [
@@ -5942,7 +5943,7 @@ fn lsp_cache_on_save() {
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": temp_dir.read_to_string("file.ts"),
@@ -5951,7 +5952,7 @@ fn lsp_cache_on_save() {
assert_eq!(
diagnostics.messages_with_source("deno"),
serde_json::from_value(json!({
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"diagnostics": [{
"range": {
"start": { "line": 1, "character": 33 },
@@ -5968,7 +5969,7 @@ fn lsp_cache_on_save() {
.unwrap()
);
client.did_save(json!({
- "textDocument": { "uri": temp_dir.uri().join("file.ts").unwrap() },
+ "textDocument": { "uri": temp_dir.url().join("file.ts").unwrap() },
}));
assert_eq!(client.read_diagnostics().all(), vec![]);
@@ -5987,7 +5988,7 @@ fn lsp_cache_then_definition() {
client.initialize_default();
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": r#"import "http://localhost:4545/run/002_hello.ts";"#,
@@ -6003,14 +6004,14 @@ fn lsp_cache_then_definition() {
"command": "deno.cache",
"arguments": [
["http://localhost:4545/run/002_hello.ts"],
- temp_dir.uri().join("file.ts").unwrap(),
+ temp_dir.url().join("file.ts").unwrap(),
],
}),
);
let res = client.write_request(
"textDocument/definition",
json!({
- "textDocument": { "uri": temp_dir.uri().join("file.ts").unwrap() },
+ "textDocument": { "uri": temp_dir.url().join("file.ts").unwrap() },
"position": { "line": 0, "character": 8 },
}),
);
@@ -6296,7 +6297,7 @@ fn lsp_code_actions_imports_dts() {
client.initialize_default();
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": r#"
@@ -6309,7 +6310,7 @@ fn lsp_code_actions_imports_dts() {
"textDocument/codeAction",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
},
"range": {
"start": { "line": 1, "character": 17 },
@@ -6339,7 +6340,7 @@ fn lsp_code_actions_imports_dts() {
"edit": {
"documentChanges": [{
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"version": 1,
},
"edits": [{
@@ -6601,7 +6602,7 @@ fn lsp_code_actions_imports_respects_fmt_config() {
client.initialize_default();
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file00.ts").unwrap(),
+ "uri": temp_dir.url().join("file00.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": temp_dir.read_to_string("file00.ts"),
@@ -6609,7 +6610,7 @@ fn lsp_code_actions_imports_respects_fmt_config() {
}));
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file01.ts").unwrap(),
+ "uri": temp_dir.url().join("file01.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": temp_dir.read_to_string("file01.ts"),
@@ -6620,7 +6621,7 @@ fn lsp_code_actions_imports_respects_fmt_config() {
"textDocument/codeAction",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("file00.ts").unwrap()
+ "uri": temp_dir.url().join("file00.ts").unwrap()
},
"range": {
"start": { "line": 0, "character": 0 },
@@ -6659,7 +6660,7 @@ fn lsp_code_actions_imports_respects_fmt_config() {
"edit": {
"documentChanges": [{
"textDocument": {
- "uri": temp_dir.uri().join("file00.ts").unwrap(),
+ "uri": temp_dir.url().join("file00.ts").unwrap(),
"version": 1
},
"edits": [{
@@ -6689,7 +6690,7 @@ fn lsp_code_actions_imports_respects_fmt_config() {
"message": "Cannot find name 'DuckConfigOptions'."
}],
"data": {
- "specifier": temp_dir.uri().join("file00.ts").unwrap(),
+ "specifier": temp_dir.url().join("file00.ts").unwrap(),
"fixId": "fixMissingImport"
}
}),
@@ -6712,7 +6713,7 @@ fn lsp_code_actions_imports_respects_fmt_config() {
"edit": {
"documentChanges": [{
"textDocument": {
- "uri": temp_dir.uri().join("file00.ts").unwrap(),
+ "uri": temp_dir.url().join("file00.ts").unwrap(),
"version": 1
},
"edits": [{
@@ -6725,7 +6726,7 @@ fn lsp_code_actions_imports_respects_fmt_config() {
}]
},
"data": {
- "specifier": temp_dir.uri().join("file00.ts").unwrap(),
+ "specifier": temp_dir.url().join("file00.ts").unwrap(),
"fixId": "fixMissingImport"
}
})
@@ -6770,7 +6771,7 @@ fn lsp_quote_style_from_workspace_settings() {
let code_action_params = json!({
"textDocument": {
- "uri": temp_dir.uri().join("file00.ts").unwrap(),
+ "uri": temp_dir.url().join("file00.ts").unwrap(),
},
"range": {
"start": { "line": 0, "character": 0 },
@@ -6812,7 +6813,7 @@ fn lsp_quote_style_from_workspace_settings() {
"edit": {
"documentChanges": [{
"textDocument": {
- "uri": temp_dir.uri().join("file00.ts").unwrap(),
+ "uri": temp_dir.url().join("file00.ts").unwrap(),
"version": null,
},
"edits": [{
@@ -6831,7 +6832,7 @@ fn lsp_quote_style_from_workspace_settings() {
temp_dir.write("./deno.json", json!({}).to_string());
client.did_change_watched_files(json!({
"changes": [{
- "uri": temp_dir.uri().join("deno.json").unwrap(),
+ "uri": temp_dir.url().join("deno.json").unwrap(),
"type": 1,
}],
}));
@@ -6856,7 +6857,7 @@ fn lsp_quote_style_from_workspace_settings() {
"edit": {
"documentChanges": [{
"textDocument": {
- "uri": temp_dir.uri().join("file00.ts").unwrap(),
+ "uri": temp_dir.url().join("file00.ts").unwrap(),
"version": null,
},
"edits": [{
@@ -7239,7 +7240,7 @@ fn lsp_completions_auto_import() {
client.initialize_default();
client.did_open(json!({
"textDocument": {
- "uri": "file:///a/🦕.ts",
+ "uri": Url::parse("file:///a/🦕.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "/**\n *\n * @example\n * ```ts\n * const result = add(1, 2);\n * console.log(result); // 3\n * ```\n *\n * @param {number} a - The first number\n * @param {number} b - The second number\n */\nexport function add(a: number, b: number) {\n return a + b;\n}",
@@ -7591,14 +7592,14 @@ fn lsp_completions_node_specifier() {
client.initialize_default();
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import fs from \"node:as\";\n",
},
}));
let list = client.get_completion_list(
- temp_dir.uri().join("file.ts").unwrap(),
+ temp_dir.url().join("file.ts").unwrap(),
(0, 23),
json!({
"triggerKind": 2,
@@ -7720,7 +7721,7 @@ fn lsp_infer_return_type() {
let res = client.write_request(
"textDocument/codeAction",
json!({
- "textDocument": { "uri": file.uri() },
+ "textDocument": { "uri": file.url() },
"range": {
"start": { "line": 1, "character": 15 },
"end": { "line": 1, "character": 18 },
@@ -7739,7 +7740,7 @@ fn lsp_infer_return_type() {
"kind": "refactor.rewrite.function.returnType",
"isPreferred": false,
"data": {
- "specifier": file.uri(),
+ "specifier": file.url(),
"range": {
"start": { "line": 1, "character": 15 },
"end": { "line": 1, "character": 18 },
@@ -7759,7 +7760,7 @@ fn lsp_infer_return_type() {
"kind": "refactor.rewrite.function.returnType",
"isPreferred": false,
"data": {
- "specifier": file.uri(),
+ "specifier": file.url(),
"range": {
"start": { "line": 1, "character": 15 },
"end": { "line": 1, "character": 18 },
@@ -7770,14 +7771,14 @@ fn lsp_infer_return_type() {
"edit": {
"documentChanges": [
{
- "textDocument": { "uri": file.uri(), "version": null },
+ "textDocument": { "uri": file.url(), "version": null },
"edits": [
{
"range": {
"start": { "line": 1, "character": 20 },
"end": { "line": 1, "character": 20 },
},
- "newText": format!(": import(\"{}\").SomeInterface", types_file.uri()),
+ "newText": format!(": import(\"{}\").SomeInterface", types_file.url()),
},
],
},
@@ -7810,7 +7811,7 @@ fn lsp_npm_types_nested_js_dts() {
"workspace/executeCommand",
json!({
"command": "deno.cache",
- "arguments": [[], file.uri()],
+ "arguments": [[], file.url()],
}),
);
let diagnostics = client.did_open_file(&file);
@@ -7891,7 +7892,7 @@ fn lsp_npm_always_caches() {
// create the lsp and cache a different npm specifier
let mut client = context.new_lsp_command().build();
client.initialize_default();
- let opened_file_uri = temp_dir_path.join("file.ts").uri_file();
+ let opened_file_uri = temp_dir_path.join("file.ts").url_file();
client.did_open(
json!({
"textDocument": {
@@ -7914,7 +7915,7 @@ fn lsp_npm_always_caches() {
);
// now open a new file and chalk should be working
- let new_file_uri = temp_dir_path.join("new_file.ts").uri_file();
+ let new_file_uri = temp_dir_path.join("new_file.ts").url_file();
client.did_open(json!({
"textDocument": {
"uri": new_file_uri,
@@ -8003,7 +8004,7 @@ fn lsp_completions_auto_import_and_quick_fix_with_import_map() {
client.did_open(
json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": concat!(
@@ -8030,7 +8031,7 @@ fn lsp_completions_auto_import_and_quick_fix_with_import_map() {
"npm:chalk@~5",
"http://localhost:4545/subdir/print_hello.ts",
],
- temp_dir.uri().join("file.ts").unwrap(),
+ temp_dir.url().join("file.ts").unwrap(),
],
}),
);
@@ -8038,14 +8039,14 @@ fn lsp_completions_auto_import_and_quick_fix_with_import_map() {
// try auto-import with path
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("a.ts").unwrap(),
+ "uri": temp_dir.url().join("a.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "getClie",
}
}));
let list = client.get_completion_list(
- temp_dir.uri().join("a.ts").unwrap(),
+ temp_dir.url().join("a.ts").unwrap(),
(0, 7),
json!({ "triggerKind": 1 }),
);
@@ -8086,7 +8087,7 @@ fn lsp_completions_auto_import_and_quick_fix_with_import_map() {
// try quick fix with path
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("b.ts").unwrap(),
+ "uri": temp_dir.url().join("b.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "getClient",
@@ -8094,7 +8095,7 @@ fn lsp_completions_auto_import_and_quick_fix_with_import_map() {
}));
let diagnostics = diagnostics
.messages_with_file_and_source(
- temp_dir.uri().join("b.ts").unwrap().as_str(),
+ temp_dir.url().join("b.ts").unwrap().as_str(),
"deno-ts",
)
.diagnostics;
@@ -8102,7 +8103,7 @@ fn lsp_completions_auto_import_and_quick_fix_with_import_map() {
"textDocument/codeAction",
json!(json!({
"textDocument": {
- "uri": temp_dir.uri().join("b.ts").unwrap()
+ "uri": temp_dir.url().join("b.ts").unwrap()
},
"range": {
"start": { "line": 0, "character": 0 },
@@ -8134,7 +8135,7 @@ fn lsp_completions_auto_import_and_quick_fix_with_import_map() {
"edit": {
"documentChanges": [{
"textDocument": {
- "uri": temp_dir.uri().join("b.ts").unwrap(),
+ "uri": temp_dir.url().join("b.ts").unwrap(),
"version": 1,
},
"edits": [{
@@ -8152,7 +8153,7 @@ fn lsp_completions_auto_import_and_quick_fix_with_import_map() {
// try auto-import without path
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("c.ts").unwrap(),
+ "uri": temp_dir.url().join("c.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "chal",
@@ -8160,7 +8161,7 @@ fn lsp_completions_auto_import_and_quick_fix_with_import_map() {
}));
let list = client.get_completion_list(
- temp_dir.uri().join("c.ts").unwrap(),
+ temp_dir.url().join("c.ts").unwrap(),
(0, 4),
json!({ "triggerKind": 1 }),
);
@@ -8199,7 +8200,7 @@ fn lsp_completions_auto_import_and_quick_fix_with_import_map() {
// try quick fix without path
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("d.ts").unwrap(),
+ "uri": temp_dir.url().join("d.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "chalk",
@@ -8207,7 +8208,7 @@ fn lsp_completions_auto_import_and_quick_fix_with_import_map() {
}));
let diagnostics = diagnostics
.messages_with_file_and_source(
- temp_dir.uri().join("d.ts").unwrap().as_str(),
+ temp_dir.url().join("d.ts").unwrap().as_str(),
"deno-ts",
)
.diagnostics;
@@ -8215,7 +8216,7 @@ fn lsp_completions_auto_import_and_quick_fix_with_import_map() {
"textDocument/codeAction",
json!(json!({
"textDocument": {
- "uri": temp_dir.uri().join("d.ts").unwrap()
+ "uri": temp_dir.url().join("d.ts").unwrap()
},
"range": {
"start": { "line": 0, "character": 0 },
@@ -8247,7 +8248,7 @@ fn lsp_completions_auto_import_and_quick_fix_with_import_map() {
"edit": {
"documentChanges": [{
"textDocument": {
- "uri": temp_dir.uri().join("d.ts").unwrap(),
+ "uri": temp_dir.url().join("d.ts").unwrap(),
"version": 1,
},
"edits": [{
@@ -8265,7 +8266,7 @@ fn lsp_completions_auto_import_and_quick_fix_with_import_map() {
// try auto-import with http import map
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("e.ts").unwrap(),
+ "uri": temp_dir.url().join("e.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "printH",
@@ -8273,7 +8274,7 @@ fn lsp_completions_auto_import_and_quick_fix_with_import_map() {
}));
let list = client.get_completion_list(
- temp_dir.uri().join("e.ts").unwrap(),
+ temp_dir.url().join("e.ts").unwrap(),
(0, 6),
json!({ "triggerKind": 1 }),
);
@@ -8312,7 +8313,7 @@ fn lsp_completions_auto_import_and_quick_fix_with_import_map() {
// try quick fix with http import
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("f.ts").unwrap(),
+ "uri": temp_dir.url().join("f.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "printHello",
@@ -8320,7 +8321,7 @@ fn lsp_completions_auto_import_and_quick_fix_with_import_map() {
}));
let diagnostics = diagnostics
.messages_with_file_and_source(
- temp_dir.uri().join("f.ts").unwrap().as_str(),
+ temp_dir.url().join("f.ts").unwrap().as_str(),
"deno-ts",
)
.diagnostics;
@@ -8328,7 +8329,7 @@ fn lsp_completions_auto_import_and_quick_fix_with_import_map() {
"textDocument/codeAction",
json!(json!({
"textDocument": {
- "uri": temp_dir.uri().join("f.ts").unwrap()
+ "uri": temp_dir.url().join("f.ts").unwrap()
},
"range": {
"start": { "line": 0, "character": 0 },
@@ -8360,7 +8361,7 @@ fn lsp_completions_auto_import_and_quick_fix_with_import_map() {
"edit": {
"documentChanges": [{
"textDocument": {
- "uri": temp_dir.uri().join("f.ts").unwrap(),
+ "uri": temp_dir.url().join("f.ts").unwrap(),
"version": 1,
},
"edits": [{
@@ -8378,14 +8379,14 @@ fn lsp_completions_auto_import_and_quick_fix_with_import_map() {
// try auto-import with npm package with sub-path on value side of import map
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("nested_path.ts").unwrap(),
+ "uri": temp_dir.url().join("nested_path.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "entry",
}
}));
let list = client.get_completion_list(
- temp_dir.uri().join("nested_path.ts").unwrap(),
+ temp_dir.url().join("nested_path.ts").unwrap(),
(0, 5),
json!({ "triggerKind": 1 }),
);
@@ -8763,7 +8764,7 @@ fn lsp_npm_specifier_unopened_file() {
// open main.ts, which imports other.ts (unopened)
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("main.ts").unwrap(),
+ "uri": temp_dir.url().join("main.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import { chalk } from './other.ts';\n\n",
@@ -8774,7 +8775,7 @@ fn lsp_npm_specifier_unopened_file() {
"textDocument/didChange",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("main.ts").unwrap(),
+ "uri": temp_dir.url().join("main.ts").unwrap(),
"version": 2
},
"contentChanges": [
@@ -8792,7 +8793,7 @@ fn lsp_npm_specifier_unopened_file() {
// now ensure completions work
let list = client.get_completion_list(
- temp_dir.uri().join("main.ts").unwrap(),
+ temp_dir.url().join("main.ts").unwrap(),
(2, 6),
json!({
"triggerKind": 2,
@@ -9042,7 +9043,7 @@ fn lsp_completions_node_specifier_node_modules_dir() {
client.initialize_default();
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import fs from \"node:fs\";\n",
@@ -9052,14 +9053,14 @@ fn lsp_completions_node_specifier_node_modules_dir() {
"workspace/executeCommand",
json!({
"command": "deno.cache",
- "arguments": [[], temp_dir.uri().join("file.ts").unwrap()],
+ "arguments": [[], temp_dir.url().join("file.ts").unwrap()],
}),
);
client.write_notification(
"textDocument/didChange",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"version": 2,
},
"contentChanges": [
@@ -9074,7 +9075,7 @@ fn lsp_completions_node_specifier_node_modules_dir() {
}),
);
let list = client.get_completion_list(
- temp_dir.uri().join("file.ts").unwrap(),
+ temp_dir.url().join("file.ts").unwrap(),
(1, 3),
json!({
"triggerKind": 2,
@@ -9478,7 +9479,7 @@ fn lsp_npmrc() {
"workspace/executeCommand",
json!({
"command": "deno.cache",
- "arguments": [[], file.uri()],
+ "arguments": [[], file.url()],
}),
);
let diagnostics = client.did_open_file(&file);
@@ -9538,7 +9539,7 @@ fn lsp_diagnostics_warn_redirect() {
assert_eq!(
diagnostics.messages_with_source("deno"),
lsp::PublishDiagnosticsParams {
- uri: Url::parse("file:///a/file.ts").unwrap(),
+ uri: lsp::Uri::from_str("file:///a/file.ts").unwrap(),
diagnostics: vec![
lsp::Diagnostic {
range: lsp::Range {
@@ -9688,7 +9689,7 @@ fn lsp_lockfile_redirect_resolution() {
client.initialize_default();
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import \"http://localhost:4545/subdir/mod1.ts\";\n",
@@ -9698,14 +9699,14 @@ fn lsp_lockfile_redirect_resolution() {
"workspace/executeCommand",
json!({
"command": "deno.cache",
- "arguments": [[], temp_dir.uri().join("file.ts").unwrap()],
+ "arguments": [[], temp_dir.url().join("file.ts").unwrap()],
}),
);
client.read_diagnostics();
let res = client.write_request(
"textDocument/definition",
json!({
- "textDocument": { "uri": temp_dir.uri().join("file.ts").unwrap() },
+ "textDocument": { "uri": temp_dir.url().join("file.ts").unwrap() },
"position": { "line": 0, "character": 7 },
}),
);
@@ -9829,7 +9830,7 @@ fn lsp_root_with_global_reference_types() {
"workspace/executeCommand",
json!({
"command": "deno.cache",
- "arguments": [[], file2.uri()],
+ "arguments": [[], file2.url()],
}),
);
let diagnostics = client.did_open_file(&file);
@@ -9922,7 +9923,7 @@ fn lsp_ts_diagnostics_refresh_on_lsp_version_reset() {
client.initialize_default();
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": temp_dir.read_to_string("file.ts"),
@@ -9933,7 +9934,7 @@ fn lsp_ts_diagnostics_refresh_on_lsp_version_reset() {
"textDocument/didClose",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
},
}),
);
@@ -9942,7 +9943,7 @@ fn lsp_ts_diagnostics_refresh_on_lsp_version_reset() {
// diagnostics are still refreshed.
client.did_open_raw(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "",
@@ -9951,7 +9952,7 @@ fn lsp_ts_diagnostics_refresh_on_lsp_version_reset() {
temp_dir.write("file.ts", r#""#);
client.did_save(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
},
}));
let diagnostics = client.read_diagnostics();
@@ -9978,7 +9979,7 @@ fn lsp_diagnostics_none_for_resolving_types() {
// run in Deno or Node.
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": context.temp_dir().path().join("file.ts").uri_file(),
+ "uri": context.temp_dir().path().join("file.ts").url_file(),
"languageId": "typescript",
"version": 1,
"text": concat!(
@@ -10292,7 +10293,7 @@ fn lsp_format_exclude_with_config() {
builder.set_config("./deno.fmt.jsonc");
});
- let file_uri = temp_dir.uri().join("ignored.ts").unwrap();
+ let file_uri = temp_dir.url().join("ignored.ts").unwrap();
client.did_open(json!({
"textDocument": {
"uri": file_uri,
@@ -10345,7 +10346,7 @@ fn lsp_format_exclude_default_config() {
builder.set_config("./deno.fmt.jsonc");
});
- let file_uri = temp_dir.uri().join("ignored.ts").unwrap();
+ let file_uri = temp_dir.url().join("ignored.ts").unwrap();
client.did_open(json!({
"textDocument": {
"uri": file_uri,
@@ -10383,7 +10384,7 @@ fn lsp_format_json() {
"textDocument/formatting",
json!({
"textDocument": {
- "uri": json_file.uri(),
+ "uri": json_file.url(),
},
"options": {
"tabSize": 2,
@@ -10433,7 +10434,7 @@ fn lsp_format_editor_options() {
"textDocument/formatting",
json!({
"textDocument": {
- "uri": file.uri(),
+ "uri": file.url(),
},
"options": {
"tabSize": 4,
@@ -10457,7 +10458,7 @@ fn lsp_format_editor_options() {
"textDocument/formatting",
json!({
"textDocument": {
- "uri": file.uri(),
+ "uri": file.url(),
},
"options": {
"tabSize": 2,
@@ -10534,7 +10535,7 @@ fn lsp_json_import_with_query_string() {
client.initialize_default();
client.did_open_raw(json!({
"textDocument": {
- "uri": temp_dir.uri().join("data.json").unwrap(),
+ "uri": temp_dir.url().join("data.json").unwrap(),
"languageId": "json",
"version": 1,
"text": temp_dir.read_to_string("data.json"),
@@ -10542,7 +10543,7 @@ fn lsp_json_import_with_query_string() {
}));
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("main.ts").unwrap(),
+ "uri": temp_dir.url().join("main.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": temp_dir.read_to_string("main.ts"),
@@ -10565,7 +10566,7 @@ fn lsp_format_markdown() {
"textDocument/formatting",
json!({
"textDocument": {
- "uri": markdown_file.uri()
+ "uri": markdown_file.url()
},
"options": {
"tabSize": 2,
@@ -10625,7 +10626,7 @@ fn lsp_format_with_config() {
.did_open(
json!({
"textDocument": {
- "uri": ts_file.uri_file(),
+ "uri": ts_file.url_file(),
"languageId": "typescript",
"version": 1,
"text": "export async function someVeryLongFunctionName() {\nconst response = fetch(\"http://localhost:4545/some/non/existent/path.json\");\nconsole.log(response.text());\nconsole.log(\"finished!\")\n}"
@@ -10638,7 +10639,7 @@ fn lsp_format_with_config() {
"textDocument/formatting",
json!({
"textDocument": {
- "uri": ts_file.uri_file()
+ "uri": ts_file.url_file()
},
"options": {
"tabSize": 2,
@@ -11548,7 +11549,7 @@ fn lsp_lint_with_config() {
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "// TODO: fixme\nexport async function non_camel_case() {\nconsole.log(\"finished!\")\n}"
@@ -11691,7 +11692,7 @@ fn lsp_jsx_import_source_config_file_automatic_cache() {
client.initialize_default();
let mut diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.tsx").unwrap(),
+ "uri": temp_dir.url().join("file.tsx").unwrap(),
"languageId": "typescriptreact",
"version": 1,
"text": "
@@ -11710,7 +11711,7 @@ fn lsp_jsx_import_source_config_file_automatic_cache() {
// reason. Force it with this notification.
diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.tsx").unwrap(),
+ "uri": temp_dir.url().join("file.tsx").unwrap(),
"languageId": "typescriptreact",
"version": 1,
"text": "
@@ -11762,7 +11763,7 @@ fn lsp_jsx_import_source_byonm_preact() {
let res = client.write_request(
"textDocument/hover",
json!({
- "textDocument": { "uri": file.uri() },
+ "textDocument": { "uri": file.url() },
"position": { "line": 0, "character": 1 },
}),
);
@@ -11907,7 +11908,7 @@ Deno.test({
"#;
temp_dir.write("./test.ts", contents);
temp_dir.write("./deno.jsonc", "{}");
- let specifier = temp_dir.uri().join("test.ts").unwrap();
+ let specifier = temp_dir.url().join("test.ts").unwrap();
let mut client = context.new_lsp_command().build();
client.initialize_default();
@@ -11925,7 +11926,7 @@ Deno.test({
client.read_notification_with_method::<Value>("deno/testModule");
let params: TestModuleNotificationParams =
serde_json::from_value(notification.unwrap()).unwrap();
- assert_eq!(params.text_document.uri, specifier);
+ assert_eq!(params.text_document.uri.as_str(), specifier.as_str());
assert_eq!(params.kind, TestModuleNotificationKind::Replace);
assert_eq!(params.label, "test.ts");
assert_eq!(params.tests.len(), 1);
@@ -11970,7 +11971,10 @@ Deno.test({
}),
);
assert_eq!(res.enqueued.len(), 1);
- assert_eq!(res.enqueued[0].text_document.uri, specifier);
+ assert_eq!(
+ res.enqueued[0].text_document.uri.as_str(),
+ specifier.as_str()
+ );
assert_eq!(res.enqueued[0].ids.len(), 1);
let id = res.enqueued[0].ids[0].clone();
let notification =
@@ -12119,7 +12123,7 @@ Deno.test({
"textDocument/didChange",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("test.ts").unwrap(),
+ "uri": temp_dir.url().join("test.ts").unwrap(),
"version": 2
},
"contentChanges": [{ "text": "" }],
@@ -12134,7 +12138,7 @@ Deno.test({
notification,
Some(json!({
"textDocument": {
- "uri": temp_dir.uri().join("test.ts").unwrap()
+ "uri": temp_dir.url().join("test.ts").unwrap()
}
}))
);
@@ -12151,7 +12155,7 @@ fn lsp_closed_file_find_references() {
"./mod.test.ts",
"import { a } from './mod.ts'; console.log(a);",
);
- let temp_dir_url = temp_dir.uri();
+ let temp_dir_url = temp_dir.url();
let mut client = context.new_lsp_command().build();
client.initialize_default();
client.did_open(json!({
@@ -12206,7 +12210,7 @@ fn lsp_closed_file_find_references_low_document_pre_load() {
"./sub_dir/mod.test.ts",
"import { a } from './mod.ts'; console.log(a);",
);
- let temp_dir_url = temp_dir.uri();
+ let temp_dir_url = temp_dir.url();
let mut client = context.new_lsp_command().build();
client.initialize(|builder| {
builder.set_preload_limit(1);
@@ -12264,7 +12268,7 @@ fn lsp_closed_file_find_references_excluded_path() {
]
}"#,
);
- let temp_dir_url = temp_dir.uri();
+ let temp_dir_url = temp_dir.url();
let mut client = context.new_lsp_command().build();
client.initialize_default();
client.did_open(json!({
@@ -12306,7 +12310,7 @@ fn lsp_data_urls_with_jsx_compiler_option() {
let mut client = context.new_lsp_command().build();
client.initialize_default();
- let uri = temp_dir.uri().join("main.ts").unwrap();
+ let uri = temp_dir.url().join("main.ts").unwrap();
let diagnostics = client.did_open(json!({
"textDocument": {
@@ -12372,7 +12376,7 @@ fn lsp_node_modules_dir() {
let mut client = context.new_lsp_command().build();
client.initialize_default();
- let file_uri = temp_dir.uri().join("file.ts").unwrap();
+ let file_uri = temp_dir.url().join("file.ts").unwrap();
client.did_open(json!({
"textDocument": {
"uri": file_uri,
@@ -12492,7 +12496,7 @@ fn lsp_vendor_dir() {
let mut client = context.new_lsp_command().build();
client.initialize_default();
- let local_file_uri = temp_dir.uri().join("file.ts").unwrap();
+ let local_file_uri = temp_dir.url().join("file.ts").unwrap();
client.did_open(json!({
"textDocument": {
"uri": local_file_uri,
@@ -12596,7 +12600,7 @@ fn lsp_vendor_dir() {
let file_path = temp_dir
.path()
.join("vendor/http_localhost_4545/subdir/mod1.ts");
- let remote_file_uri = file_path.uri_file();
+ let remote_file_uri = file_path.url_file();
assert_eq!(uri, remote_file_uri.as_str());
let file_text = file_path.read_to_string();
@@ -12757,7 +12761,7 @@ fn lsp_deno_json_scopes_import_map() {
client.initialize_default();
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("project1/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import \"foo\";\n",
@@ -12767,7 +12771,7 @@ fn lsp_deno_json_scopes_import_map() {
"textDocument/hover",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("project1/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/file.ts").unwrap(),
},
"position": { "line": 0, "character": 7 },
}),
@@ -12777,7 +12781,7 @@ fn lsp_deno_json_scopes_import_map() {
json!({
"contents": {
"kind": "markdown",
- "value": format!("**Resolved Dependency**\n\n**Code**: file&#8203;{}\n", temp_dir.uri().join("project1/foo1.ts").unwrap().as_str().trim_start_matches("file")),
+ "value": format!("**Resolved Dependency**\n\n**Code**: file&#8203;{}\n", temp_dir.url().join("project1/foo1.ts").unwrap().as_str().trim_start_matches("file")),
},
"range": {
"start": { "line": 0, "character": 7 },
@@ -12787,7 +12791,7 @@ fn lsp_deno_json_scopes_import_map() {
);
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("project2/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project2/file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import \"foo\";\n",
@@ -12797,7 +12801,7 @@ fn lsp_deno_json_scopes_import_map() {
"textDocument/hover",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("project2/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project2/file.ts").unwrap(),
},
"position": { "line": 0, "character": 7 },
}),
@@ -12807,7 +12811,7 @@ fn lsp_deno_json_scopes_import_map() {
json!({
"contents": {
"kind": "markdown",
- "value": format!("**Resolved Dependency**\n\n**Code**: file&#8203;{}\n", temp_dir.uri().join("project2/foo2.ts").unwrap().as_str().trim_start_matches("file")),
+ "value": format!("**Resolved Dependency**\n\n**Code**: file&#8203;{}\n", temp_dir.url().join("project2/foo2.ts").unwrap().as_str().trim_start_matches("file")),
},
"range": {
"start": { "line": 0, "character": 7 },
@@ -12817,7 +12821,7 @@ fn lsp_deno_json_scopes_import_map() {
);
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("project2/project3/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project2/project3/file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import \"foo\";\n",
@@ -12827,7 +12831,7 @@ fn lsp_deno_json_scopes_import_map() {
"textDocument/hover",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("project2/project3/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project2/project3/file.ts").unwrap(),
},
"position": { "line": 0, "character": 7 },
}),
@@ -12837,7 +12841,7 @@ fn lsp_deno_json_scopes_import_map() {
json!({
"contents": {
"kind": "markdown",
- "value": format!("**Resolved Dependency**\n\n**Code**: file&#8203;{}\n", temp_dir.uri().join("project2/project3/foo3.ts").unwrap().as_str().trim_start_matches("file")),
+ "value": format!("**Resolved Dependency**\n\n**Code**: file&#8203;{}\n", temp_dir.url().join("project2/project3/foo3.ts").unwrap().as_str().trim_start_matches("file")),
},
"range": {
"start": { "line": 0, "character": 7 },
@@ -12882,7 +12886,7 @@ fn lsp_deno_json_scopes_vendor_dir() {
client.initialize_default();
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("project1/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import \"http://localhost:4545/subdir/mod1.ts\";\n",
@@ -12892,14 +12896,14 @@ fn lsp_deno_json_scopes_vendor_dir() {
"workspace/executeCommand",
json!({
"command": "deno.cache",
- "arguments": [[], temp_dir.uri().join("project1/file.ts").unwrap()],
+ "arguments": [[], temp_dir.url().join("project1/file.ts").unwrap()],
}),
);
let res = client.write_request(
"textDocument/definition",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("project1/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/file.ts").unwrap(),
},
"position": { "line": 0, "character": 7 },
}),
@@ -12907,7 +12911,7 @@ fn lsp_deno_json_scopes_vendor_dir() {
assert_eq!(
res,
json!([{
- "targetUri": temp_dir.uri().join("project1/vendor/http_localhost_4545/subdir/mod1.ts").unwrap(),
+ "targetUri": temp_dir.url().join("project1/vendor/http_localhost_4545/subdir/mod1.ts").unwrap(),
"targetRange": {
"start": {
"line": 0,
@@ -12932,7 +12936,7 @@ fn lsp_deno_json_scopes_vendor_dir() {
);
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("project2/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project2/file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import \"http://localhost:4545/subdir/mod2.ts\";\n",
@@ -12942,14 +12946,14 @@ fn lsp_deno_json_scopes_vendor_dir() {
"workspace/executeCommand",
json!({
"command": "deno.cache",
- "arguments": [[], temp_dir.uri().join("project2/file.ts").unwrap()],
+ "arguments": [[], temp_dir.url().join("project2/file.ts").unwrap()],
}),
);
let res = client.write_request(
"textDocument/definition",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("project2/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project2/file.ts").unwrap(),
},
"position": { "line": 0, "character": 7 },
}),
@@ -12957,7 +12961,7 @@ fn lsp_deno_json_scopes_vendor_dir() {
assert_eq!(
res,
json!([{
- "targetUri": temp_dir.uri().join("project2/vendor/http_localhost_4545/subdir/mod2.ts").unwrap(),
+ "targetUri": temp_dir.url().join("project2/vendor/http_localhost_4545/subdir/mod2.ts").unwrap(),
"targetRange": {
"start": {
"line": 0,
@@ -12982,7 +12986,7 @@ fn lsp_deno_json_scopes_vendor_dir() {
);
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("project2/project3/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project2/project3/file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import \"http://localhost:4545/subdir/mod3.js\";\n",
@@ -12992,14 +12996,14 @@ fn lsp_deno_json_scopes_vendor_dir() {
"workspace/executeCommand",
json!({
"command": "deno.cache",
- "arguments": [[], temp_dir.uri().join("project2/project3/file.ts").unwrap()],
+ "arguments": [[], temp_dir.url().join("project2/project3/file.ts").unwrap()],
}),
);
let res = client.write_request(
"textDocument/definition",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("project2/project3/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project2/project3/file.ts").unwrap(),
},
"position": { "line": 0, "character": 7 },
}),
@@ -13007,7 +13011,7 @@ fn lsp_deno_json_scopes_vendor_dir() {
assert_eq!(
res,
json!([{
- "targetUri": temp_dir.uri().join("project2/project3/vendor/http_localhost_4545/subdir/mod3.js").unwrap(),
+ "targetUri": temp_dir.url().join("project2/project3/vendor/http_localhost_4545/subdir/mod3.js").unwrap(),
"targetRange": {
"start": {
"line": 0,
@@ -13067,7 +13071,7 @@ fn lsp_deno_json_scopes_node_modules_dir() {
client.initialize_default();
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("project1/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import \"npm:@denotest/add@1\";\n",
@@ -13077,14 +13081,14 @@ fn lsp_deno_json_scopes_node_modules_dir() {
"workspace/executeCommand",
json!({
"command": "deno.cache",
- "arguments": [[], temp_dir.uri().join("project1/file.ts").unwrap()],
+ "arguments": [[], temp_dir.url().join("project1/file.ts").unwrap()],
}),
);
let res = client.write_request(
"textDocument/definition",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("project1/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/file.ts").unwrap(),
},
"position": { "line": 0, "character": 7 },
}),
@@ -13120,7 +13124,7 @@ fn lsp_deno_json_scopes_node_modules_dir() {
);
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("project2/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project2/file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import \"npm:@denotest/add@1\";\n",
@@ -13130,14 +13134,14 @@ fn lsp_deno_json_scopes_node_modules_dir() {
"workspace/executeCommand",
json!({
"command": "deno.cache",
- "arguments": [[], temp_dir.uri().join("project2/file.ts").unwrap()],
+ "arguments": [[], temp_dir.url().join("project2/file.ts").unwrap()],
}),
);
let res = client.write_request(
"textDocument/definition",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("project2/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project2/file.ts").unwrap(),
},
"position": { "line": 0, "character": 7 },
}),
@@ -13170,7 +13174,7 @@ fn lsp_deno_json_scopes_node_modules_dir() {
);
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("project2/project3/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project2/project3/file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import \"npm:@denotest/add@1\";\n",
@@ -13180,14 +13184,14 @@ fn lsp_deno_json_scopes_node_modules_dir() {
"workspace/executeCommand",
json!({
"command": "deno.cache",
- "arguments": [[], temp_dir.uri().join("project2/project3/file.ts").unwrap()],
+ "arguments": [[], temp_dir.url().join("project2/project3/file.ts").unwrap()],
}),
);
let res = client.write_request(
"textDocument/definition",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("project2/project3/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project2/project3/file.ts").unwrap(),
},
"position": { "line": 0, "character": 7 },
}),
@@ -13241,7 +13245,7 @@ fn lsp_deno_json_scopes_ts_config() {
client.initialize_default();
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("project1/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "Window;\nWorkerGlobalScope;\n",
@@ -13249,7 +13253,7 @@ fn lsp_deno_json_scopes_ts_config() {
}));
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("project2/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project2/file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "Window;\nWorkerGlobalScope;\n",
@@ -13259,7 +13263,7 @@ fn lsp_deno_json_scopes_ts_config() {
json!(diagnostics.all_messages()),
json!([
{
- "uri": temp_dir.uri().join("project2/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project2/file.ts").unwrap(),
"version": 1,
"diagnostics": [
{
@@ -13275,7 +13279,7 @@ fn lsp_deno_json_scopes_ts_config() {
],
},
{
- "uri": temp_dir.uri().join("project1/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/file.ts").unwrap(),
"version": 1,
"diagnostics": [
{
@@ -13309,7 +13313,7 @@ fn lsp_deno_json_scopes_declaration_files() {
client.initialize_default();
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("project1/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "export const foo: Foo = 1;\nexport const bar: Bar = 1;\n",
@@ -13317,7 +13321,7 @@ fn lsp_deno_json_scopes_declaration_files() {
}));
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("project2/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project2/file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "export const foo: Foo = 1;\nexport const bar: Bar = 1;\n",
@@ -13327,7 +13331,7 @@ fn lsp_deno_json_scopes_declaration_files() {
json!(diagnostics.all_messages()),
json!([
{
- "uri": temp_dir.uri().join("project2/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project2/file.ts").unwrap(),
"version": 1,
"diagnostics": [
{
@@ -13343,7 +13347,7 @@ fn lsp_deno_json_scopes_declaration_files() {
],
},
{
- "uri": temp_dir.uri().join("project1/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/file.ts").unwrap(),
"version": 1,
"diagnostics": [
{
@@ -13395,11 +13399,11 @@ fn lsp_deno_json_scopes_find_references() {
res,
json!([
{
- "uri": file1.uri(),
+ "uri": file1.url(),
"range": file1.range_of("foo"),
},
{
- "uri": file2.uri(),
+ "uri": file2.url(),
"range": file2.range_of("foo"),
},
]),
@@ -13427,8 +13431,8 @@ fn lsp_deno_json_scopes_file_rename_import_edits() {
json!({
"files": [
{
- "oldUri": file1.uri(),
- "newUri": file1.uri().join("file_renamed.ts").unwrap(),
+ "oldUri": file1.url(),
+ "newUri": file1.url().join("file_renamed.ts").unwrap(),
},
],
}),
@@ -13439,7 +13443,7 @@ fn lsp_deno_json_scopes_file_rename_import_edits() {
"documentChanges": [
{
"textDocument": {
- "uri": file2.uri(),
+ "uri": file2.url(),
"version": null,
},
"edits": [
@@ -13487,7 +13491,7 @@ fn lsp_deno_json_scopes_goto_implementations() {
res,
json!([
{
- "targetUri": file2.uri(),
+ "targetUri": file2.url(),
"targetRange": file2.range_of("export class SomeFoo implements Foo {}"),
"targetSelectionRange": file2.range_of("SomeFoo"),
},
@@ -13544,7 +13548,7 @@ fn lsp_deno_json_scopes_call_hierarchy() {
"name": "bar",
"kind": 12,
"detail": "",
- "uri": file2.uri(),
+ "uri": file2.url(),
"range": {
"start": { "line": 2, "character": 6 },
"end": { "line": 4, "character": 7 },
@@ -13564,7 +13568,7 @@ fn lsp_deno_json_scopes_call_hierarchy() {
"name": "file.ts",
"kind": 2,
"detail": "project3",
- "uri": file3.uri(),
+ "uri": file3.url(),
"range": {
"start": { "line": 1, "character": 6 },
"end": { "line": 3, "character": 4 },
@@ -13593,7 +13597,7 @@ fn lsp_deno_json_scopes_call_hierarchy() {
"name": "foo",
"kind": 12,
"detail": "",
- "uri": file1.uri(),
+ "uri": file1.url(),
"range": file1.range_of("export function foo() {}"),
"selectionRange": file1.range_of("foo"),
},
@@ -13641,7 +13645,7 @@ fn lsp_deno_json_scopes_rename_symbol() {
"documentChanges": [
{
"textDocument": {
- "uri": file1.uri(),
+ "uri": file1.url(),
"version": null,
},
"edits": [
@@ -13653,7 +13657,7 @@ fn lsp_deno_json_scopes_rename_symbol() {
},
{
"textDocument": {
- "uri": file2.uri(),
+ "uri": file2.url(),
"version": null,
},
"edits": [
@@ -13696,7 +13700,7 @@ fn lsp_deno_json_scopes_search_symbol() {
"name": "someSymbol1",
"kind": 13,
"location": {
- "uri": file1.uri(),
+ "uri": file1.url(),
"range": file1.range_of("someSymbol1 = 1"),
},
"containerName": "",
@@ -13705,7 +13709,7 @@ fn lsp_deno_json_scopes_search_symbol() {
"name": "someSymbol2",
"kind": 13,
"location": {
- "uri": file2.uri(),
+ "uri": file2.url(),
"range": file2.range_of("someSymbol2 = 2"),
},
"containerName": "",
@@ -13745,7 +13749,7 @@ fn lsp_deno_json_workspace_fmt_config() {
client.initialize_default();
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "console.log(\"\");\n",
@@ -13755,7 +13759,7 @@ fn lsp_deno_json_workspace_fmt_config() {
"textDocument/formatting",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
},
"options": {
"tabSize": 2,
@@ -13775,7 +13779,7 @@ fn lsp_deno_json_workspace_fmt_config() {
);
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("project1/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "console.log(\"\");\n",
@@ -13785,7 +13789,7 @@ fn lsp_deno_json_workspace_fmt_config() {
"textDocument/formatting",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("project1/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/file.ts").unwrap(),
},
"options": {
"tabSize": 2,
@@ -13807,7 +13811,7 @@ fn lsp_deno_json_workspace_fmt_config() {
// has no fmt field.
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("project2/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project2/file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "console.log(\"\");\n",
@@ -13817,7 +13821,7 @@ fn lsp_deno_json_workspace_fmt_config() {
"textDocument/formatting",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("project2/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project2/file.ts").unwrap(),
},
"options": {
"tabSize": 2,
@@ -13872,7 +13876,7 @@ fn lsp_deno_json_workspace_lint_config() {
client.initialize_default();
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": r#"
@@ -13885,7 +13889,7 @@ fn lsp_deno_json_workspace_lint_config() {
assert_eq!(
json!(diagnostics.messages_with_source("deno-lint")),
json!({
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"diagnostics": [{
"range": {
"start": { "line": 2, "character": 14 },
@@ -13903,13 +13907,13 @@ fn lsp_deno_json_workspace_lint_config() {
"textDocument/didClose",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
},
}),
);
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("project1/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": r#"
@@ -13922,7 +13926,7 @@ fn lsp_deno_json_workspace_lint_config() {
assert_eq!(
json!(diagnostics.messages_with_source("deno-lint")),
json!({
- "uri": temp_dir.uri().join("project1/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/file.ts").unwrap(),
"diagnostics": [{
"range": {
"start": { "line": 1, "character": 8 },
@@ -13949,7 +13953,7 @@ fn lsp_deno_json_workspace_lint_config() {
"textDocument/didClose",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("project1/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/file.ts").unwrap(),
},
}),
);
@@ -13957,7 +13961,7 @@ fn lsp_deno_json_workspace_lint_config() {
// has no lint field.
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("project2/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project2/file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": r#"
@@ -13970,7 +13974,7 @@ fn lsp_deno_json_workspace_lint_config() {
assert_eq!(
json!(diagnostics.messages_with_source("deno-lint")),
json!({
- "uri": temp_dir.uri().join("project2/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project2/file.ts").unwrap(),
"diagnostics": [{
"range": {
"start": { "line": 2, "character": 14 },
@@ -14021,7 +14025,7 @@ fn lsp_deno_json_workspace_import_map() {
{
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("project1/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import \"foo\";\n",
@@ -14031,7 +14035,7 @@ fn lsp_deno_json_workspace_import_map() {
"textDocument/hover",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("project1/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/file.ts").unwrap(),
},
"position": { "line": 0, "character": 7 },
}),
@@ -14041,7 +14045,7 @@ fn lsp_deno_json_workspace_import_map() {
json!({
"contents": {
"kind": "markdown",
- "value": format!("**Resolved Dependency**\n\n**Code**: file&#8203;{}\n", temp_dir.uri().join("project1/foo1.ts").unwrap().as_str().trim_start_matches("file")),
+ "value": format!("**Resolved Dependency**\n\n**Code**: file&#8203;{}\n", temp_dir.url().join("project1/foo1.ts").unwrap().as_str().trim_start_matches("file")),
},
"range": {
"start": { "line": 0, "character": 7 },
@@ -14055,7 +14059,7 @@ fn lsp_deno_json_workspace_import_map() {
{
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("project1/project2/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/project2/file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import \"foo\";\n",
@@ -14065,7 +14069,7 @@ fn lsp_deno_json_workspace_import_map() {
"textDocument/hover",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("project1/project2/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/project2/file.ts").unwrap(),
},
"position": { "line": 0, "character": 7 },
}),
@@ -14075,7 +14079,7 @@ fn lsp_deno_json_workspace_import_map() {
json!({
"contents": {
"kind": "markdown",
- "value": format!("**Resolved Dependency**\n\n**Code**: file&#8203;{}\n", temp_dir.uri().join("project1/project2/foo2.ts").unwrap().as_str().trim_start_matches("file")),
+ "value": format!("**Resolved Dependency**\n\n**Code**: file&#8203;{}\n", temp_dir.url().join("project1/project2/foo2.ts").unwrap().as_str().trim_start_matches("file")),
},
"range": {
"start": { "line": 0, "character": 7 },
@@ -14114,7 +14118,7 @@ fn lsp_workspace_lockfile() {
client.initialize_default();
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("project1/project2/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/project2/file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import \"http://localhost:4545/subdir/mod1.ts\";\n",
@@ -14124,14 +14128,14 @@ fn lsp_workspace_lockfile() {
"workspace/executeCommand",
json!({
"command": "deno.cache",
- "arguments": [[], temp_dir.uri().join("project1/project2/file.ts").unwrap()],
+ "arguments": [[], temp_dir.url().join("project1/project2/file.ts").unwrap()],
}),
);
client.read_diagnostics();
let res = client.write_request(
"textDocument/definition",
json!({
- "textDocument": { "uri": temp_dir.uri().join("project1/project2/file.ts").unwrap() },
+ "textDocument": { "uri": temp_dir.url().join("project1/project2/file.ts").unwrap() },
"position": { "line": 0, "character": 7 },
}),
);
@@ -14173,7 +14177,7 @@ fn lsp_deno_json_workspace_vendor_dir() {
client.initialize_default();
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("project1/project2/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/project2/file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import \"http://localhost:4545/subdir/mod1.ts\";\n",
@@ -14183,14 +14187,14 @@ fn lsp_deno_json_workspace_vendor_dir() {
"workspace/executeCommand",
json!({
"command": "deno.cache",
- "arguments": [[], temp_dir.uri().join("project1/project2/file.ts").unwrap()],
+ "arguments": [[], temp_dir.url().join("project1/project2/file.ts").unwrap()],
}),
);
let res = client.write_request(
"textDocument/definition",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("project1/project2/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/project2/file.ts").unwrap(),
},
"position": { "line": 0, "character": 7 },
}),
@@ -14198,7 +14202,7 @@ fn lsp_deno_json_workspace_vendor_dir() {
assert_eq!(
res,
json!([{
- "targetUri": temp_dir.uri().join("project1/vendor/http_localhost_4545/subdir/mod1.ts").unwrap(),
+ "targetUri": temp_dir.url().join("project1/vendor/http_localhost_4545/subdir/mod1.ts").unwrap(),
"targetRange": {
"start": {
"line": 0,
@@ -14245,7 +14249,7 @@ fn lsp_deno_json_workspace_node_modules_dir() {
client.initialize_default();
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("project1/project2/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/project2/file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import \"npm:@denotest/add@1\";\n",
@@ -14255,14 +14259,14 @@ fn lsp_deno_json_workspace_node_modules_dir() {
"workspace/executeCommand",
json!({
"command": "deno.cache",
- "arguments": [[], temp_dir.uri().join("project1/project2/file.ts").unwrap()],
+ "arguments": [[], temp_dir.url().join("project1/project2/file.ts").unwrap()],
}),
);
let res = client.write_request(
"textDocument/definition",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("project1/project2/file.ts").unwrap(),
+ "uri": temp_dir.url().join("project1/project2/file.ts").unwrap(),
},
"position": { "line": 0, "character": 7 },
}),
@@ -14326,7 +14330,7 @@ fn lsp_deno_json_workspace_jsr_resolution() {
client.initialize_default();
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import \"jsr:@org/project1@^1.0.0\";\n",
@@ -14336,7 +14340,7 @@ fn lsp_deno_json_workspace_jsr_resolution() {
"textDocument/hover",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
},
"position": { "line": 0, "character": 7 },
}),
@@ -14348,7 +14352,7 @@ fn lsp_deno_json_workspace_jsr_resolution() {
"kind": "markdown",
"value": format!(
"**Resolved Dependency**\n\n**Code**: file&#8203;://{}\n",
- temp_dir.uri().join("project1/mod.ts").unwrap().path(),
+ temp_dir.url().join("project1/mod.ts").unwrap().path(),
),
},
"range": {
@@ -14409,7 +14413,7 @@ fn lsp_npm_workspace() {
client.initialize_default();
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("packages/subtract/index.ts").unwrap(),
+ "uri": temp_dir.url().join("packages/subtract/index.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": "import { add } from 'add';\nexport function subtract(a: number, b: number): number { return add(a, -b); }",
@@ -14420,7 +14424,7 @@ fn lsp_npm_workspace() {
"textDocument/definition",
json!({
"textDocument": {
- "uri": temp_dir.uri().join("packages/subtract/index.ts").unwrap(),
+ "uri": temp_dir.url().join("packages/subtract/index.ts").unwrap(),
},
"position": { "line": 0, "character": 9 },
}),
@@ -14429,7 +14433,7 @@ fn lsp_npm_workspace() {
assert_eq!(
res,
json!([{
- "targetUri": temp_dir.uri().join("packages/add/index.ts").unwrap(),
+ "targetUri": temp_dir.url().join("packages/add/index.ts").unwrap(),
"targetRange": {
"start": {
"line": 0,
@@ -14463,7 +14467,7 @@ fn lsp_import_unstable_bare_node_builtins_auto_discovered() {
let contents = r#"import path from "path";"#;
temp_dir.write("main.ts", contents);
temp_dir.write("deno.json", r#"{ "unstable": ["bare-node-builtins"] }"#);
- let main_script = temp_dir.uri().join("main.ts").unwrap();
+ let main_script = temp_dir.url().join("main.ts").unwrap();
let mut client = context.new_lsp_command().capture_stderr().build();
client.initialize_default();
@@ -14559,7 +14563,7 @@ fn lsp_jupyter_byonm_diagnostics() {
context.run_npm("install");
let mut client = context.new_lsp_command().build();
client.initialize_default();
- let notebook_specifier = temp_dir.join("notebook.ipynb").uri_file();
+ let notebook_specifier = temp_dir.join("notebook.ipynb").url_file();
let notebook_specifier = format!(
"{}#abc",
notebook_specifier
@@ -14621,7 +14625,7 @@ fn lsp_deno_future_env_byonm() {
client.initialize_default();
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "uri": temp_dir.url().join("file.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": r#"
@@ -14670,11 +14674,11 @@ fn lsp_sloppy_imports() {
temp_dir.join("c.d.ts").write("export class C {}");
let mut client = context.new_lsp_command().build();
client.initialize(|builder| {
- builder.set_root_uri(temp_dir.uri_dir());
+ builder.set_root_uri(temp_dir.url_dir());
});
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.join("b.ts").uri_file(),
+ "uri": temp_dir.join("b.ts").url_file(),
"languageId": "typescript",
"version": 1,
"text": "export class B {}",
@@ -14682,7 +14686,7 @@ fn lsp_sloppy_imports() {
}));
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.join("c.js").uri_file(),
+ "uri": temp_dir.join("c.js").url_file(),
"languageId": "typescript",
"version": 1,
"text": "export class C {}",
@@ -14690,7 +14694,7 @@ fn lsp_sloppy_imports() {
}));
client.did_open(json!({
"textDocument": {
- "uri": temp_dir.join("c.d.ts").uri_file(),
+ "uri": temp_dir.join("c.d.ts").url_file(),
"languageId": "typescript",
"version": 1,
"text": "export class C {}",
@@ -14698,7 +14702,7 @@ fn lsp_sloppy_imports() {
}));
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.join("file.ts").uri_file(),
+ "uri": temp_dir.join("file.ts").url_file(),
"languageId": "typescript",
"version": 1,
"text": concat!(
@@ -14830,7 +14834,7 @@ fn lsp_sloppy_imports_prefers_dts() {
);
let diagnostics = client.did_open_file(&a_dts);
- assert_eq!(json!(diagnostics.for_file(&a_dts.uri())), json!([]));
+ assert_eq!(json!(diagnostics.for_file(&a_dts.url())), json!([]));
let response = client.write_request(
"textDocument/references",
@@ -14846,12 +14850,12 @@ fn lsp_sloppy_imports_prefers_dts() {
response,
json!([
{
- "uri": file.uri(),
+ "uri": file.url(),
// the import
"range": file.range_of("foo"),
},
{
- "uri": file.uri(),
+ "uri": file.url(),
// the usage
"range": file.range_of_nth(1, "foo"),
}
@@ -14871,11 +14875,11 @@ fn sloppy_imports_not_enabled() {
temp_dir.join("a.ts").write("export class A {}");
let mut client = context.new_lsp_command().build();
client.initialize(|builder| {
- builder.set_root_uri(temp_dir.uri_dir());
+ builder.set_root_uri(temp_dir.url_dir());
});
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.join("file.ts").uri_file(),
+ "uri": temp_dir.join("file.ts").url_file(),
"languageId": "typescript",
"version": 1,
"text": "import * as a from './a';\nconsole.log(a)\n",
@@ -14901,11 +14905,11 @@ fn sloppy_imports_not_enabled() {
source: Some("deno".to_string()),
message: format!(
"Unable to load a local module: {}\nMaybe add a '.ts' extension.",
- temp_dir.join("a").uri_file(),
+ temp_dir.join("a").url_file(),
),
data: Some(json!({
- "specifier": temp_dir.join("a").uri_file(),
- "to": temp_dir.join("a.ts").uri_file(),
+ "specifier": temp_dir.join("a").url_file(),
+ "to": temp_dir.join("a.ts").url_file(),
"message": "Add a '.ts' extension.",
})),
..Default::default()
@@ -14917,7 +14921,7 @@ fn sloppy_imports_not_enabled() {
"textDocument/codeAction",
json!({
"textDocument": {
- "uri": temp_dir.join("file.ts").uri_file()
+ "uri": temp_dir.join("file.ts").url_file()
},
"range": {
"start": { "line": 0, "character": 19 },
@@ -14934,11 +14938,11 @@ fn sloppy_imports_not_enabled() {
"source": "deno",
"message": format!(
"Unable to load a local module: {}\nMaybe add a '.ts' extension.",
- temp_dir.join("a").uri_file(),
+ temp_dir.join("a").url_file(),
),
"data": {
- "specifier": temp_dir.join("a").uri_file(),
- "to": temp_dir.join("a.ts").uri_file(),
+ "specifier": temp_dir.join("a").url_file(),
+ "to": temp_dir.join("a.ts").url_file(),
"message": "Add a '.ts' extension.",
},
}],
@@ -14961,17 +14965,17 @@ fn sloppy_imports_not_enabled() {
"source": "deno",
"message": format!(
"Unable to load a local module: {}\nMaybe add a '.ts' extension.",
- temp_dir.join("a").uri_file(),
+ temp_dir.join("a").url_file(),
),
"data": {
- "specifier": temp_dir.join("a").uri_file(),
- "to": temp_dir.join("a.ts").uri_file(),
+ "specifier": temp_dir.join("a").url_file(),
+ "to": temp_dir.join("a.ts").url_file(),
"message": "Add a '.ts' extension.",
},
}],
"edit": {
"changes": {
- temp_dir.join("file.ts").uri_file(): [{
+ temp_dir.join("file.ts").url_file(): [{
"range": {
"start": { "line": 0, "character": 19 },
"end": { "line": 0, "character": 24 }
@@ -15015,7 +15019,7 @@ fn lsp_byonm_js_import_resolves_to_dts() {
client.initialize_default();
let diagnostics = client.did_open(json!({
"textDocument": {
- "uri": temp_dir.uri().join("node_modules/postcss/lib/comment.d.ts").unwrap(),
+ "uri": temp_dir.url().join("node_modules/postcss/lib/comment.d.ts").unwrap(),
"languageId": "typescript",
"version": 1,
"text": temp_dir.path().join("node_modules/postcss/lib/comment.d.ts").read_to_string(),
@@ -15034,7 +15038,7 @@ fn decorators_tc39() {
let mut client = context.new_lsp_command().build();
client.initialize_default();
- let uri = temp_dir.uri().join("main.ts").unwrap();
+ let uri = temp_dir.url().join("main.ts").unwrap();
let diagnostics = client
.did_open(json!({
@@ -15085,7 +15089,7 @@ fn decorators_ts() {
let mut client = context.new_lsp_command().build();
client.initialize_default();
- let uri = temp_dir.uri().join("main.ts").unwrap();
+ let uri = temp_dir.url().join("main.ts").unwrap();
let diagnostics = client
.did_open(json!({
@@ -15189,13 +15193,13 @@ fn lsp_cjs_internal_types_default_export() {
);
client.did_open(json!({
"textDocument": {
- "uri": node_modules_index_d_ts.uri_file(),
+ "uri": node_modules_index_d_ts.url_file(),
"languageId": "typescript",
"version": 1,
"text": node_modules_index_d_ts.read_to_string(),
}
}));
- let main_url = temp_dir.path().join("main.ts").uri_file();
+ let main_url = temp_dir.path().join("main.ts").url_file();
let diagnostics = client.did_open(
json!({
"textDocument": {
@@ -15232,7 +15236,7 @@ fn lsp_cjs_import_dual() {
let mut client = context.new_lsp_command().build();
client.initialize_default();
- let main_url = temp_dir.path().join("main.ts").uri_file();
+ let main_url = temp_dir.path().join("main.ts").url_file();
let diagnostics = client.did_open(
json!({
"textDocument": {
@@ -15271,7 +15275,7 @@ fn lsp_ts_code_fix_any_param() {
let param_def = range_of("param", src);
- let main_url = temp_dir.path().join("main.ts").uri_file();
+ let main_url = temp_dir.path().join("main.ts").url_file();
let diagnostics = client.did_open(json!({
"textDocument": {
"uri": main_url,