Change enableCargoWatchOnStartup to have three states

This fixes #1005.

Defaults to `ask` which prompts users each time whether to start `cargo watch`
or not. `enabled` always starts `cargo watch` and `disabled` does not.
This commit is contained in:
Ville Penttinen 2019-03-21 13:56:25 +02:00
parent aa0cc0c609
commit 5c3e9c716e
3 changed files with 31 additions and 16 deletions

View file

@ -4,12 +4,14 @@ import { Server } from './server';
const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG;
export type CargoWatchOptions = 'ask' | 'enabled' | 'disabled';
export class Config {
public highlightingOn = true;
public enableEnhancedTyping = true;
public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server';
public showWorkspaceLoadedNotification = true;
public enableCargoWatchOnStartup = true;
public enableCargoWatchOnStartup: CargoWatchOptions = 'ask';
private prevEnhancedTyping: null | boolean = null;
@ -71,9 +73,9 @@ export class Config {
}
if (config.has('enableCargoWatchOnStartup')) {
this.enableCargoWatchOnStartup = config.get<boolean>(
this.enableCargoWatchOnStartup = config.get<CargoWatchOptions>(
'enableCargoWatchOnStartup',
true
'ask'
);
}
}