mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 13:29:44 +00:00
add support for command line arguments in grunt task runner (#82819)
fixes #66748
This commit is contained in:
parent
00de15d765
commit
e10218c359
|
@ -55,6 +55,10 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "%grunt.taskDefinition.type.description%"
|
"description": "%grunt.taskDefinition.type.description%"
|
||||||
},
|
},
|
||||||
|
"args": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "%grunt.taskDefinition.args.description%"
|
||||||
|
},
|
||||||
"file": {
|
"file": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "%grunt.taskDefinition.file.description%"
|
"description": "%grunt.taskDefinition.file.description%"
|
||||||
|
|
|
@ -3,5 +3,6 @@
|
||||||
"displayName": "Grunt support for VS Code",
|
"displayName": "Grunt support for VS Code",
|
||||||
"config.grunt.autoDetect": "Controls whether auto detection of Grunt tasks is on or off. Default is on.",
|
"config.grunt.autoDetect": "Controls whether auto detection of Grunt tasks is on or off. Default is on.",
|
||||||
"grunt.taskDefinition.type.description": "The Grunt task to customize.",
|
"grunt.taskDefinition.type.description": "The Grunt task to customize.",
|
||||||
|
"grunt.taskDefinition.args.description": "Command line arguments to pass to the grunt task",
|
||||||
"grunt.taskDefinition.file.description": "The Grunt file that provides the task. Can be omitted."
|
"grunt.taskDefinition.file.description": "The Grunt file that provides the task. Can be omitted."
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,7 @@ function showError() {
|
||||||
}
|
}
|
||||||
interface GruntTaskDefinition extends vscode.TaskDefinition {
|
interface GruntTaskDefinition extends vscode.TaskDefinition {
|
||||||
task: string;
|
task: string;
|
||||||
|
args?: string[];
|
||||||
file?: string;
|
file?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,14 +122,14 @@ class FolderDetector {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getTask(_task: vscode.Task): Promise<vscode.Task | undefined> {
|
public async getTask(_task: vscode.Task): Promise<vscode.Task | undefined> {
|
||||||
const gruntTask = (<any>_task.definition).task;
|
const taskDefinition = <any>_task.definition;
|
||||||
|
const gruntTask = taskDefinition.task;
|
||||||
if (gruntTask) {
|
if (gruntTask) {
|
||||||
let kind: GruntTaskDefinition = (<any>_task.definition);
|
|
||||||
let options: vscode.ShellExecutionOptions = { cwd: this.workspaceFolder.uri.fsPath };
|
let options: vscode.ShellExecutionOptions = { cwd: this.workspaceFolder.uri.fsPath };
|
||||||
let source = 'grunt';
|
let source = 'grunt';
|
||||||
let task = gruntTask.indexOf(' ') === -1
|
let task = gruntTask.indexOf(' ') === -1
|
||||||
? new vscode.Task(kind, this.workspaceFolder, gruntTask, source, new vscode.ShellExecution(`${await this._gruntCommand} ${gruntTask.name}`, options))
|
? new vscode.Task(taskDefinition, this.workspaceFolder, gruntTask, source, new vscode.ShellExecution(`${await this._gruntCommand}`, [gruntTask, ...taskDefinition.args], options))
|
||||||
: new vscode.Task(kind, this.workspaceFolder, gruntTask, source, new vscode.ShellExecution(`${await this._gruntCommand} "${gruntTask.name}"`, options));
|
: new vscode.Task(taskDefinition, this.workspaceFolder, gruntTask, source, new vscode.ShellExecution(`${await this._gruntCommand}`, [`"${gruntTask}"`, ...taskDefinition.args], options));
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|
Loading…
Reference in a new issue