Add additional_outdirs in config

This commit is contained in:
Edwin Cheng 2020-03-10 21:58:15 +08:00
parent 6b9d66bbee
commit c1db5d26a0
6 changed files with 13 additions and 0 deletions

View file

@ -44,6 +44,9 @@ pub struct ServerConfig {
/// Fine grained feature flags to disable specific features. /// Fine grained feature flags to disable specific features.
pub feature_flags: FxHashMap<String, bool>, pub feature_flags: FxHashMap<String, bool>,
/// Fine grained controls for additional `OUT_DIR` env variables
pub additional_out_dirs: FxHashMap<String, String>,
pub rustfmt_args: Vec<String>, pub rustfmt_args: Vec<String>,
/// Cargo feature configurations. /// Cargo feature configurations.
@ -64,6 +67,7 @@ impl Default for ServerConfig {
cargo_watch_all_targets: true, cargo_watch_all_targets: true,
with_sysroot: true, with_sysroot: true,
feature_flags: FxHashMap::default(), feature_flags: FxHashMap::default(),
additional_out_dirs: FxHashMap::default(),
cargo_features: Default::default(), cargo_features: Default::default(),
rustfmt_args: Vec::new(), rustfmt_args: Vec::new(),
} }

View file

@ -195,6 +195,7 @@ pub fn main_loop(
Watch(!config.use_client_watching), Watch(!config.use_client_watching),
options, options,
feature_flags, feature_flags,
config.additional_out_dirs,
) )
}; };

View file

@ -76,6 +76,7 @@ impl WorldState {
watch: Watch, watch: Watch,
options: Options, options: Options,
feature_flags: FeatureFlags, feature_flags: FeatureFlags,
additional_out_dirs: FxHashMap<String, String>,
) -> WorldState { ) -> WorldState {
let mut change = AnalysisChange::new(); let mut change = AnalysisChange::new();

View file

@ -224,6 +224,11 @@
"default": true, "default": true,
"description": "Whether to ask for permission before downloading any files from the Internet" "description": "Whether to ask for permission before downloading any files from the Internet"
}, },
"rust-analyzer.additionalOutDirs": {
"type": "object",
"default": {},
"markdownDescription": "Fine grained controls for OUT_DIR `env!(\"OUT_DIR\")` variable. e.g. `{\"foo\":\"/path/to/foo\"}`, "
},
"rust-analyzer.serverPath": { "rust-analyzer.serverPath": {
"type": [ "type": [
"null", "null",

View file

@ -37,6 +37,7 @@ export async function createClient(config: Config, serverPath: string): Promise<
excludeGlobs: config.excludeGlobs, excludeGlobs: config.excludeGlobs,
useClientWatching: config.useClientWatching, useClientWatching: config.useClientWatching,
featureFlags: config.featureFlags, featureFlags: config.featureFlags,
additionalOutDirs: config.additionalOutDirs,
withSysroot: config.withSysroot, withSysroot: config.withSysroot,
cargoFeatures: config.cargoFeatures, cargoFeatures: config.cargoFeatures,
rustfmtArgs: config.rustfmtArgs, rustfmtArgs: config.rustfmtArgs,

View file

@ -154,6 +154,7 @@ export class Config {
get excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; } get excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; }
get useClientWatching() { return this.cfg.get("useClientWatching") as boolean; } get useClientWatching() { return this.cfg.get("useClientWatching") as boolean; }
get featureFlags() { return this.cfg.get("featureFlags") as Record<string, boolean>; } 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 rustfmtArgs() { return this.cfg.get("rustfmtArgs") as string[]; }
get cargoWatchOptions(): CargoWatchOptions { get cargoWatchOptions(): CargoWatchOptions {