rust-lang / rust-lang/rust-analyzer
File path completion for `include!` and friends
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Hi, I know rust-analyzer has some support for include! (like go-to-definition) and I was wondering it it might also be possible to add completions for the actual file paths when the cursor is inside an include_* macro invocation.
This request is inspired by VSCode's markdown completion, which starts completing file paths if you start typing a path, e.g. [](./):
I found their initial implementation as well in case that's helpful: https://github.com/microsoft/vscode/commit/a4e529c759fae0c15bb4bb8817ac3e7428793164
I am not sure if this is something that makes sense for rust-analyzer to do, but I would guess it might be feasible if there is already special handling for the include_* macros? If this seems out of scope for r-a to implement, that's totally fine too, but I thought it seemed like a small convenience that might be handy in some cases (e.g. include_str!ing testdata)
Thank you! R-a is consistently my favorite language server across multiple languages, and I really appreciate all the work people have put into it!
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 locating rust-analyzer's existing go-to-definition or special handling for include_* macros and the completion entry point used inside macro invocations. Review the linked VSCode implementation for path-completion behavior. Done means file paths are offered while typing inside include! and related macros, with coverage for the intended completion cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100