Unnamed repository; edit this file 'description' to name the repository.
Make workspace_symbol_search_* workspace
Ali Bektas 2024-08-29
parent e4edbf4 · commit 3a4efb4
-rw-r--r--crates/rust-analyzer/src/config.rs28
-rw-r--r--crates/rust-analyzer/src/handlers/request.rs2
2 files changed, 15 insertions, 15 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index e459e7b7f3..925d650b5b 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -252,8 +252,6 @@ config_data! {
config_data! {
workspace: struct WorkspaceDefaultConfigData <- WorkspaceConfigInput -> {
-
-
/// Pass `--all-targets` to cargo invocation.
cargo_allTargets: bool = true,
/// Automatically refresh project info via `cargo metadata` on
@@ -447,6 +445,16 @@ config_data! {
/// available on a nightly build.
rustfmt_rangeFormatting_enable: bool = false,
+
+ /// Workspace symbol search kind.
+ workspace_symbol_search_kind: WorkspaceSymbolSearchKindDef = WorkspaceSymbolSearchKindDef::OnlyTypes,
+ /// Limits the number of items returned from a workspace symbol search (Defaults to 128).
+ /// Some clients like vs-code issue new searches on result filtering and don't require all results to be returned in the initial search.
+ /// Other clients requires all results upfront and might require a higher limit.
+ workspace_symbol_search_limit: usize = 128,
+ /// Workspace symbol search scope.
+ workspace_symbol_search_scope: WorkspaceSymbolSearchScopeDef = WorkspaceSymbolSearchScopeDef::Workspace,
+
}
}
@@ -731,14 +739,6 @@ config_data! {
/// Whether to insert closing angle brackets when typing an opening angle bracket of a generic argument list.
typing_autoClosingAngleBrackets_enable: bool = false,
- /// Workspace symbol search kind.
- workspace_symbol_search_kind: WorkspaceSymbolSearchKindDef = WorkspaceSymbolSearchKindDef::OnlyTypes,
- /// Limits the number of items returned from a workspace symbol search (Defaults to 128).
- /// Some clients like vs-code issue new searches on result filtering and don't require all results to be returned in the initial search.
- /// Other clients requires all results upfront and might require a higher limit.
- workspace_symbol_search_limit: usize = 128,
- /// Workspace symbol search scope.
- workspace_symbol_search_scope: WorkspaceSymbolSearchScopeDef = WorkspaceSymbolSearchScopeDef::Workspace,
}
}
@@ -2019,19 +2019,19 @@ impl Config {
}
}
- pub fn workspace_symbol(&self) -> WorkspaceSymbolConfig {
+ pub fn workspace_symbol(&self, source_root: Option<SourceRootId>) -> WorkspaceSymbolConfig {
WorkspaceSymbolConfig {
- search_scope: match self.workspace_symbol_search_scope() {
+ search_scope: match self.workspace_symbol_search_scope(source_root) {
WorkspaceSymbolSearchScopeDef::Workspace => WorkspaceSymbolSearchScope::Workspace,
WorkspaceSymbolSearchScopeDef::WorkspaceAndDependencies => {
WorkspaceSymbolSearchScope::WorkspaceAndDependencies
}
},
- search_kind: match self.workspace_symbol_search_kind() {
+ search_kind: match self.workspace_symbol_search_kind(source_root) {
WorkspaceSymbolSearchKindDef::OnlyTypes => WorkspaceSymbolSearchKind::OnlyTypes,
WorkspaceSymbolSearchKindDef::AllSymbols => WorkspaceSymbolSearchKind::AllSymbols,
},
- search_limit: *self.workspace_symbol_search_limit(),
+ search_limit: *self.workspace_symbol_search_limit(source_root),
}
}
diff --git a/crates/rust-analyzer/src/handlers/request.rs b/crates/rust-analyzer/src/handlers/request.rs
index b39552a172..94487bdbb2 100644
--- a/crates/rust-analyzer/src/handlers/request.rs
+++ b/crates/rust-analyzer/src/handlers/request.rs
@@ -565,7 +565,7 @@ pub(crate) fn handle_workspace_symbol(
) -> anyhow::Result<Option<lsp_types::WorkspaceSymbolResponse>> {
let _p = tracing::info_span!("handle_workspace_symbol").entered();
- let config = snap.config.workspace_symbol();
+ let config = snap.config.workspace_symbol(None);
let (all_symbols, libs) = decide_search_scope_and_kind(&params, &config);
let query = {