rust-lang / rust-lang/rust-analyzer
Cargo tasks problem matcher defective
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
rust-analyzer version: 0.3.1916-standalone (7a8374c16 2024-04-08)
rustc version: rustc 1.77.2 (25ef9e3d8 2024-04-09)
editor or extension: VSCode
Cargo tasks that check your code and provide output to VSCode like cargo check and cargo clippy have very limited output compared to saving the file:
- only the first word where the issue is gets underlined, not the whole problem
- the problems panel only shows a limited amount of info about each issue
But when you save or open the file, Rust Analyzer will:
- in the problems panel, all the info is detailed and show all the information that you get from hovering over it
- the underlines will underline the entire problem
- works exactly as expected
So Rust Analyzer works correctly but tasks don't. I assume it's a bug to do with some problem matcher, but if it's not, how can I make it work like Rust Analyzer?
code snippet to reproduce:
fn x() {
2 * 0;
}
When you save (and have clippy, just for the example):
- "x" will be greyed out and underlined yellow because it's not being used
- all of line 2 will be underlined red
- these 2 messages in the problems panel:
this operation will always return zero. This is likely not the intended outcome for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#erasing_op#[deny(clippy::erasing_op)]on by defaultandfunctionxis never used#[warn(dead_code)]on by default
When you run a task:
- "x" isn't greyed out like it supposed to be, just underlined yellow
- only the 2 will be underlined red because that's first first word where the problem is
- in the problems panel you get
this operation will always return zero. This is likely not the intended outcomeandfunctionxis never usedwhich is not as detailed as the RA one and has barely any info
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 reproducing the difference between cargo check or cargo clippy task diagnostics and diagnostics shown after saving or opening the Rust file in VS Code, using the provided snippet. Compare the task problem matcher output with Rust Analyzer's ranges and full messages; done means the task diagnostics include the complete details and underline the full problem locations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, vscode
- Domain
- devtools, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100