rust-lang / rust-lang/rust-analyzer

Only get 'extract to variable' not 'extract to function' in vscode

Open
#17,280 4 comments 7 reactions 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

Very similar to https://github.com/rust-lang/rust-analyzer/issues/11577, but happening in VSCode, and as far as I know the files are part of the project - certainly they are in git and in a regular cargo crate in a regular cargo workspace.

rust-analyzer version: rust-analyzer version: 0.3.1958-standalone

rustc version: rustc 1.78.0 (9b00956e5 2024-04-29)

editor or extension: VSCode v0.3.1958

relevant settings: nothing special

repository link (if public, optional): private sorry,

code snippet to reproduce: (copied from the troubleshooting guide into my program, then attempted the same extraction).

        let n = 1;
        let m = n + 2;
        // calculate
        let k = m + n;
        let g = 3;

image

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 extraction actions in VSCode with the provided Rust snippet and compare the behavior with issue #11577. The report is resolved when the same code offers “extract to function” as well as “extract to variable”; the private repository and missing project files make broader reproduction necessary.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, vscode
Domain
developer-experience, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.