rust-lang / rust-lang/rust-analyzer

Feature request: refactor support for adding a new argument

Open
#6,499 8 comments 17 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-assists C-feature E-hard E-has-instructions fun S-actionable
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

I have a function that looks like this:

    pub fn from_hir_id_and_parts(hir_id: hir::HirId, inner: ItemEnum, cx: &DocContext<'_>) -> Item {

and I want to turn it into this:

    pub fn from_hir_id_and_parts(hir_id: hir::HirId, inner: ItemEnum, name: Symbol, cx: &DocContext<'_>) -> Item {

It would be nice to have refactor support that automatically added name as an argument everywhere this function is called. It's ok if the resulting code doesn't compile, it gets me close enough that I get useful compile errors instead of 'wrong number of arguments'.

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 tracing the refactor-support entry points for function signature changes and the call sites of from_hir_id_and_parts. Check how existing refactors update callers and how they report incomplete results. Done means adding the name argument can update every known call site, even when the resulting Rust code still needs compiler-guided fixes.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.