From a6618dc01c890363bdbcc5f689389cbca1e8fb75 Mon Sep 17 00:00:00 2001 From: sigmaSd Date: Sat, 1 Oct 2022 19:02:25 +0100 Subject: [PATCH] lsp: use deno:/asset instead of deno:asset (#16023) Make offering "virtual documents" via the lsp easier to parse. `deno:` can be ambiguous to parse by editors (can conflict with linux paths) Neovim recently landed a PR https://github.com/neovim/neovim/pull/19797 that allows it to parse `scheme:/` this PR should make deno lsp work correctly in neovim --- cli/lsp/urls.rs | 2 +- cli/tests/integration/lsp_tests.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cli/lsp/urls.rs b/cli/lsp/urls.rs index e30a3c5d6c..9b14098ae8 100644 --- a/cli/lsp/urls.rs +++ b/cli/lsp/urls.rs @@ -101,7 +101,7 @@ impl LspUrlMap { specifier.clone() } else { let specifier_str = if specifier.scheme() == "asset" { - format!("deno:asset{}", specifier.path()) + format!("deno:/asset{}", specifier.path()) } else if specifier.scheme() == "data" { let data_url = DataUrl::process(specifier.as_str()) .map_err(|e| uri_error(format!("{:?}", e)))?; diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs index 1bc06991bf..130ffe7425 100644 --- a/cli/tests/integration/lsp_tests.rs +++ b/cli/tests/integration/lsp_tests.rs @@ -987,7 +987,7 @@ fn lsp_hover_asset() { "deno/virtualTextDocument", json!({ "textDocument": { - "uri": "deno:asset/lib.deno.shared_globals.d.ts" + "uri": "deno:/asset/lib.deno.shared_globals.d.ts" } }), ) @@ -998,7 +998,7 @@ fn lsp_hover_asset() { "textDocument/hover", json!({ "textDocument": { - "uri": "deno:asset/lib.es2015.symbol.wellknown.d.ts" + "uri": "deno:/asset/lib.es2015.symbol.wellknown.d.ts" }, "position": { "line": 109, @@ -2810,7 +2810,7 @@ fn lsp_code_lens_non_doc_nav_tree() { "deno/virtualTextDocument", json!({ "textDocument": { - "uri": "deno:asset/lib.deno.shared_globals.d.ts" + "uri": "deno:/asset/lib.deno.shared_globals.d.ts" } }), ) @@ -2822,7 +2822,7 @@ fn lsp_code_lens_non_doc_nav_tree() { "textDocument/codeLens", json!({ "textDocument": { - "uri": "deno:asset/lib.deno.shared_globals.d.ts" + "uri": "deno:/asset/lib.deno.shared_globals.d.ts" } }), )