diff options
Diffstat (limited to 'editors/code')
-rw-r--r-- | editors/code/src/cargo.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/editors/code/src/cargo.ts b/editors/code/src/cargo.ts index ba286c0ab..4ff24ea7d 100644 --- a/editors/code/src/cargo.ts +++ b/editors/code/src/cargo.ts | |||
@@ -48,12 +48,17 @@ export class Cargo { | |||
48 | 48 | ||
49 | async executableFromArgs(args: readonly string[]): Promise<string> { | 49 | async executableFromArgs(args: readonly string[]): Promise<string> { |
50 | const cargoArgs = [...args, "--message-format=json"]; | 50 | const cargoArgs = [...args, "--message-format=json"]; |
51 | if( cargoArgs[0] == "run" ) { | 51 | if (cargoArgs[0] === "run") { |
52 | // a runnable from the quick pick. | 52 | // a runnable from the quick pick. |
53 | cargoArgs[0] = "build"; | 53 | cargoArgs[0] = "build"; |
54 | } | 54 | } |
55 | 55 | ||
56 | const artifacts = await this.artifactsFromArgs(cargoArgs); | 56 | let artifacts = await this.artifactsFromArgs(cargoArgs); |
57 | if (cargoArgs[0] === "test") { | ||
58 | // for instance, `crates\rust-analyzer\tests\heavy_tests\main.rs` tests | ||
59 | // produce 2 artifacts: {"kind": "bin"} and {"kind": "test"} | ||
60 | artifacts = artifacts.filter(a => a.isTest); | ||
61 | } | ||
57 | 62 | ||
58 | if (artifacts.length === 0) { | 63 | if (artifacts.length === 0) { |
59 | throw new Error('No compilation artifacts'); | 64 | throw new Error('No compilation artifacts'); |