mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 19:18:59 +01:00
Add workspace folders to task API
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import URI from 'vs/base/common/uri';
|
||||
import * as nls from 'vs/nls';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as Objects from 'vs/base/common/objects';
|
||||
@@ -326,10 +327,11 @@ namespace Tasks {
|
||||
return undefined;
|
||||
}
|
||||
command.presentation = PresentationOptions.from(task.presentationOptions);
|
||||
let source = {
|
||||
let source: TaskSystem.ExtensionTaskSource = {
|
||||
kind: TaskSystem.TaskSourceKind.Extension,
|
||||
label: typeof task.source === 'string' ? task.source : extension.name,
|
||||
extension: extension.id
|
||||
extension: extension.id,
|
||||
workspaceFolder: task.workspaceFolder ? { uri: task.workspaceFolder.uri as URI } : undefined
|
||||
};
|
||||
let label = nls.localize('task.label', '{0}: {1}', source.label, task.name);
|
||||
let key = (task as types.Task).definitionKey;
|
||||
|
||||
@@ -1218,6 +1218,7 @@ export class Task implements vscode.Task {
|
||||
|
||||
private _definition: vscode.TaskDefinition;
|
||||
private _definitionKey: string;
|
||||
private _workspaceFolder: vscode.WorkspaceFolder;
|
||||
private _name: string;
|
||||
private _execution: ProcessExecution | ShellExecution;
|
||||
private _problemMatchers: string[];
|
||||
@@ -1227,11 +1228,23 @@ export class Task implements vscode.Task {
|
||||
private _group: TaskGroup;
|
||||
private _presentationOptions: vscode.TaskPresentationOptions;
|
||||
|
||||
constructor(definition: vscode.TaskDefinition, name: string, source: string, execution?: ProcessExecution | ShellExecution, problemMatchers?: string | string[]) {
|
||||
constructor(definition: vscode.TaskDefinition, name: string, source: string, execution?: ProcessExecution | ShellExecution, problemMatchers?: string | string[]);
|
||||
constructor(definition: vscode.TaskDefinition, workspaceFolder: vscode.WorkspaceFolder, name: string, source: string, execution?: ProcessExecution | ShellExecution, problemMatchers?: string | string[]);
|
||||
constructor(definition: vscode.TaskDefinition, arg2: string | vscode.WorkspaceFolder, arg3: any, arg4?: any, arg5?: any, arg6?: any) {
|
||||
this.definition = definition;
|
||||
this.name = name;
|
||||
this.source = source;
|
||||
this.execution = execution;
|
||||
let problemMatchers: string | string[];
|
||||
if (typeof arg2 === 'string') {
|
||||
this.name = arg2;
|
||||
this.source = arg3;
|
||||
this.execution = arg4;
|
||||
problemMatchers = arg5;
|
||||
} else {
|
||||
this.workspaceFolder = arg2;
|
||||
this.name = arg3;
|
||||
this.source = arg4;
|
||||
this.execution = arg5;
|
||||
problemMatchers = arg6;
|
||||
}
|
||||
if (typeof problemMatchers === 'string') {
|
||||
this._problemMatchers = [problemMatchers];
|
||||
this._hasDefinedMatchers = true;
|
||||
@@ -1266,6 +1279,14 @@ export class Task implements vscode.Task {
|
||||
return this._definitionKey;
|
||||
}
|
||||
|
||||
get workspaceFolder(): vscode.WorkspaceFolder {
|
||||
return this._workspaceFolder;
|
||||
}
|
||||
|
||||
set workspaceFolder(value: vscode.WorkspaceFolder) {
|
||||
this._workspaceFolder = value;
|
||||
}
|
||||
|
||||
get name(): string {
|
||||
return this._name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user