aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Matuszewski <[email protected]>2019-03-18 19:47:52 +0000
committerIgor Matuszewski <[email protected]>2019-03-18 19:47:52 +0000
commit9f1ae658dbb0d091bd384efbab93d622e5fff49f (patch)
treedadc81dc88c45a563538c9e7f2baaa71daab2a36
parentbc560a2f5b323b6b3581b30e97cd8cca792ddb65 (diff)
Define a cargo watch task
-rw-r--r--editors/code/src/commands/runnables.ts22
1 files changed, 21 insertions, 1 deletions
diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/commands/runnables.ts
index 28ad7a302..74d664034 100644
--- a/editors/code/src/commands/runnables.ts
+++ b/editors/code/src/commands/runnables.ts
@@ -33,7 +33,7 @@ interface CargoTaskDefinition extends vscode.TaskDefinition {
33 env?: { [key: string]: string }; 33 env?: { [key: string]: string };
34} 34}
35 35
36function createTask(spec: Runnable): vscode.Task { 36export function createTask(spec: Runnable): vscode.Task {
37 const TASK_SOURCE = 'Rust'; 37 const TASK_SOURCE = 'Rust';
38 const definition: CargoTaskDefinition = { 38 const definition: CargoTaskDefinition = {
39 type: 'cargo', 39 type: 'cargo',
@@ -123,3 +123,23 @@ export async function handleSingle(runnable: Runnable) {
123 123
124 return vscode.tasks.executeTask(task); 124 return vscode.tasks.executeTask(task);
125} 125}
126
127export const autoCargoWatchTask: vscode.Task = {
128 name: 'cargo watch',
129 source: 'rust-analyzer',
130 definition: {
131 type: "dupa",
132 },
133 execution: new vscode.ShellExecution('cargo', ['watch'], { cwd: '.' }),
134
135 isBackground: true,
136 problemMatchers: ['$rustc-watch'],
137 presentationOptions: {
138 clear: true
139 },
140 // Not yet exposed in the vscode.d.ts
141 runOptions: {
142 runOn: 2 // RunOnOptions.folderOpen, https://github.com/Microsoft/vscode/blob/ea7c31d770e04b51d586b0d3944f3a7feb03afb9/src/vs/workbench/contrib/tasks/common/tasks.ts#L444-L456
143 } as unknown as vscode.RunOptions,
144
145};