rust-lang / rust-lang/rust-analyzer

request: suggested fix action to make a new type

Open
#23,377 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

If you have

mod some_name;

then when the file for the some_name module doesn't exist, a suggested action will be to create the file.

Currently, this doesn't happen with types.

If you have code like

struct Ast {
  pub items: Vec<Item>
}

and assuming there's no Item type in scope, there won't be a suggested fix to make the Item type. There's suggestions for new methods, getter/setter, deref impl, but no suggested fix to "make a new struct with this name because it doesn't exist".

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

The issue names no repository files or tests. Start by locating the existing suggested action for missing module files and compare it with the current actions for unresolved types. Add coverage for offering a new-struct action for an unresolved Item reference, then verify the example produces that suggestion.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.