aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-01-12 18:56:11 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-01-12 18:56:11 +0000
commite56072bfa3e5af69a4c293a38de6e1350ada3573 (patch)
treec7093fca262cedfc1fce2ba7499330fbb343c702 /editors
parentee80a92ed4245f1b6e2b11127c8636b63930073d (diff)
parent5bf739c824c25867811163e05f706ff3d20bd2e6 (diff)
Merge #500
500: Code lens support for running tests r=matklad a=kjeremy Supports running individual and mod tests. I feel like this kind of abuses the `Runnables` infrastructure but it works. Maybe later on down the line we should introduce a struct that is really just a tuple of binary, arguments, and environment and pass that back to the client instead. `run_single.ts` is just a paired down version of `runnables.ts` and there is duplication because I think run_single will probably change independent of runnables. Co-authored-by: Jeremy A. Kolb <[email protected]> Co-authored-by: Jeremy Kolb <[email protected]>
Diffstat (limited to 'editors')
-rw-r--r--editors/code/src/commands/runnables.ts16
-rw-r--r--editors/code/src/extension.ts3
2 files changed, 19 insertions, 0 deletions
diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/commands/runnables.ts
index be17c8944..f9a4e2fc9 100644
--- a/editors/code/src/commands/runnables.ts
+++ b/editors/code/src/commands/runnables.ts
@@ -103,3 +103,19 @@ export async function handle() {
103 return await vscode.tasks.executeTask(task); 103 return await vscode.tasks.executeTask(task);
104 } 104 }
105} 105}
106
107export async function handleSingle(runnable: Runnable) {
108 const editor = vscode.window.activeTextEditor;
109 if (editor == null || editor.document.languageId !== 'rust') {
110 return;
111 }
112
113 const task = createTask(runnable);
114 task.group = vscode.TaskGroup.Build;
115 task.presentationOptions = {
116 reveal: vscode.TaskRevealKind.Always,
117 panel: vscode.TaskPanelKind.Dedicated,
118 };
119
120 return vscode.tasks.executeTask(task);
121} \ No newline at end of file
diff --git a/editors/code/src/extension.ts b/editors/code/src/extension.ts
index 4acd54d90..9edfb13b5 100644
--- a/editors/code/src/extension.ts
+++ b/editors/code/src/extension.ts
@@ -55,6 +55,9 @@ export function activate(context: vscode.ExtensionContext) {
55 ); 55 );
56 overrideCommand('type', commands.onEnter.handle); 56 overrideCommand('type', commands.onEnter.handle);
57 57
58 // Unlike the above this does not send requests to the language server
59 registerCommand('ra-lsp.run-single', commands.runnables.handleSingle);
60
58 // Notifications are events triggered by the language server 61 // Notifications are events triggered by the language server
59 const allNotifications: Iterable< 62 const allNotifications: Iterable<
60 [string, lc.GenericNotificationHandler] 63 [string, lc.GenericNotificationHandler]