Skip to content

Display Cargo errors (and other startup errors) as structured diagnostics #19969

Open
@kpreid

Description

@kpreid

Whenever there is some error from Cargo which prevents compilation from starting, I have to hover over the rust-analyzer status bar widget, wait for it to appear, and look at the raw text output without moving the mouse. In complex cases, I need to run cargo check in a terminal to get legible information.

It would be useful if, instead, rust-analyzer displayed these diagnostics through the usual LSP channels (i.e. so that they show in the Problems pane in VS Code, as editor underlines, etc.), associated with the problematic Cargo.toml manifest file if possible, or the workspace root manifest if not. This would greatly streamline the workflow for fixing manifest problems.

There should also be a diagnostic associated with the workspace root if Cargo commands fail to execute for any reason, even if there is not a normal Cargo error (e.g. if rustup reports that the requested toolchain is not available).

Related issue: #11124 is only asking for surfacing Cargo warnings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cargocargo related issuesA-diagnosticsdiagnostics / error reportingA-vfsC-featureCategory: feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions