mirror of
https://github.com/denoland/deno.git
synced 2025-08-03 18:38:33 +00:00
refactor(lsp): clean up "enablePaths" handling (#20388)
Previously we pre-computed enabled paths into `Config::enabled_paths`, and had to keep updating it. Now we determine enabled paths directly from `Config::settings` on demand as a single source of truth. Removes `Config::root_uri`. If `InitializeParams::rootUri` is given, and it doesn't correspond to a folder in `InitializeParams::workspaceFolders`, prepend it to `Config::workspace_folders` as a mocked folder. Includes groundwork for https://github.com/denoland/vscode_deno/issues/908. In a minor version cycle or two we can fix that in vscode_deno, and it won't break for Deno versions post this patch due to the corrected deserialization logic for `enablePaths`.
This commit is contained in:
parent
9d6584c16f
commit
4a11603c76
5 changed files with 264 additions and 245 deletions
|
@ -1388,6 +1388,7 @@ mod tests {
|
|||
}
|
||||
|
||||
fn mock_config() -> ConfigSnapshot {
|
||||
let root_uri = resolve_url("file:///").unwrap();
|
||||
ConfigSnapshot {
|
||||
settings: Settings {
|
||||
workspace: WorkspaceSettings {
|
||||
|
@ -1397,6 +1398,13 @@ mod tests {
|
|||
},
|
||||
..Default::default()
|
||||
},
|
||||
workspace_folders: vec![(
|
||||
root_uri.clone(),
|
||||
lsp::WorkspaceFolder {
|
||||
uri: root_uri,
|
||||
name: "".to_string(),
|
||||
},
|
||||
)],
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
@ -1468,7 +1476,7 @@ let c: number = "a";
|
|||
specifier.clone(),
|
||||
SpecifierSettings {
|
||||
enable: Some(false),
|
||||
enable_paths: Vec::new(),
|
||||
enable_paths: None,
|
||||
code_lens: Default::default(),
|
||||
},
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue