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: Add a new and improved syntax tree view #18813

Merged
merged 4 commits into from
Jan 10, 2025

Conversation

Giga-Bowser
Copy link
Contributor

Lots of cool features!

  • Reveal button to highlight a given syntax element
  • Tree selection matches document selection
  • Hover to see an element's text
  • Supports trees for rust code in string literals

I'm still pretty new to the VS Code side of things so there's probably a better way to do some of the stuff I did. If someone more familiar with this sort of thing wants to try to record a GIF or something of this in use, feel free. Otherwise I'll try to get one up in a bit,

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 1, 2025
@Giga-Bowser
Copy link
Contributor Author

Also, would people be fine with this replacing the old textual syntax tree view? I could try to move some of the functionality to integrate with this feature if it's still desired. Maybe an action on each syntax element to copy the old format view to the clipboard?

@Veykril
Copy link
Member

Veykril commented Jan 3, 2025

If it does allow debugging the syntax tree then there is no need for the old view

@Giga-Bowser Giga-Bowser force-pushed the syntax-tree-view branch 2 times, most recently from 632b3df to ba90f87 Compare January 7, 2025 00:51
@Giga-Bowser
Copy link
Contributor Author

Giga-Bowser commented Jan 7, 2025

Here's a video of it in action

syntaxtree.mp4

@lnicola
Copy link
Member

lnicola commented Jan 7, 2025

Maybe an action on each syntax element to copy the old format view to the clipboard?

I think so, copying is still useful, e.g. when pasting to GitHub.

@Giga-Bowser
Copy link
Contributor Author

Done!

crates/ide/src/view_syntax_tree.rs Outdated Show resolved Hide resolved
editors/code/package.json Outdated Show resolved Hide resolved
editors/code/package.json Show resolved Hide resolved
@Veykril
Copy link
Member

Veykril commented Jan 8, 2025

Couple things but otherwise this seems good to me!

@lnicola
Copy link
Member

lnicola commented Jan 8, 2025

I guess we can't put a "Copy" icon next to 🔍, can we?

@Giga-Bowser
Copy link
Contributor Author

I guess we can't put a "Copy" icon next to 🔍, can we?

We can! Should be fixed.

@Veykril
Copy link
Member

Veykril commented Jan 10, 2025

Thanks!

@Veykril Veykril added this pull request to the merge queue Jan 10, 2025
Merged via the queue into rust-lang:master with commit d133136 Jan 10, 2025
9 checks passed
@lnicola
Copy link
Member

lnicola commented Jan 10, 2025

I'm playing with this, is there a difference between these two? 😅

image

@Giga-Bowser
Copy link
Contributor Author

I actually have no clue. VS Code registers both of these commands for us so I'm not sure why there's two, I'll take a look.

@Giga-Bowser
Copy link
Contributor Author

It seems like since we're registering a custom view container, View: Show Rust Syntax Tree shows that container, while Rust Syntax Tree: Focus on Rust Syntax Tree View focuses on the tree view within said container. You can see the same thing with builtin views, for example, View: Show Explorer and Explorer: Focus on Folders View.

@lnicola
Copy link
Member

lnicola commented Jan 10, 2025

Ah, you're right, never mind.

@Giga-Bowser Giga-Bowser deleted the syntax-tree-view branch January 10, 2025 19:21
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