mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Mixed "bin" and "test" artifacts workaround.
This commit is contained in:
parent
af7c50f8a2
commit
5f6cdae18f
1 changed files with 7 additions and 2 deletions
|
@ -48,12 +48,17 @@ export class Cargo {
|
|||
|
||||
async executableFromArgs(args: readonly string[]): Promise<string> {
|
||||
const cargoArgs = [...args, "--message-format=json"];
|
||||
if( cargoArgs[0] == "run" ) {
|
||||
if (cargoArgs[0] === "run") {
|
||||
// a runnable from the quick pick.
|
||||
cargoArgs[0] = "build";
|
||||
}
|
||||
|
||||
const artifacts = await this.artifactsFromArgs(cargoArgs);
|
||||
let artifacts = await this.artifactsFromArgs(cargoArgs);
|
||||
if (cargoArgs[0] === "test") {
|
||||
// for instance, `crates\rust-analyzer\tests\heavy_tests\main.rs` tests
|
||||
// produce 2 artifacts: {"kind": "bin"} and {"kind": "test"}
|
||||
artifacts = artifacts.filter(a => a.isTest);
|
||||
}
|
||||
|
||||
if (artifacts.length === 0) {
|
||||
throw new Error('No compilation artifacts');
|
||||
|
|
Loading…
Reference in a new issue