Skip to content

Commit fcf505b

Browse files
committed
Make workspace_symbol_search_* workspace
1 parent 887dd4e commit fcf505b

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,6 @@ config_data! {
252252

253253
config_data! {
254254
workspace: struct WorkspaceDefaultConfigData <- WorkspaceConfigInput -> {
255-
256-
257255
/// Pass `--all-targets` to cargo invocation.
258256
cargo_allTargets: bool = true,
259257
/// Automatically refresh project info via `cargo metadata` on
@@ -447,6 +445,16 @@ config_data! {
447445
/// available on a nightly build.
448446
rustfmt_rangeFormatting_enable: bool = false,
449447

448+
449+
/// Workspace symbol search kind.
450+
workspace_symbol_search_kind: WorkspaceSymbolSearchKindDef = WorkspaceSymbolSearchKindDef::OnlyTypes,
451+
/// Limits the number of items returned from a workspace symbol search (Defaults to 128).
452+
/// Some clients like vs-code issue new searches on result filtering and don't require all results to be returned in the initial search.
453+
/// Other clients requires all results upfront and might require a higher limit.
454+
workspace_symbol_search_limit: usize = 128,
455+
/// Workspace symbol search scope.
456+
workspace_symbol_search_scope: WorkspaceSymbolSearchScopeDef = WorkspaceSymbolSearchScopeDef::Workspace,
457+
450458
}
451459
}
452460

@@ -731,14 +739,6 @@ config_data! {
731739
/// Whether to insert closing angle brackets when typing an opening angle bracket of a generic argument list.
732740
typing_autoClosingAngleBrackets_enable: bool = false,
733741

734-
/// Workspace symbol search kind.
735-
workspace_symbol_search_kind: WorkspaceSymbolSearchKindDef = WorkspaceSymbolSearchKindDef::OnlyTypes,
736-
/// Limits the number of items returned from a workspace symbol search (Defaults to 128).
737-
/// Some clients like vs-code issue new searches on result filtering and don't require all results to be returned in the initial search.
738-
/// Other clients requires all results upfront and might require a higher limit.
739-
workspace_symbol_search_limit: usize = 128,
740-
/// Workspace symbol search scope.
741-
workspace_symbol_search_scope: WorkspaceSymbolSearchScopeDef = WorkspaceSymbolSearchScopeDef::Workspace,
742742
}
743743
}
744744

@@ -2019,19 +2019,19 @@ impl Config {
20192019
}
20202020
}
20212021

2022-
pub fn workspace_symbol(&self) -> WorkspaceSymbolConfig {
2022+
pub fn workspace_symbol(&self, source_root: Option<SourceRootId>) -> WorkspaceSymbolConfig {
20232023
WorkspaceSymbolConfig {
2024-
search_scope: match self.workspace_symbol_search_scope() {
2024+
search_scope: match self.workspace_symbol_search_scope(source_root) {
20252025
WorkspaceSymbolSearchScopeDef::Workspace => WorkspaceSymbolSearchScope::Workspace,
20262026
WorkspaceSymbolSearchScopeDef::WorkspaceAndDependencies => {
20272027
WorkspaceSymbolSearchScope::WorkspaceAndDependencies
20282028
}
20292029
},
2030-
search_kind: match self.workspace_symbol_search_kind() {
2030+
search_kind: match self.workspace_symbol_search_kind(source_root) {
20312031
WorkspaceSymbolSearchKindDef::OnlyTypes => WorkspaceSymbolSearchKind::OnlyTypes,
20322032
WorkspaceSymbolSearchKindDef::AllSymbols => WorkspaceSymbolSearchKind::AllSymbols,
20332033
},
2034-
search_limit: *self.workspace_symbol_search_limit(),
2034+
search_limit: *self.workspace_symbol_search_limit(source_root),
20352035
}
20362036
}
20372037

src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ pub(crate) fn handle_workspace_symbol(
565565
) -> anyhow::Result<Option<lsp_types::WorkspaceSymbolResponse>> {
566566
let _p = tracing::info_span!("handle_workspace_symbol").entered();
567567

568-
let config = snap.config.workspace_symbol();
568+
let config = snap.config.workspace_symbol(None);
569569
let (all_symbols, libs) = decide_search_scope_and_kind(&params, &config);
570570

571571
let query = {

0 commit comments

Comments
 (0)