-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Print span info for errors #12810
Comments
You mention rust-analyzer and your own workflow combined with "printing" spans. Are you needing spans printed in human readable output or json? I'm assuming rust-analyzer would actually be the latter and is a larger step beyond the human readable side. If this issue is meant to encompass rust-analyzer, it would likely be good to get someone from that project on this issue so we make sure we deliver the right thing. As for a path for this, it would look roughly like
|
human readable output would be a great start already, specifically in the format The format is pretty standard, it's used by many of the compilers I worked with, like gcc, clang, javac, etc. VS Code also supports linking the style python uses, which is |
I think, even if you assume the vs code devs were willing to add a custom format recognizer for cargo, the format currently outputted by cargo is hard to turn into a clickable link, as the filename is far away from the line and column info. So, best to use |
Java: public class Program
{
public static void main(Stvring[] args) {
}
}
clang: void main(void) {
eror
}
Python: hio
|
No effort has been done to polish our existing spans: thats just what we get from toml_edit + anyhow: This is all incremental. With our diagnostic work, we plan to mirror rustc as much as possible. |
Noted. Very enthusiastic about seeing progress in that area! |
Filing a new one as #6144 was closed as RLS specific, but the underlying issue exists with rust-analyzer as well. It also exists in my private "Konsole + Kate" workflow.
TLDR: Cargo should print span information for diagnostics, that is column and line numbers (plus file name) that are seen as relevant to the error or diagnostic. It can maybe also print snippets like rustc, but a good first step would be to have some span information at all.
Consider when you mistype a dependency in Cargo.toml: cargo gives an error that the dependency can't be found. But it does not point to the line. In many IDEs, when there is a string like
Cargo.toml:15:0
, a ctrl+click on that opens the editor at right that spot. This is very helpful for editor workflows.Instead, one has to look for the "actionable spot" of the error manually. This is sub-optimal and could be improved.
Earlier issues:
The text was updated successfully, but these errors were encountered: