mirror of
https://github.com/denoland/deno.git
synced 2025-01-18 11:53:59 -05:00
fix(lsp): ensure enablePaths
works when clients do not provide a trailing slash for workspace dir (#18373)
Closes https://github.com/denoland/vscode_deno/issues/827
This commit is contained in:
parent
f69e4794d2
commit
64f491422b
2 changed files with 133 additions and 121 deletions
|
@ -377,7 +377,7 @@ impl LanguageServer {
|
|||
let mut ls = self.0.write().await;
|
||||
if let Ok(configs) = configs_result {
|
||||
for (value, internal_uri) in
|
||||
configs.into_iter().zip(specifiers.into_iter().map(|s| s.1))
|
||||
configs.into_iter().zip(specifiers.into_iter().map(|s| s.0))
|
||||
{
|
||||
match value {
|
||||
Ok(specifier_settings) => {
|
||||
|
|
|
@ -928,6 +928,7 @@ fn lsp_inlay_hints_not_enabled() {
|
|||
|
||||
#[test]
|
||||
fn lsp_workspace_enable_paths() {
|
||||
fn run_test(use_trailing_slash: bool) {
|
||||
let context = TestContextBuilder::new().build();
|
||||
// we aren't actually writing anything to the tempdir in this test, but we
|
||||
// just need a legitimate file path on the host system so that logic that
|
||||
|
@ -943,7 +944,14 @@ fn lsp_workspace_enable_paths() {
|
|||
.set_enable_paths(vec!["./worker".to_string()])
|
||||
.set_root_uri(root_specifier.clone())
|
||||
.set_workspace_folders(vec![lsp::WorkspaceFolder {
|
||||
uri: root_specifier.clone(),
|
||||
uri: if use_trailing_slash {
|
||||
root_specifier.clone()
|
||||
} else {
|
||||
ModuleSpecifier::parse(
|
||||
root_specifier.as_str().strip_suffix('/').unwrap(),
|
||||
)
|
||||
.unwrap()
|
||||
},
|
||||
name: "project".to_string(),
|
||||
}])
|
||||
.set_deno_enable(false);
|
||||
|
@ -1067,6 +1075,10 @@ fn lsp_workspace_enable_paths() {
|
|||
client.shutdown();
|
||||
}
|
||||
|
||||
run_test(true);
|
||||
run_test(false);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lsp_hover_unstable_disabled() {
|
||||
let mut client = LspClientBuilder::new().build();
|
||||
|
|
Loading…
Add table
Reference in a new issue