aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/config.ts
diff options
context:
space:
mode:
authorEmil Lauridsen <[email protected]>2019-12-25 15:50:38 +0000
committerEmil Lauridsen <[email protected]>2019-12-25 16:37:40 +0000
commit6af4bf7a8d27e653d2e6316172fe140871054d27 (patch)
treeb1a3eed872b7659eb5400e5f2e117a0d008052f9 /editors/code/src/config.ts
parent41a1ec723ce2ea3fa78ae468830f0a77e5658307 (diff)
Configuration plumbing for cargo watcher
Diffstat (limited to 'editors/code/src/config.ts')
-rw-r--r--editors/code/src/config.ts59
1 files changed, 15 insertions, 44 deletions
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';
4 4
5const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; 5const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG;
6 6
7export type CargoWatchStartupOptions = 'ask' | 'enabled' | 'disabled'; 7export interface CargoCheckOptions {
8export type CargoWatchTraceOptions = 'off' | 'error' | 'verbose'; 8 enabled: boolean;
9 9 arguments: string[];
10export interface CargoWatchOptions { 10 command: null | string;
11 enableOnStartup: CargoWatchStartupOptions;
12 arguments: string;
13 command: string;
14 trace: CargoWatchTraceOptions;
15 ignore: string[];
16 allTargets: boolean;
17} 11}
18 12
19export interface CargoFeatures { 13export interface CargoFeatures {
@@ -35,13 +29,10 @@ export class Config {
35 public featureFlags = {}; 29 public featureFlags = {};
36 // for internal use 30 // for internal use
37 public withSysroot: null | boolean = null; 31 public withSysroot: null | boolean = null;
38 public cargoWatchOptions: CargoWatchOptions = { 32 public cargoCheckOptions: CargoCheckOptions = {
39 enableOnStartup: 'ask', 33 enabled: true,
40 trace: 'off', 34 arguments: [],
41 arguments: '', 35 command: null,
42 command: '',
43 ignore: [],
44 allTargets: true,
45 }; 36 };
46 public cargoFeatures: CargoFeatures = { 37 public cargoFeatures: CargoFeatures = {
47 noDefaultFeatures: false, 38 noDefaultFeatures: false,
@@ -100,47 +91,27 @@ export class Config {
100 RA_LSP_DEBUG || (config.get('raLspServerPath') as string); 91 RA_LSP_DEBUG || (config.get('raLspServerPath') as string);
101 } 92 }
102 93
103 if (config.has('enableCargoWatchOnStartup')) { 94 if (config.has('enableCargoCheck')) {
104 this.cargoWatchOptions.enableOnStartup = config.get< 95 this.cargoCheckOptions.enabled = config.get<boolean>(
105 CargoWatchStartupOptions 96 'enableCargoCheck',
106 >('enableCargoWatchOnStartup', 'ask'); 97 true,
107 }
108
109 if (config.has('trace.cargo-watch')) {
110 this.cargoWatchOptions.trace = config.get<CargoWatchTraceOptions>(
111 'trace.cargo-watch',
112 'off',
113 ); 98 );
114 } 99 }
115 100
116 if (config.has('cargo-watch.arguments')) { 101 if (config.has('cargo-watch.arguments')) {
117 this.cargoWatchOptions.arguments = config.get<string>( 102 this.cargoCheckOptions.arguments = config.get<string[]>(
118 'cargo-watch.arguments', 103 'cargo-watch.arguments',
119 '', 104 [],
120 ); 105 );
121 } 106 }
122 107
123 if (config.has('cargo-watch.command')) { 108 if (config.has('cargo-watch.command')) {
124 this.cargoWatchOptions.command = config.get<string>( 109 this.cargoCheckOptions.command = config.get<string>(
125 'cargo-watch.command', 110 'cargo-watch.command',
126 '', 111 '',
127 ); 112 );
128 } 113 }
129 114
130 if (config.has('cargo-watch.ignore')) {
131 this.cargoWatchOptions.ignore = config.get<string[]>(
132 'cargo-watch.ignore',
133 [],
134 );
135 }
136
137 if (config.has('cargo-watch.allTargets')) {
138 this.cargoWatchOptions.allTargets = config.get<boolean>(
139 'cargo-watch.allTargets',
140 true,
141 );
142 }
143
144 if (config.has('lruCapacity')) { 115 if (config.has('lruCapacity')) {
145 this.lruCapacity = config.get('lruCapacity') as number; 116 this.lruCapacity = config.get('lruCapacity') as number;
146 } 117 }