rust-lang / rust-lang/rust-analyzer

Sort methods alphabetically only shows when selecting

Open
#19,852 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)

rust-analyzer version: 0.3.2466-standalone (e464ff8c75 2025-05-18)

rustc version: (eg. output of rustc -V)

rustc 1.87.0 (17067e9ac 2025-05-09)

editor or extension: (eg. VSCode, Vim, Emacs, etc. For VSCode users, specify your extension version; for users of other editors, provide the distribution if applicable)

Cursor & VSCode
Extension version: 0.3.2466

code snippet to reproduce:

impl Foo {
    // baz
    fn baz() {}
    // bar
    fn bar() {}
}

If you position your cursor on Foo and hit Ctrl/⌘+. it will show only the "generate trait from impl" quick action:
Image

However if you highlight any portion of "impl Foo {" or the final "}" or some (but not all) internal whitespace of the impl block (as little as one character, as many as all characters, even spaces), it will show additional quick actions:
Image

Curiously, when selecting the entire impl block, the sort quick action is again not present.

This is extremely undiscoverable -- surely these quick actions should show up any time the cursor is on a relevant region, not just when a selection is active?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the quick-action behavior in Cursor or VSCode using the impl Foo example, comparing a cursor-only position with partial and complete selections. Trace the rust-analyzer quick-action handling for impl blocks and make the sort action appear consistently whenever the cursor is in the relevant region, then verify the contrasting selection cases no longer change availability.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, vscode
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.