Skip to content
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

VSCode rustc problem matcher should use fileLocation autoDetect #5482

Closed
rickvanprim opened this issue Jul 21, 2020 · 2 comments · Fixed by #5500
Closed

VSCode rustc problem matcher should use fileLocation autoDetect #5482

rickvanprim opened this issue Jul 21, 2020 · 2 comments · Fixed by #5500

Comments

@rickvanprim
Copy link
Contributor

Per microsoft/vscode#449 and https://code.visualstudio.com/docs/editor/tasks#_defining-a-problem-matcher , problem matchers can now be defined that support both relative and absolute paths. I propose that https://github.com/rust-analyzer/rust-analyzer/blob/master/editors/code/package.json#L602-L634 be updated to specify "fileLocation": "autoDetect". Cargo seems to compiles path based dependencies with absolute paths when they are not located inside of the current crate/workspace root (rust-lang/cargo#8506 (comment)), and presently the problem matcher that ships with rust-analyzer attempts to treat those paths as relative.

Current workaround is to specify inside of tasks.json:

"problemMatcher": [
    {
        "base": "$rustc",
        "fileLocation": "autoDetect"
    }
]
@kjeremy
Copy link
Contributor

kjeremy commented Jul 22, 2020

Do you have an easily reproducible test case for this? PRs welcome!

@rickvanprim
Copy link
Contributor Author

Here's a zip file of a basic workspace with two crates, executable and library. If you run cargo build inside of executable (or specify it from the root with --manifest-path executable/Cargo.toml), you'll notice that the compile error inside of library prints an absolute path.
RustAnalyzer_5482.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants