mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
Debug use cargo workspace root as cwd. fixes #13022
This commit is contained in:
parent
c7c582afb5
commit
4ca86edac9
2 changed files with 30 additions and 11 deletions
|
@ -9,11 +9,17 @@ import { unwrapUndefinable } from "./undefinable";
|
|||
|
||||
interface CompilationArtifact {
|
||||
fileName: string;
|
||||
workspace: string;
|
||||
name: string;
|
||||
kind: string;
|
||||
isTest: boolean;
|
||||
}
|
||||
|
||||
export interface ExecutableInfo {
|
||||
executable: string;
|
||||
workspace: string;
|
||||
}
|
||||
|
||||
export interface ArtifactSpec {
|
||||
cargoArgs: string[];
|
||||
filter?: (artifacts: CompilationArtifact[]) => CompilationArtifact[];
|
||||
|
@ -68,6 +74,7 @@ export class Cargo {
|
|||
artifacts.push({
|
||||
fileName: message.executable,
|
||||
name: message.target.name,
|
||||
workspace: message.manifest_path.replace(/\/Cargo\.toml$/, ""),
|
||||
kind: message.target.kind[0],
|
||||
isTest: message.profile.test,
|
||||
});
|
||||
|
@ -86,7 +93,7 @@ export class Cargo {
|
|||
return spec.filter?.(artifacts) ?? artifacts;
|
||||
}
|
||||
|
||||
async executableFromArgs(args: readonly string[]): Promise<string> {
|
||||
async executableInfoFromArgs(args: readonly string[]): Promise<ExecutableInfo> {
|
||||
const artifacts = await this.getArtifacts(Cargo.artifactSpec(args));
|
||||
|
||||
if (artifacts.length === 0) {
|
||||
|
@ -96,7 +103,10 @@ export class Cargo {
|
|||
}
|
||||
|
||||
const artifact = unwrapUndefinable(artifacts[0]);
|
||||
return artifact.fileName;
|
||||
return {
|
||||
executable: artifact.fileName,
|
||||
workspace: artifact.workspace,
|
||||
};
|
||||
}
|
||||
|
||||
private async runCargo(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue