rust-lang / rust-lang/rust-analyzer
Go to definition / open link for file path in `include_str` should work for non-Rust files
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Split off from #11019. See https://github.com/rust-analyzer/rust-analyzer/issues/11019#issuecomment-994966731.
Go to definition / open link for file paths in include, include_str, include_bytes does work already (https://github.com/rust-analyzer/rust-analyzer/issues/11019#issuecomment-994479218).
Sadly, this only works if the file extension is rs. My codebase on the other hand include_strs JS and CSS files and include_bytes WOFF files (just like librustdoc!). In such a case, this feature does not work.
I would say more often than not one doesn't include_str Rust files (contrary to include). I am not sure if that still counts as jump to definition in the LSP sense but it's reasonable to support (as open link or whatever other mechanism available) in my opinion. I am not familiar with the LSP though.
rust-analyzer version: rust-analyzer version: db2a7087b 2021-12-13 stable
rustc version: rustc 1.59.0-nightly (48a5999fc 2021-12-01)
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 with the existing include/include_str/include_bytes handling discussed in #11019 and its linked comments. Reproduce the current behavior with non-Rust paths such as JS, CSS, and WOFF files; done means go-to-definition or open-link navigation works for those paths as it already does for Rust files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100