Support loading OUT_DIR from cargo check at launch

This commit is contained in:
Emil Lauridsen
2020-03-16 13:43:29 +01:00
parent 2720e2374b
commit 33c6c7abc6
10 changed files with 242 additions and 108 deletions

View File

@@ -362,6 +362,11 @@
},
"default": [],
"description": "List of features to activate"
},
"rust-analyzer.cargoFeatures.loadOutDirsFromCheck": {
"type": "boolean",
"default": false,
"markdownDescription": "Run `cargo check` on startup to get the correct value for package OUT_DIRs"
}
}
},

View File

@@ -22,6 +22,7 @@ export interface CargoFeatures {
noDefaultFeatures: boolean;
allFeatures: boolean;
features: string[];
loadOutDirsFromCheck: boolean;
}
export const enum UpdatesChannel {
@@ -204,6 +205,7 @@ export class Config {
get featureFlags() { return this.cfg.get("featureFlags") as Record<string, boolean>; }
get additionalOutDirs() { return this.cfg.get("additionalOutDirs") as Record<string, string>; }
get rustfmtArgs() { return this.cfg.get("rustfmtArgs") as string[]; }
get loadOutDirsFromCheck() { return this.cfg.get("loadOutDirsFromCheck") as boolean; }
get cargoWatchOptions(): CargoWatchOptions {
return {
@@ -219,6 +221,7 @@ export class Config {
noDefaultFeatures: this.cfg.get("cargoFeatures.noDefaultFeatures") as boolean,
allFeatures: this.cfg.get("cargoFeatures.allFeatures") as boolean,
features: this.cfg.get("cargoFeatures.features") as string[],
loadOutDirsFromCheck: this.cfg.get("cargoFeatures.loadOutDirsFromCheck") as boolean,
};
}