mirror of
https://github.com/RustyRaptor/python-task-provider.git
synced 2026-12-04 13:45:15 -07:00
Add args to tasks. Use venv in task resolver
This commit is contained in:
3 files changed
+18
-4
No files matched your search
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 = <any>_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;
|
||||
}
|
||||
|
||||
@@ -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 = <any>_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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user