fix: when running the "discoverProjectCommand", use the Rust file's

parent directory instead of the workspace folder.
This commit is contained in:
David Barsky 2023-04-08 11:22:22 -04:00
parent 51d5862caf
commit b99c129b74
2 changed files with 15 additions and 12 deletions

View file

@ -761,12 +761,13 @@ export function addProject(ctx: CtxInit): Cmd {
}
const workspaces: JsonProject[] = await Promise.all(
vscode.workspace.workspaceFolders!.map(async (folder): Promise<JsonProject> => {
const rustDocuments = vscode.workspace.textDocuments.filter(isRustDocument);
return discoverWorkspace(rustDocuments, discoverProjectCommand, {
cwd: folder.uri.fsPath,
});
})
vscode.workspace.textDocuments
.filter(isRustDocument)
.map(async (file): Promise<JsonProject> => {
return discoverWorkspace([file], discoverProjectCommand, {
cwd: path.dirname(file.uri.fsPath),
});
})
);
ctx.addToDiscoveredWorkspaces(workspaces);