Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

Workspaces-related Linting Issue: File not found #378

Open
mmstick opened this issue Mar 12, 2018 · 1 comment
Open

Workspaces-related Linting Issue: File not found #378

mmstick opened this issue Mar 12, 2018 · 1 comment

Comments

@mmstick
Copy link

mmstick commented Mar 12, 2018

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
Copy link

aeplay commented May 24, 2018

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:

export function normalizeDiagnosticPath(diagnosticPath: string, projectPath: string): string {
if (isAbsolute(diagnosticPath)) {
return diagnosticPath;
} else {
return join(projectPath, diagnosticPath);
}
}

In particular, at the call site, just cwd is passed as projectPath, which is wrong in the case of cargo-workspace multi-crate projects:

fileDiagnostic.filePath = normalizeDiagnosticPath(fileDiagnostic.filePath, cwd);

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

No branches or pull requests

2 participants