From 6af4bf7a8d27e653d2e6316172fe140871054d27 Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Wed, 25 Dec 2019 16:50:38 +0100 Subject: Configuration plumbing for cargo watcher --- editors/code/src/config.ts | 59 ++++++++++++---------------------------------- 1 file changed, 15 insertions(+), 44 deletions(-) (limited to 'editors/code/src/config.ts') diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index e131f09df..96532e2c9 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -4,16 +4,10 @@ import { Server } from './server'; const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; -export type CargoWatchStartupOptions = 'ask' | 'enabled' | 'disabled'; -export type CargoWatchTraceOptions = 'off' | 'error' | 'verbose'; - -export interface CargoWatchOptions { - enableOnStartup: CargoWatchStartupOptions; - arguments: string; - command: string; - trace: CargoWatchTraceOptions; - ignore: string[]; - allTargets: boolean; +export interface CargoCheckOptions { + enabled: boolean; + arguments: string[]; + command: null | string; } export interface CargoFeatures { @@ -35,13 +29,10 @@ export class Config { public featureFlags = {}; // for internal use public withSysroot: null | boolean = null; - public cargoWatchOptions: CargoWatchOptions = { - enableOnStartup: 'ask', - trace: 'off', - arguments: '', - command: '', - ignore: [], - allTargets: true, + public cargoCheckOptions: CargoCheckOptions = { + enabled: true, + arguments: [], + command: null, }; public cargoFeatures: CargoFeatures = { noDefaultFeatures: false, @@ -100,47 +91,27 @@ export class Config { RA_LSP_DEBUG || (config.get('raLspServerPath') as string); } - if (config.has('enableCargoWatchOnStartup')) { - this.cargoWatchOptions.enableOnStartup = config.get< - CargoWatchStartupOptions - >('enableCargoWatchOnStartup', 'ask'); - } - - if (config.has('trace.cargo-watch')) { - this.cargoWatchOptions.trace = config.get( - 'trace.cargo-watch', - 'off', + if (config.has('enableCargoCheck')) { + this.cargoCheckOptions.enabled = config.get( + 'enableCargoCheck', + true, ); } if (config.has('cargo-watch.arguments')) { - this.cargoWatchOptions.arguments = config.get( + this.cargoCheckOptions.arguments = config.get( 'cargo-watch.arguments', - '', + [], ); } if (config.has('cargo-watch.command')) { - this.cargoWatchOptions.command = config.get( + this.cargoCheckOptions.command = config.get( 'cargo-watch.command', '', ); } - if (config.has('cargo-watch.ignore')) { - this.cargoWatchOptions.ignore = config.get( - 'cargo-watch.ignore', - [], - ); - } - - if (config.has('cargo-watch.allTargets')) { - this.cargoWatchOptions.allTargets = config.get( - 'cargo-watch.allTargets', - true, - ); - } - if (config.has('lruCapacity')) { this.lruCapacity = config.get('lruCapacity') as number; } -- cgit v1.2.3