mirror of
https://github.com/denoland/deno.git
synced 2025-07-24 05:35:33 +00:00
fix(lsp): avoid calling client while holding lock (#18197)
This commit is contained in:
parent
2ca1607027
commit
7070b8ed50
13 changed files with 674 additions and 575 deletions
|
@ -69,18 +69,6 @@ pub fn specifier_to_file_path(
|
|||
}
|
||||
}
|
||||
|
||||
/// Ensures a specifier that will definitely be a directory has a trailing slash.
|
||||
pub fn ensure_directory_specifier(
|
||||
mut specifier: ModuleSpecifier,
|
||||
) -> ModuleSpecifier {
|
||||
let path = specifier.path();
|
||||
if !path.ends_with('/') {
|
||||
let new_path = format!("{path}/");
|
||||
specifier.set_path(&new_path);
|
||||
}
|
||||
specifier
|
||||
}
|
||||
|
||||
/// Gets the parent of this module specifier.
|
||||
pub fn specifier_parent(specifier: &ModuleSpecifier) -> ModuleSpecifier {
|
||||
let mut specifier = specifier.clone();
|
||||
|
@ -264,21 +252,6 @@ mod test {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_ensure_directory_specifier() {
|
||||
run_test("file:///", "file:///");
|
||||
run_test("file:///test", "file:///test/");
|
||||
run_test("file:///test/", "file:///test/");
|
||||
run_test("file:///test/other", "file:///test/other/");
|
||||
run_test("file:///test/other/", "file:///test/other/");
|
||||
|
||||
fn run_test(specifier: &str, expected: &str) {
|
||||
let result =
|
||||
ensure_directory_specifier(ModuleSpecifier::parse(specifier).unwrap());
|
||||
assert_eq!(result.to_string(), expected);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_specifier_parent() {
|
||||
run_test("file:///", "file:///");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue