-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Add problemMatching to task (#989)
* initial attempt * removed dummy task * cleaning up dummy changes * Use RTaskProvider * Update code Co-authored-by: Kun Ren <renkun@outlook.com>
- Loading branch information
1 parent
5f7b9e8
commit 9b525aa
Showing
3 changed files
with
131 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
'use strict'; | ||
|
||
import * as vscode from 'vscode'; | ||
|
||
export class RTaskProvider implements vscode.TaskProvider { | ||
public readonly type = 'R'; | ||
|
||
// `vscode.ShellQuoting.Strong` will treat the "value" as pure string | ||
// and quote them based on the shell used this can ensure it works for | ||
// different shells, e.g., zsh, PowerShell or cmd | ||
private readonly tasks = [ | ||
|
||
new vscode.Task( | ||
{ type: this.type }, | ||
vscode.TaskScope.Workspace, | ||
'Build', | ||
'R', | ||
new vscode.ShellExecution( | ||
'Rscript', | ||
[ | ||
'-e', | ||
{ | ||
value: 'devtools::build()', | ||
quoting: vscode.ShellQuoting.Strong | ||
} | ||
] | ||
) | ||
), | ||
|
||
new vscode.Task( | ||
{ type: this.type }, | ||
vscode.TaskScope.Workspace, | ||
'Check', | ||
'R', | ||
new vscode.ShellExecution( | ||
'Rscript', | ||
[ | ||
'-e', | ||
{ | ||
value: 'devtools::check()', | ||
quoting: vscode.ShellQuoting.Strong | ||
} | ||
] | ||
) | ||
), | ||
|
||
new vscode.Task( | ||
{ type: this.type }, | ||
vscode.TaskScope.Workspace, | ||
'Document', | ||
'R', | ||
new vscode.ShellExecution( | ||
'Rscript', | ||
[ | ||
'-e', | ||
{ | ||
value: 'devtools::document()', | ||
quoting: vscode.ShellQuoting.Strong | ||
} | ||
] | ||
) | ||
), | ||
|
||
new vscode.Task( | ||
{ type: this.type }, | ||
vscode.TaskScope.Workspace, | ||
'Install', | ||
'R', | ||
new vscode.ShellExecution( | ||
'Rscript', | ||
[ | ||
'-e', | ||
{ | ||
value: 'devtools::install()', | ||
quoting: vscode.ShellQuoting.Strong | ||
} | ||
] | ||
) | ||
), | ||
|
||
new vscode.Task( | ||
{ type: this.type }, | ||
vscode.TaskScope.Workspace, | ||
'Test', | ||
'R', | ||
new vscode.ShellExecution( | ||
'Rscript', | ||
[ | ||
'-e', | ||
{ | ||
value: 'devtools::test()', | ||
quoting: vscode.ShellQuoting.Strong | ||
} | ||
] | ||
), | ||
'$testthat' | ||
) | ||
]; | ||
|
||
public provideTasks(): vscode.Task[] { | ||
return this.tasks; | ||
} | ||
|
||
public resolveTask(task: vscode.Task): vscode.Task { | ||
return task; | ||
} | ||
} |