rust-lang / rust-lang/rust-analyzer
Feature request: “Create file” assist for `include` macro family
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
I propose that if the file that a user tries to include with the built-in macro include or include_str (maybe also include_bytes) does not exist, RA should offer an assist to create it (and any folders leading to it if necessary) similar to the “Create module” assist.
It's left to decide when exactly this assist can trigger: Does the cursor need to be inside of the string literal or can it also rest on the macro path? If the latter is valid, too, it probably makes sense to accept include/include_strs with non string literal arguments (e.g. in$0clude!(concat!("prefix/", include_str!("extra"))) with the cursor $0).
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 reading the existing “Create module” assist and the handling of Rust’s built-in include, include_str, and possibly include_bytes macros. Clarify whether the assist triggers inside the string literal, on the macro path, or both, including non-literal arguments. Done means offering creation of the missing file and any required parent folders.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100