aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands/runnables.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/commands/runnables.ts')
-rw-r--r--editors/code/src/commands/runnables.ts17
1 files changed, 13 insertions, 4 deletions
diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/commands/runnables.ts
index c4df24c79..26372c1e8 100644
--- a/editors/code/src/commands/runnables.ts
+++ b/editors/code/src/commands/runnables.ts
@@ -5,7 +5,7 @@ import * as vscode from 'vscode';
5import * as lc from 'vscode-languageclient'; 5import * as lc from 'vscode-languageclient';
6 6
7import { Server } from '../server'; 7import { Server } from '../server';
8import { CargoWatchProvider } from './cargo_watch'; 8import { CargoWatchProvider, registerCargoWatchProvider } from './cargo_watch';
9 9
10interface RunnablesParams { 10interface RunnablesParams {
11 textDocument: lc.TextDocumentIdentifier; 11 textDocument: lc.TextDocumentIdentifier;
@@ -137,7 +137,7 @@ export async function handleSingle(runnable: Runnable) {
137 */ 137 */
138export async function interactivelyStartCargoWatch( 138export async function interactivelyStartCargoWatch(
139 context: vscode.ExtensionContext 139 context: vscode.ExtensionContext
140) { 140): Promise<CargoWatchProvider | undefined> {
141 if (Server.config.cargoWatchOptions.enableOnStartup === 'disabled') { 141 if (Server.config.cargoWatchOptions.enableOnStartup === 'disabled') {
142 return; 142 return;
143 } 143 }
@@ -153,6 +153,12 @@ export async function interactivelyStartCargoWatch(
153 } 153 }
154 } 154 }
155 155
156 return startCargoWatch(context);
157}
158
159export async function startCargoWatch(
160 context: vscode.ExtensionContext
161): Promise<CargoWatchProvider | undefined> {
156 const execPromise = util.promisify(child_process.exec); 162 const execPromise = util.promisify(child_process.exec);
157 163
158 const { stderr } = await execPromise('cargo watch --version').catch(e => e); 164 const { stderr } = await execPromise('cargo watch --version').catch(e => e);
@@ -197,6 +203,9 @@ export async function interactivelyStartCargoWatch(
197 } 203 }
198 } 204 }
199 205
200 const validater = new CargoWatchProvider(); 206 const provider = await registerCargoWatchProvider(context.subscriptions);
201 validater.activate(context.subscriptions); 207 if (provider) {
208 provider.start();
209 }
210 return provider;
202} 211}