summaryrefslogtreecommitdiff
path: root/cli/lsp/config.rs
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2024-08-06 01:10:02 +0100
committerGitHub <noreply@github.com>2024-08-06 01:10:02 +0100
commit30a97d1e512b57cad14db645e4d9d1a76fa2087b (patch)
treefcc619e932be04be462e8d48010990ef1bdbedc5 /cli/lsp/config.rs
parent3e1f98236f2a0d1db331caf0a246660fcd104deb (diff)
perf(lsp): remove fallback config scopes for workspace folders (#24868)
Diffstat (limited to 'cli/lsp/config.rs')
-rw-r--r--cli/lsp/config.rs66
1 files changed, 22 insertions, 44 deletions
diff --git a/cli/lsp/config.rs b/cli/lsp/config.rs
index 8a44c26dd..c48544a2d 100644
--- a/cli/lsp/config.rs
+++ b/cli/lsp/config.rs
@@ -1701,27 +1701,28 @@ impl ConfigTree {
ws_settings = ws_settings.or(Some(&settings.unscoped));
}
if let Some(ws_settings) = ws_settings {
- if let Some(config_path) = &ws_settings.config {
- if let Ok(config_uri) = folder_uri.join(config_path) {
- if let Ok(config_file_path) = config_uri.to_file_path() {
- scopes.insert(
- folder_uri.clone(),
- Arc::new(
- ConfigData::load(
- Some(&config_file_path),
- folder_uri,
- settings,
- file_fetcher,
- &cached_fs,
- &deno_json_cache,
- &pkg_json_cache,
- &workspace_cache,
- )
- .await,
- ),
- );
- }
- }
+ let config_file_path = (|| {
+ let config_setting = ws_settings.config.as_ref()?;
+ let config_uri = folder_uri.join(config_setting).ok()?;
+ specifier_to_file_path(&config_uri).ok()
+ })();
+ if config_file_path.is_some() || ws_settings.import_map.is_some() {
+ scopes.insert(
+ folder_uri.clone(),
+ Arc::new(
+ ConfigData::load(
+ config_file_path.as_deref(),
+ folder_uri,
+ settings,
+ file_fetcher,
+ &cached_fs,
+ &deno_json_cache,
+ &pkg_json_cache,
+ &workspace_cache,
+ )
+ .await,
+ ),
+ );
}
}
}
@@ -1772,29 +1773,6 @@ impl ConfigTree {
}
}
- for folder_uri in settings.by_workspace_folder.keys() {
- if !scopes
- .keys()
- .any(|s| folder_uri.as_str().starts_with(s.as_str()))
- {
- scopes.insert(
- folder_uri.clone(),
- Arc::new(
- ConfigData::load(
- None,
- folder_uri,
- settings,
- file_fetcher,
- &cached_fs,
- &deno_json_cache,
- &pkg_json_cache,
- &workspace_cache,
- )
- .await,
- ),
- );
- }
- }
self.scopes = Arc::new(scopes);
}