mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -05:00
fix(lsp): ensure language server status works on unix (#18727)
Closes #18724
This commit is contained in:
parent
d9279e3dd6
commit
49a697e4bb
1 changed files with 16 additions and 4 deletions
|
@ -188,13 +188,17 @@ 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" {
|
||||||
|
if let Ok(path) = url.to_file_path() {
|
||||||
match kind {
|
match kind {
|
||||||
LspUrlKind::Folder => Url::from_directory_path(path).unwrap(),
|
LspUrlKind::Folder => Url::from_directory_path(path).unwrap(),
|
||||||
LspUrlKind::File => Url::from_file_path(path).unwrap(),
|
LspUrlKind::File => Url::from_file_path(path).unwrap(),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
url.clone()
|
url.clone()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
url.clone()
|
||||||
};
|
};
|
||||||
inner.put(specifier.clone(), LspClientUrl(url.clone()));
|
inner.put(specifier.clone(), LspClientUrl(url.clone()));
|
||||||
specifier
|
specifier
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue