aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorIgor Matuszewski <[email protected]>2019-03-18 21:35:47 +0000
committerIgor Matuszewski <[email protected]>2019-03-18 21:35:47 +0000
commit7c2595c26820917fa9ad1b1c36f01fc6ac979287 (patch)
treedb71a710ca08293583163677aae0ca07a704adfc /editors
parent60cac299640912ad1ad75644bfa0088d7ba6e367 (diff)
Guard auto cargo watch behind a config option
Diffstat (limited to 'editors')
-rw-r--r--editors/code/package.json5
-rw-r--r--editors/code/src/commands/runnables.ts4
-rw-r--r--editors/code/src/config.ts8
3 files changed, 17 insertions, 0 deletions
diff --git a/editors/code/package.json b/editors/code/package.json
index 3834f2847..3e8cde388 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -168,6 +168,11 @@
168 "default": "ra_lsp_server", 168 "default": "ra_lsp_server",
169 "description": "Path to ra_lsp_server executable" 169 "description": "Path to ra_lsp_server executable"
170 }, 170 },
171 "rust-analyzer.enableCargoWatchOnStartup": {
172 "type": "boolean",
173 "default": "true",
174 "description": "When enabled, ask the user whether to run `cargo watch` on startup"
175 },
171 "rust-analyzer.trace.server": { 176 "rust-analyzer.trace.server": {
172 "type": "string", 177 "type": "string",
173 "scope": "window", 178 "scope": "window",
diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/commands/runnables.ts
index 285afaaf6..74407dc3e 100644
--- a/editors/code/src/commands/runnables.ts
+++ b/editors/code/src/commands/runnables.ts
@@ -153,6 +153,10 @@ export const autoCargoWatchTask: vscode.Task = {
153 * that, when accepted, allow us to `cargo install cargo-watch` and then run it. 153 * that, when accepted, allow us to `cargo install cargo-watch` and then run it.
154 */ 154 */
155export async function interactivelyStartCargoWatch() { 155export async function interactivelyStartCargoWatch() {
156 if (!Server.config.enableCargoWatchOnStartup) {
157 return;
158 }
159
156 const execAsync = util.promisify(exec); 160 const execAsync = util.promisify(exec);
157 161
158 const watch = await vscode.window.showInformationMessage( 162 const watch = await vscode.window.showInformationMessage(
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index afc5cc6af..d8795f3b0 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -9,6 +9,7 @@ export class Config {
9 public enableEnhancedTyping = true; 9 public enableEnhancedTyping = true;
10 public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server'; 10 public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server';
11 public showWorkspaceLoadedNotification = true; 11 public showWorkspaceLoadedNotification = true;
12 public enableCargoWatchOnStartup = true;
12 13
13 private prevEnhancedTyping: null | boolean = null; 14 private prevEnhancedTyping: null | boolean = null;
14 15
@@ -68,5 +69,12 @@ export class Config {
68 this.raLspServerPath = 69 this.raLspServerPath =
69 RA_LSP_DEBUG || (config.get('raLspServerPath') as string); 70 RA_LSP_DEBUG || (config.get('raLspServerPath') as string);
70 } 71 }
72
73 if (config.has('enableCargoWatchOnStartup')) {
74 this.enableCargoWatchOnStartup = config.get<boolean>(
75 'enableCargoWatchOnStartup',
76 true
77 );
78 }
71 } 79 }
72} 80}