Add config for cargo-watch trace

This commit is contained in:
Edwin Cheng 2019-04-02 13:07:40 +08:00
parent b84d0fc1a3
commit ee05eafe6c
5 changed files with 67 additions and 15 deletions

View file

@ -4,14 +4,20 @@ import { Server } from './server';
const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG;
export type CargoWatchOptions = 'ask' | 'enabled' | 'disabled';
export type CargoWatchStartupOptions = 'ask' | 'enabled' | 'disabled';
export type CargoWatchTraceOptions = 'off' | 'error' | 'verbose';
export interface CargoWatchOptions {
enableOnStartup: CargoWatchStartupOptions,
trace: CargoWatchTraceOptions,
};
export class Config {
public highlightingOn = true;
public enableEnhancedTyping = true;
public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server';
public showWorkspaceLoadedNotification = true;
public enableCargoWatchOnStartup: CargoWatchOptions = 'ask';
public cargoWatchOptions: CargoWatchOptions = { enableOnStartup: 'ask', trace: 'off' };
private prevEnhancedTyping: null | boolean = null;
@ -73,10 +79,17 @@ export class Config {
}
if (config.has('enableCargoWatchOnStartup')) {
this.enableCargoWatchOnStartup = config.get<CargoWatchOptions>(
'enableCargoWatchOnStartup',
'ask'
);
this.cargoWatchOptions.enableOnStartup =
config.get<CargoWatchStartupOptions>(
'enableCargoWatchOnStartup',
'ask'
);
this.cargoWatchOptions.trace =
config.get<CargoWatchTraceOptions>(
'trace.cargo-watch',
'off'
);
}
}
}