summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
}