1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 15:24:46 -05:00

fix(lsp): ensure language server status works on unix (#18727)

Closes #18724
This commit is contained in:
David Sherret 2023-04-16 16:02:48 -04:00 committed by GitHub
parent 02dd09a36f
commit 94744ae25a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -188,10 +188,14 @@ impl LspUrlMap {
if let Some(specifier) = inner.get_specifier(url).cloned() { if let Some(specifier) = inner.get_specifier(url).cloned() {
specifier specifier
} else { } else {
let specifier = if let Ok(path) = url.to_file_path() { let specifier = if url.scheme() == "file" {
match kind { if let Ok(path) = url.to_file_path() {
LspUrlKind::Folder => Url::from_directory_path(path).unwrap(), match kind {
LspUrlKind::File => Url::from_file_path(path).unwrap(), LspUrlKind::Folder => Url::from_directory_path(path).unwrap(),
LspUrlKind::File => Url::from_file_path(path).unwrap(),
}
} else {
url.clone()
} }
} else { } else {
url.clone() url.clone()
@ -293,4 +297,12 @@ mod tests {
.unwrap(); .unwrap();
assert_eq!(actual, expected); 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);
}
} }