diff options
author | vsrs <[email protected]> | 2020-05-14 12:42:40 +0100 |
---|---|---|
committer | vsrs <[email protected]> | 2020-05-14 12:42:40 +0100 |
commit | 5f6cdae18f415b9af3b3d24234ab2943efb30993 (patch) | |
tree | 4a8169129142dff92d0e8622016b085d284aa4d0 /editors/code | |
parent | af7c50f8a2e6763d4d72d0fa0b33e62b12aaf1c7 (diff) |
Mixed "bin" and "test" artifacts workaround.
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'); |