Skip to content
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

feat: Report document symbols of kind variable for let statements #18312

Merged
merged 2 commits into from
Oct 28, 2024

Conversation

LastExceed
Copy link
Contributor

initially i had implemented a bunch more kinds, but eventually realized that ide_db::SymbolKind != lsp_types::SymbolKind and that many of the former kind are mapped to the same latter kind, which could cause annoyances when e.g. the user wants their outline view in vscode to show ide_db::SymbolKind::Const and ide_db::SymbolKind::Static but not ide_db::SymbolKind::ConstParam (which wouldn't be possible to configure in vscode since all of them are mapped to lsp_types::SymbolKind::CONSTANT) so i decided to take a conservative approach and ended up removing all but 1 kind

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 16, 2024
@Veykril
Copy link
Member

Veykril commented Oct 18, 2024

What is the goal here? We generally don't consider let statements to be part of the file structure

@LastExceed
Copy link
Contributor Author

LastExceed commented Oct 18, 2024

the goal is to make as much language agnostic information accessible as possible. The client can always choose to selectively ignore stuff. E.g. if you don't want variable declarations to show up in VSCode's outline view then you can simply uncheck Settings > Outline > Show Variables

My personal motivation (which brought me here in the first place) is a language agnostic extension I am developing which selectively fades everything outside the currently selected scope/expression/whatever to reduce visual noise. This extension is currently more capable in e.g. TypeScript than it is in Rust simply because the TS language server provides more information than RA does

Whether or not variable declarations are part of the file structure is IMO a matter of opinion/preference, and I see no good reason to withhold information when configuration options exist

@Veykril
Copy link
Member

Veykril commented Oct 22, 2024

Fair, I think the last time someone proposed adding matches to this which was confusing.

Copy link
Member

@Veykril Veykril left a comment

Choose a reason for hiding this comment

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

Please add to the test_file_structure test

@Veykril Veykril changed the title report document symbols of kind variable Report document symbols of kind variable for let statements Oct 22, 2024
@LastExceed
Copy link
Contributor Author

sry for the delay. added tests and rebased the branch

@Veykril Veykril added this pull request to the merge queue Oct 28, 2024
Merged via the queue into rust-lang:master with commit 68e2d84 Oct 28, 2024
9 checks passed
@lnicola lnicola changed the title Report document symbols of kind variable for let statements feat: Report document symbols of kind variable for let statements Oct 29, 2024
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.

3 participants