Skip to content

Commit

Permalink
perf(lsp): remove fallback config scopes for workspace folders (denol…
Browse files Browse the repository at this point in the history
  • Loading branch information
nayeemrmn authored Aug 6, 2024
1 parent 3e1f982 commit 30a97d1
Showing 1 changed file with 22 additions and 44 deletions.
66 changes: 22 additions & 44 deletions cli/lsp/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
);
}
}
}
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 30a97d1

Please sign in to comment.