Skip to content

Add better documentation for excluding imports from symbol search #20050

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

LHolten
Copy link
Contributor

@LHolten LHolten commented Jun 20, 2025

This should make the option less confusing.

@joshka do you think this documentation is good?

@LHolten LHolten force-pushed the better-docs-for-exclude-imports-in-symbol-search branch from ea63116 to 7492b63 Compare June 20, 2025 11:27
Copy link
Contributor

@joshka joshka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@@ -762,7 +762,11 @@ config_data! {
/// though Cargo might be the eventual consumer.
vfs_extraIncludes: Vec<String> = vec![],

/// Exclude imports from symbol search.
/// Exclude all imports from workspace symbol search.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be worth defining what symbol search is (eg specifically where this ends up in the ui)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem like the right location to explain symbol search to me. In my opinion that should be the job of the editor that exposes the feature.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I'm saying is that VSCode doesn't have a feature named "symbol search". This is the internal LSP name that's not shared with anything that appears in the VSCode UI.

VSCode has "Go To Symbol" action, and it has various completion behavior that triggers searches of symbols. It also has "Find all references" (to a symbol), and "Find all Implementations". I wouldn't be surprised if there were other UIs that had some form of searching capability over symbols. So it's unclear which of these these settings control.

Digging into the source code to work it out suggests that this is probably only the "Go To Symbol" action and that it's documented (sort of) in https://rust-analyzer.github.io/book/features.html#workspace-symbol (which I found by looking for all instances of "workspace.symbol" in the source). Is that the only place that this behavior surfaces, or does it affect other places?

As an aside, I'd intuitively thought that this actually applied to the symbol search that appears when completing symbols, so my complaint about confusion is grounded in actual confusion, not a hypothetical one (I've used VSCode every day for many years - I'm not unfamiliar with it).

I suspect that the symbol search action was possibly renamed at some point, or maybe we're just used to referring to it by the internal name rather than the UI name, but the settings are configured with respect to the UI names, so they should reference those names. I'm guessing a setting rename probably wasn't anticipated here, but it might be appropriate.

@LHolten LHolten marked this pull request as ready for review June 20, 2025 12:23
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 20, 2025
Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Jun 21, 2025
Merged via the queue into rust-lang:master with commit 0ddaf2c Jun 21, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants