diff options
author | Tim <[email protected]> | 2020-03-31 09:01:41 +0100 |
---|---|---|
committer | Tim Hutt <[email protected]> | 2020-03-31 09:06:46 +0100 |
commit | 6e535915bda524de34f011f75067132e88a3a3cc (patch) | |
tree | 2ac5bb244d501ef0fbf0d2279aeb063fbf10673d | |
parent | 768aa4259fce15f313042892739ed4d8b7e518b4 (diff) |
Use namespace import
-rw-r--r-- | editors/code/src/tasks.ts | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/editors/code/src/tasks.ts b/editors/code/src/tasks.ts index be036b872..fa1c4a951 100644 --- a/editors/code/src/tasks.ts +++ b/editors/code/src/tasks.ts | |||
@@ -1,19 +1,11 @@ | |||
1 | import { | 1 | import * as vscode from 'vscode'; |
2 | Disposable, | ||
3 | ShellExecution, | ||
4 | Task, | ||
5 | TaskGroup, | ||
6 | TaskProvider, | ||
7 | tasks, | ||
8 | WorkspaceFolder, | ||
9 | } from 'vscode'; | ||
10 | 2 | ||
11 | // This ends up as the `type` key in tasks.json. RLS also uses `cargo` and | 3 | // This ends up as the `type` key in tasks.json. RLS also uses `cargo` and |
12 | // our configuration should be compatible with it so use the same key. | 4 | // our configuration should be compatible with it so use the same key. |
13 | const TASK_TYPE = 'cargo'; | 5 | const TASK_TYPE = 'cargo'; |
14 | 6 | ||
15 | export function activateTaskProvider(target: WorkspaceFolder): Disposable { | 7 | export function activateTaskProvider(target: vscode.WorkspaceFolder): vscode.Disposable { |
16 | const provider: TaskProvider = { | 8 | const provider: vscode.TaskProvider = { |
17 | // Detect Rust tasks. Currently we do not do any actual detection | 9 | // Detect Rust tasks. Currently we do not do any actual detection |
18 | // of tasks (e.g. aliases in .cargo/config) and just return a fixed | 10 | // of tasks (e.g. aliases in .cargo/config) and just return a fixed |
19 | // set of tasks that always exist. These tasks cannot be removed in | 11 | // set of tasks that always exist. These tasks cannot be removed in |
@@ -24,19 +16,19 @@ export function activateTaskProvider(target: WorkspaceFolder): Disposable { | |||
24 | resolveTask: () => undefined, | 16 | resolveTask: () => undefined, |
25 | }; | 17 | }; |
26 | 18 | ||
27 | return tasks.registerTaskProvider(TASK_TYPE, provider); | 19 | return vscode.tasks.registerTaskProvider(TASK_TYPE, provider); |
28 | } | 20 | } |
29 | 21 | ||
30 | function getStandardCargoTasks(target: WorkspaceFolder): Task[] { | 22 | function getStandardCargoTasks(target: vscode.WorkspaceFolder): vscode.Task[] { |
31 | return [ | 23 | return [ |
32 | { command: 'build', group: TaskGroup.Build }, | 24 | { command: 'build', group: vscode.TaskGroup.Build }, |
33 | { command: 'check', group: TaskGroup.Build }, | 25 | { command: 'check', group: vscode.TaskGroup.Build }, |
34 | { command: 'test', group: TaskGroup.Test }, | 26 | { command: 'test', group: vscode.TaskGroup.Test }, |
35 | { command: 'clean', group: TaskGroup.Clean }, | 27 | { command: 'clean', group: vscode.TaskGroup.Clean }, |
36 | { command: 'run', group: undefined }, | 28 | { command: 'run', group: undefined }, |
37 | ] | 29 | ] |
38 | .map(({ command, group }) => { | 30 | .map(({ command, group }) => { |
39 | const vscodeTask = new Task( | 31 | const vscodeTask = new vscode.Task( |
40 | // The contents of this object end up in the tasks.json entries. | 32 | // The contents of this object end up in the tasks.json entries. |
41 | { | 33 | { |
42 | type: TASK_TYPE, | 34 | type: TASK_TYPE, |
@@ -50,7 +42,7 @@ function getStandardCargoTasks(target: WorkspaceFolder): Task[] { | |||
50 | `cargo ${command}`, | 42 | `cargo ${command}`, |
51 | 'rust', | 43 | 'rust', |
52 | // What to do when this command is executed. | 44 | // What to do when this command is executed. |
53 | new ShellExecution('cargo', [command]), | 45 | new vscode.ShellExecution('cargo', [command]), |
54 | // Problem matchers. | 46 | // Problem matchers. |
55 | ['$rustc'], | 47 | ['$rustc'], |
56 | ); | 48 | ); |