diff --git a/package.json b/package.json index 72824ad..a778ce6 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,10 @@ "file": { "type": "string", "description": "The setup.py file path that provides the command. Can be omitted and root is assumed." + }, + "args": { + "type": "array", + "description": "Optional list of arguments to the task" } } }, @@ -50,6 +54,10 @@ "file": { "type": "string", "description": "The manage.py file path that provides the command. Can be omitted and root is assumed." + }, + "args": { + "type": "array", + "description": "Optional list of arguments to the task" } } } diff --git a/src/djangoTaskProvider.ts b/src/djangoTaskProvider.ts index 3b26d3d..932e65c 100644 --- a/src/djangoTaskProvider.ts +++ b/src/djangoTaskProvider.ts @@ -29,11 +29,14 @@ export class DjangoTaskProvider implements vscode.TaskProvider { public resolveTask(_task: vscode.Task): vscode.Task | undefined { const task = _task.definition.task; - + var pythonPath = vscode.workspace.getConfiguration('python').get('pythonPath'); + if (!pythonPath){ + pythonPath = 'python'; + } if (task) { // resolveTask requires that the same definition object be used. const definition: DjangoTaskDefinition = _task.definition; - return new vscode.Task(definition, _task.scope ?? vscode.TaskScope.Workspace, definition.task, 'django', new vscode.ShellExecution(`python ${definition.task}`)); + return new vscode.Task(definition, _task.scope ?? vscode.TaskScope.Workspace, definition.task, 'django', new vscode.ShellExecution(`${pythonPath} ${definition.task}`)); } return undefined; } diff --git a/src/setupToolsTaskProvider.ts b/src/setupToolsTaskProvider.ts index b739d6e..3273962 100644 --- a/src/setupToolsTaskProvider.ts +++ b/src/setupToolsTaskProvider.ts @@ -29,11 +29,14 @@ export class SetupToolsTaskProvider implements vscode.TaskProvider { public resolveTask(_task: vscode.Task): vscode.Task | undefined { const task = _task.definition.task; - + var pythonPath = vscode.workspace.getConfiguration('python').get('pythonPath'); + if (!pythonPath){ + pythonPath = 'python'; + } if (task) { // resolveTask requires that the same definition object be used. const definition: SetupToolsTaskDefinition = _task.definition; - return new vscode.Task(definition, _task.scope ?? vscode.TaskScope.Workspace, definition.task, 'setuptools', new vscode.ShellExecution(`python ${definition.task}`)); + return new vscode.Task(definition, _task.scope ?? vscode.TaskScope.Workspace, definition.task, 'setuptools', new vscode.ShellExecution(`${pythonPath} ${definition.task}`)); } return undefined; }