editor-rs / vscode-rust

Rust for Visual Studio Code
MIT License
474 stars 62 forks source link

Workspaces-related Linting Issue: `File not found` #378

Open mmstick opened 6 years ago

mmstick commented 6 years ago

Version of VSCode: 1.21.0 Version of the extension: 0.4.2 OS: Pop!_OS 17.04

Description:

It seems that paths are getting mangled when trying to open a file that is within a workspace. When problems are detected and outlined within Code, and you decide to click on a problem to open that file to the line specified, rather than opening $root/$workspace/src/$file, it will try to open $root/$workspace/$workspace/src/$file instead.

For example, rather than opening distinst/cli/src/main.rs, it is trying to open distinst/cli/cli/src/main.rs. Having this issue with the development of distinst and muff

aeplay commented 6 years ago

Version of VSCode: 1.23.1 Version of the extension: 0.4.2 OS: MacOS

Experiencing exactly the same issue as described by @mmstick Dug around in the code a little bit, the culprit seems to be: https://github.com/editor-rs/vscode-rust/blob/92e601e1e84b3da142f25291852e4714662a6623/src/components/cargo/diagnostic_utils.ts#L13-L19

In particular, at the call site, just cwd is passed as projectPath, which is wrong in the case of cargo-workspace multi-crate projects: https://github.com/editor-rs/vscode-rust/blob/767bdaf9f06b4e00ed47513d545a0d22db3a1a50/src/components/cargo/output_channel_task_manager.ts#L76