Skip to content

Commit 30a97d1

Browse files
authored
perf(lsp): remove fallback config scopes for workspace folders (#24868)
1 parent 3e1f982 commit 30a97d1

File tree

1 file changed

+22
-44
lines changed

1 file changed

+22
-44
lines changed

cli/lsp/config.rs

Lines changed: 22 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,27 +1701,28 @@ impl ConfigTree {
17011701
ws_settings = ws_settings.or(Some(&settings.unscoped));
17021702
}
17031703
if let Some(ws_settings) = ws_settings {
1704-
if let Some(config_path) = &ws_settings.config {
1705-
if let Ok(config_uri) = folder_uri.join(config_path) {
1706-
if let Ok(config_file_path) = config_uri.to_file_path() {
1707-
scopes.insert(
1708-
folder_uri.clone(),
1709-
Arc::new(
1710-
ConfigData::load(
1711-
Some(&config_file_path),
1712-
folder_uri,
1713-
settings,
1714-
file_fetcher,
1715-
&cached_fs,
1716-
&deno_json_cache,
1717-
&pkg_json_cache,
1718-
&workspace_cache,
1719-
)
1720-
.await,
1721-
),
1722-
);
1723-
}
1724-
}
1704+
let config_file_path = (|| {
1705+
let config_setting = ws_settings.config.as_ref()?;
1706+
let config_uri = folder_uri.join(config_setting).ok()?;
1707+
specifier_to_file_path(&config_uri).ok()
1708+
})();
1709+
if config_file_path.is_some() || ws_settings.import_map.is_some() {
1710+
scopes.insert(
1711+
folder_uri.clone(),
1712+
Arc::new(
1713+
ConfigData::load(
1714+
config_file_path.as_deref(),
1715+
folder_uri,
1716+
settings,
1717+
file_fetcher,
1718+
&cached_fs,
1719+
&deno_json_cache,
1720+
&pkg_json_cache,
1721+
&workspace_cache,
1722+
)
1723+
.await,
1724+
),
1725+
);
17251726
}
17261727
}
17271728
}
@@ -1772,29 +1773,6 @@ impl ConfigTree {
17721773
}
17731774
}
17741775

1775-
for folder_uri in settings.by_workspace_folder.keys() {
1776-
if !scopes
1777-
.keys()
1778-
.any(|s| folder_uri.as_str().starts_with(s.as_str()))
1779-
{
1780-
scopes.insert(
1781-
folder_uri.clone(),
1782-
Arc::new(
1783-
ConfigData::load(
1784-
None,
1785-
folder_uri,
1786-
settings,
1787-
file_fetcher,
1788-
&cached_fs,
1789-
&deno_json_cache,
1790-
&pkg_json_cache,
1791-
&workspace_cache,
1792-
)
1793-
.await,
1794-
),
1795-
);
1796-
}
1797-
}
17981776
self.scopes = Arc::new(scopes);
17991777
}
18001778

0 commit comments

Comments
 (0)