diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-04-16 16:02:48 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-16 16:02:48 -0400 |
commit | 94744ae25a15723ee17d7ed975f3d69bc5441f88 (patch) | |
tree | 2e386d62ddda992584996558eeb8f34bc6b2ddd7 | |
parent | 02dd09a36ff25cff6627ce4c6966373f00d348df (diff) |
fix(lsp): ensure language server status works on unix (#18727)
Closes #18724
-rw-r--r-- | cli/lsp/urls.rs | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/cli/lsp/urls.rs b/cli/lsp/urls.rs index 905803da8..dee89c977 100644 --- a/cli/lsp/urls.rs +++ b/cli/lsp/urls.rs @@ -188,10 +188,14 @@ impl LspUrlMap { if let Some(specifier) = inner.get_specifier(url).cloned() { specifier } else { - let specifier = if let Ok(path) = url.to_file_path() { - match kind { - LspUrlKind::Folder => Url::from_directory_path(path).unwrap(), - LspUrlKind::File => Url::from_file_path(path).unwrap(), + let specifier = if url.scheme() == "file" { + if let Ok(path) = url.to_file_path() { + match kind { + LspUrlKind::Folder => Url::from_directory_path(path).unwrap(), + LspUrlKind::File => Url::from_file_path(path).unwrap(), + } + } else { + url.clone() } } else { url.clone() @@ -293,4 +297,12 @@ mod tests { .unwrap(); assert_eq!(actual, expected); } + + #[test] + fn test_normalize_deno_status() { + let map = LspUrlMap::default(); + let fixture = resolve_url("deno:/status.md").unwrap(); + let actual = map.normalize_url(&fixture, LspUrlKind::File); + assert_eq!(actual, fixture); + } } |