diff --git a/package.json b/package.json index ebf617b..5fc8a5f 100644 --- a/package.json +++ b/package.json @@ -218,8 +218,12 @@ "taskDefinitions": [ { "type": "piral", - "required": [], + "required": ["command"], "properties": { + "command": { + "type": "string", + "description": "The command to run (debug, build, validate, declaration)." + }, "flags": { "type": "array", "description": "Additional flags for running piral debug." @@ -229,8 +233,12 @@ }, { "type": "pilet", - "required": [], + "required": ["command"], "properties": { + "command": { + "type": "string", + "description": "The command to run (debug, build, validate, pack)." + }, "flags": { "type": "array", "description": "Additional flags for running pilet debug." diff --git a/src/extension/providers/piletTaskProvider.ts b/src/extension/providers/piletTaskProvider.ts index 3972b30..27dc16d 100644 --- a/src/extension/providers/piletTaskProvider.ts +++ b/src/extension/providers/piletTaskProvider.ts @@ -21,7 +21,11 @@ export class PiletTaskProvider implements vscode.TaskProvider { interface PiletTaskDefinition extends vscode.TaskDefinition { /** - * Additional build flags + * The command to use. + */ + command: string; + /** + * Additional build flags. */ flags?: Array; } @@ -29,6 +33,7 @@ interface PiletTaskDefinition extends vscode.TaskDefinition { function createDebugTask(workspaceFolder: vscode.WorkspaceFolder) { const kind: PiletTaskDefinition = { type: PiletTaskProvider.Type, + command: 'debug', flags: [], }; const command = ['npx', 'pilet', 'debug', ...(kind.flags || [])].join(' '); @@ -41,6 +46,8 @@ function createDebugTask(workspaceFolder: vscode.WorkspaceFolder) { ['$piral-cli-debug'], ); task.isBackground = true; + task.runOptions.reevaluateOnRerun = true; + task.presentationOptions.panel = vscode.TaskPanelKind.New; task.group = vscode.TaskGroup.Build; return task; } @@ -48,6 +55,7 @@ function createDebugTask(workspaceFolder: vscode.WorkspaceFolder) { function createBuildTask(workspaceFolder: vscode.WorkspaceFolder) { const kind: PiletTaskDefinition = { type: PiletTaskProvider.Type, + command: 'build', flags: [], }; const command = ['npx', 'pilet', 'build', ...(kind.flags || [])].join(' '); @@ -59,12 +67,15 @@ function createBuildTask(workspaceFolder: vscode.WorkspaceFolder) { new vscode.ShellExecution(command), ); task.group = vscode.TaskGroup.Build; + task.runOptions.reevaluateOnRerun = true; + task.presentationOptions.panel = vscode.TaskPanelKind.New; return task; } function createValidateTask(workspaceFolder: vscode.WorkspaceFolder) { const kind: PiletTaskDefinition = { type: PiletTaskProvider.Type, + command: 'validate', flags: [], }; const command = ['npx', 'pilet', 'validate', ...(kind.flags || [])].join(' '); @@ -76,12 +87,15 @@ function createValidateTask(workspaceFolder: vscode.WorkspaceFolder) { new vscode.ShellExecution(command), ); task.group = vscode.TaskGroup.Test; + task.runOptions.reevaluateOnRerun = true; + task.presentationOptions.panel = vscode.TaskPanelKind.New; return task; } function createPackTask(workspaceFolder: vscode.WorkspaceFolder) { const kind: PiletTaskDefinition = { type: PiletTaskProvider.Type, + command: 'pack', flags: [], }; const command = ['npx', 'pilet', 'pack', ...(kind.flags || [])].join(' '); @@ -93,6 +107,8 @@ function createPackTask(workspaceFolder: vscode.WorkspaceFolder) { new vscode.ShellExecution(command), ); task.group = vscode.TaskGroup.Build; + task.runOptions.reevaluateOnRerun = true; + task.presentationOptions.panel = vscode.TaskPanelKind.New; return task; } diff --git a/src/extension/providers/piralTaskProvider.ts b/src/extension/providers/piralTaskProvider.ts index 19e19d3..91a92c5 100644 --- a/src/extension/providers/piralTaskProvider.ts +++ b/src/extension/providers/piralTaskProvider.ts @@ -21,7 +21,11 @@ export class PiralTaskProvider implements vscode.TaskProvider { interface PiralTaskDefinition extends vscode.TaskDefinition { /** - * Additional build flags + * The command to use. + */ + command: string; + /** + * Additional build flags. */ flags?: Array; } @@ -29,6 +33,7 @@ interface PiralTaskDefinition extends vscode.TaskDefinition { function createDebugTask(workspaceFolder: vscode.WorkspaceFolder) { const kind: PiralTaskDefinition = { type: PiralTaskProvider.Type, + command: 'debug', flags: [], }; const command = ['npx', 'piral', 'debug', ...(kind.flags || [])].join(' '); @@ -43,6 +48,7 @@ function createDebugTask(workspaceFolder: vscode.WorkspaceFolder) { function createBuildTask(workspaceFolder: vscode.WorkspaceFolder) { const kind: PiralTaskDefinition = { type: PiralTaskProvider.Type, + command: 'build', flags: [], }; const command = ['npx', 'piral', 'build', ...(kind.flags || [])].join(' '); @@ -54,6 +60,7 @@ function createBuildTask(workspaceFolder: vscode.WorkspaceFolder) { function createValidateTask(workspaceFolder: vscode.WorkspaceFolder) { const kind: PiralTaskDefinition = { type: PiralTaskProvider.Type, + command: 'validate', flags: [], }; const command = ['npx', 'piral', 'validate', ...(kind.flags || [])].join(' '); @@ -65,6 +72,7 @@ function createValidateTask(workspaceFolder: vscode.WorkspaceFolder) { function createDeclarationTask(workspaceFolder: vscode.WorkspaceFolder) { const kind: PiralTaskDefinition = { type: PiralTaskProvider.Type, + command: 'declaration', flags: [], }; const command = ['npx', 'piral', 'declaration', ...(kind.flags || [])].join(' ');