rust-lang / rust-lang/rust-analyzer
Feature Requests about Code Actions/Snippets
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Convert to destructured form
let input = (1, 1);
// <=>
let (a, b) = (1, 1);
It would be nice if this could use snippets somehow so that the cursor jumps to fill in the variable names.
But most other assists don't do this for the identifiers so maybe not necessary.
Generate closure template based on the signature inferred at that point
iter.map(<closure>)
This should probably be a snippet with nodes at the arguments and then function body.
The reason this should be from rust-analyzer is that it with type information we can generate the argument list better.
The function body could probably be just unimplemented!("<return type name>")
Convert between function name and closure
str::parse
// <=>
|s| str::parse(s)
// OR
|s| s.parse()
The last transform would require us to check whether it is a inherent method. Maybe another assist that converts inherent method calls to UFCS style could also be useful
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by surveying rust-analyzer's existing Code Actions, assists, and snippet support, then separate the three proposed transformations: destructuring, closure generation, and function/closure conversion. Determine whether each needs type information and how completion would be verified; done should include a clearly scoped proposal with focused behavior and tests for any selected assist.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100