Skip to content

make matching brace work when cursor not at bracket#21792

Open
bend-n wants to merge 2 commits intorust-lang:masterfrom
bend-n:make-matching-brace-almost-always-proc
Open

make matching brace work when cursor not at bracket#21792
bend-n wants to merge 2 commits intorust-lang:masterfrom
bend-n:make-matching-brace-almost-always-proc

Conversation

@bend-n
Copy link

@bend-n bend-n commented Mar 10, 2026

by jumping to the parents enclosing bracket.

see #t-compiler/rust-analyzer > experimental/matching braces when not on a brace @ 💬

this would make the behavior match vscodes go to bracket command.

behavior pictured:

2026-03-10.17-53-48.mp4

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 10, 2026
Some(matching_node.text_range().start())
} else {
// when the offset is not at a brace
let thingy = file.syntax().token_at_offset(offset).last()?;
Copy link
Contributor

Choose a reason for hiding this comment

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

We already have file.syntax().token_at_offset(offset). There is a potential for code reuse here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also thingy is not exactly a descriptive name.

@bend-n bend-n force-pushed the make-matching-brace-almost-always-proc branch from 89cb5dd to 53ceaf7 Compare March 23, 2026 07:54
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