mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
Use I
prefix for task interfaces (#151350)
This commit is contained in:
parent
c51f8ff55c
commit
7c22caad55
|
@ -10,7 +10,7 @@ import {
|
||||||
detectNpmScriptsForFolder,
|
detectNpmScriptsForFolder,
|
||||||
findScriptAtPosition,
|
findScriptAtPosition,
|
||||||
runScript,
|
runScript,
|
||||||
FolderTaskItem
|
IFolderTaskItem
|
||||||
} from './tasks';
|
} from './tasks';
|
||||||
|
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
@ -37,17 +37,17 @@ export async function selectAndRunScriptFromFolder(context: vscode.ExtensionCont
|
||||||
}
|
}
|
||||||
const selectedFolder = selectedFolders[0];
|
const selectedFolder = selectedFolders[0];
|
||||||
|
|
||||||
let taskList: FolderTaskItem[] = await detectNpmScriptsForFolder(context, selectedFolder);
|
let taskList: IFolderTaskItem[] = await detectNpmScriptsForFolder(context, selectedFolder);
|
||||||
|
|
||||||
if (taskList && taskList.length > 0) {
|
if (taskList && taskList.length > 0) {
|
||||||
const quickPick = vscode.window.createQuickPick<FolderTaskItem>();
|
const quickPick = vscode.window.createQuickPick<IFolderTaskItem>();
|
||||||
quickPick.title = 'Run NPM script in Folder';
|
quickPick.title = 'Run NPM script in Folder';
|
||||||
quickPick.placeholder = 'Select an npm script';
|
quickPick.placeholder = 'Select an npm script';
|
||||||
quickPick.items = taskList;
|
quickPick.items = taskList;
|
||||||
|
|
||||||
const toDispose: vscode.Disposable[] = [];
|
const toDispose: vscode.Disposable[] = [];
|
||||||
|
|
||||||
let pickPromise = new Promise<FolderTaskItem | undefined>((c) => {
|
let pickPromise = new Promise<IFolderTaskItem | undefined>((c) => {
|
||||||
toDispose.push(quickPick.onDidAccept(() => {
|
toDispose.push(quickPick.onDidAccept(() => {
|
||||||
toDispose.forEach(d => d.dispose());
|
toDispose.forEach(d => d.dispose());
|
||||||
c(quickPick.selectedItems[0]);
|
c(quickPick.selectedItems[0]);
|
||||||
|
|
|
@ -14,10 +14,10 @@ import {
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
import { readScripts } from './readScripts';
|
import { readScripts } from './readScripts';
|
||||||
import {
|
import {
|
||||||
createTask, getPackageManager, getTaskName, isAutoDetectionEnabled, isWorkspaceFolder, NpmTaskDefinition,
|
createTask, getPackageManager, getTaskName, isAutoDetectionEnabled, isWorkspaceFolder, INpmTaskDefinition,
|
||||||
NpmTaskProvider,
|
NpmTaskProvider,
|
||||||
startDebugging,
|
startDebugging,
|
||||||
TaskWithLocation
|
ITaskWithLocation
|
||||||
} from './tasks';
|
} from './tasks';
|
||||||
|
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
@ -78,7 +78,7 @@ class NpmScript extends TreeItem {
|
||||||
package: PackageJSON;
|
package: PackageJSON;
|
||||||
taskLocation?: Location;
|
taskLocation?: Location;
|
||||||
|
|
||||||
constructor(_context: ExtensionContext, packageJson: PackageJSON, task: TaskWithLocation) {
|
constructor(_context: ExtensionContext, packageJson: PackageJSON, task: ITaskWithLocation) {
|
||||||
const name = packageJson.path.length > 0
|
const name = packageJson.path.length > 0
|
||||||
? task.task.name.substring(0, task.task.name.length - packageJson.path.length - 2)
|
? task.task.name.substring(0, task.task.name.length - packageJson.path.length - 2)
|
||||||
: task.task.name;
|
: task.task.name;
|
||||||
|
@ -284,7 +284,7 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider<TreeItem> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private buildTaskTree(tasks: TaskWithLocation[]): TaskTree {
|
private buildTaskTree(tasks: ITaskWithLocation[]): TaskTree {
|
||||||
let folders: Map<String, Folder> = new Map();
|
let folders: Map<String, Folder> = new Map();
|
||||||
let packages: Map<String, PackageJSON> = new Map();
|
let packages: Map<String, PackageJSON> = new Map();
|
||||||
|
|
||||||
|
@ -301,7 +301,7 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider<TreeItem> {
|
||||||
}
|
}
|
||||||
const regularExpressions = (location && excludeConfig.has(location.uri.toString())) ? excludeConfig.get(location.uri.toString()) : undefined;
|
const regularExpressions = (location && excludeConfig.has(location.uri.toString())) ? excludeConfig.get(location.uri.toString()) : undefined;
|
||||||
|
|
||||||
if (regularExpressions && regularExpressions.some((regularExpression) => (<NpmTaskDefinition>each.task.definition).script.match(regularExpression))) {
|
if (regularExpressions && regularExpressions.some((regularExpression) => (<INpmTaskDefinition>each.task.definition).script.match(regularExpression))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider<TreeItem> {
|
||||||
folder = new Folder(each.task.scope);
|
folder = new Folder(each.task.scope);
|
||||||
folders.set(each.task.scope.name, folder);
|
folders.set(each.task.scope.name, folder);
|
||||||
}
|
}
|
||||||
let definition: NpmTaskDefinition = <NpmTaskDefinition>each.task.definition;
|
let definition: INpmTaskDefinition = <INpmTaskDefinition>each.task.definition;
|
||||||
let relativePath = definition.path ? definition.path : '';
|
let relativePath = definition.path ? definition.path : '';
|
||||||
let fullPath = path.join(each.task.scope.name, relativePath);
|
let fullPath = path.join(each.task.scope.name, relativePath);
|
||||||
packageJson = packages.get(fullPath);
|
packageJson = packages.get(fullPath);
|
||||||
|
|
|
@ -17,28 +17,28 @@ import { readScripts } from './readScripts';
|
||||||
|
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
export interface NpmTaskDefinition extends TaskDefinition {
|
export interface INpmTaskDefinition extends TaskDefinition {
|
||||||
script: string;
|
script: string;
|
||||||
path?: string;
|
path?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FolderTaskItem extends QuickPickItem {
|
export interface IFolderTaskItem extends QuickPickItem {
|
||||||
label: string;
|
label: string;
|
||||||
task: Task;
|
task: Task;
|
||||||
}
|
}
|
||||||
|
|
||||||
type AutoDetect = 'on' | 'off';
|
type AutoDetect = 'on' | 'off';
|
||||||
|
|
||||||
let cachedTasks: TaskWithLocation[] | undefined = undefined;
|
let cachedTasks: ITaskWithLocation[] | undefined = undefined;
|
||||||
|
|
||||||
const INSTALL_SCRIPT = 'install';
|
const INSTALL_SCRIPT = 'install';
|
||||||
|
|
||||||
export interface TaskLocation {
|
export interface ITaskLocation {
|
||||||
document: Uri;
|
document: Uri;
|
||||||
line: Position;
|
line: Position;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskWithLocation {
|
export interface ITaskWithLocation {
|
||||||
task: Task;
|
task: Task;
|
||||||
location?: Location;
|
location?: Location;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ export class NpmTaskProvider implements TaskProvider {
|
||||||
constructor(private context: ExtensionContext) {
|
constructor(private context: ExtensionContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
get tasksWithLocation(): Promise<TaskWithLocation[]> {
|
get tasksWithLocation(): Promise<ITaskWithLocation[]> {
|
||||||
return provideNpmScripts(this.context, false);
|
return provideNpmScripts(this.context, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ export class NpmTaskProvider implements TaskProvider {
|
||||||
public async resolveTask(_task: Task): Promise<Task | undefined> {
|
public async resolveTask(_task: Task): Promise<Task | undefined> {
|
||||||
const npmTask = (<any>_task.definition).script;
|
const npmTask = (<any>_task.definition).script;
|
||||||
if (npmTask) {
|
if (npmTask) {
|
||||||
const kind: NpmTaskDefinition = (<any>_task.definition);
|
const kind: INpmTaskDefinition = (<any>_task.definition);
|
||||||
let packageJsonUri: Uri;
|
let packageJsonUri: Uri;
|
||||||
if (_task.scope === undefined || _task.scope === TaskScope.Global || _task.scope === TaskScope.Workspace) {
|
if (_task.scope === undefined || _task.scope === TaskScope.Global || _task.scope === TaskScope.Workspace) {
|
||||||
// scope is required to be a WorkspaceFolder for resolveTask
|
// scope is required to be a WorkspaceFolder for resolveTask
|
||||||
|
@ -170,10 +170,10 @@ export async function hasNpmScripts(): Promise<boolean> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function detectNpmScripts(context: ExtensionContext, showWarning: boolean): Promise<TaskWithLocation[]> {
|
async function detectNpmScripts(context: ExtensionContext, showWarning: boolean): Promise<ITaskWithLocation[]> {
|
||||||
|
|
||||||
let emptyTasks: TaskWithLocation[] = [];
|
let emptyTasks: ITaskWithLocation[] = [];
|
||||||
let allTasks: TaskWithLocation[] = [];
|
let allTasks: ITaskWithLocation[] = [];
|
||||||
let visitedPackageJsonFiles: Set<string> = new Set();
|
let visitedPackageJsonFiles: Set<string> = new Set();
|
||||||
|
|
||||||
let folders = workspace.workspaceFolders;
|
let folders = workspace.workspaceFolders;
|
||||||
|
@ -201,9 +201,9 @@ async function detectNpmScripts(context: ExtensionContext, showWarning: boolean)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export async function detectNpmScriptsForFolder(context: ExtensionContext, folder: Uri): Promise<FolderTaskItem[]> {
|
export async function detectNpmScriptsForFolder(context: ExtensionContext, folder: Uri): Promise<IFolderTaskItem[]> {
|
||||||
|
|
||||||
let folderTasks: FolderTaskItem[] = [];
|
let folderTasks: IFolderTaskItem[] = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let relativePattern = new RelativePattern(folder.fsPath, '**/package.json');
|
let relativePattern = new RelativePattern(folder.fsPath, '**/package.json');
|
||||||
|
@ -223,7 +223,7 @@ export async function detectNpmScriptsForFolder(context: ExtensionContext, folde
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function provideNpmScripts(context: ExtensionContext, showWarning: boolean): Promise<TaskWithLocation[]> {
|
export async function provideNpmScripts(context: ExtensionContext, showWarning: boolean): Promise<ITaskWithLocation[]> {
|
||||||
if (!cachedTasks) {
|
if (!cachedTasks) {
|
||||||
cachedTasks = await detectNpmScripts(context, showWarning);
|
cachedTasks = await detectNpmScripts(context, showWarning);
|
||||||
}
|
}
|
||||||
|
@ -261,8 +261,8 @@ function isDebugScript(script: string): boolean {
|
||||||
return match !== null;
|
return match !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function provideNpmScriptsForFolder(context: ExtensionContext, packageJsonUri: Uri, showWarning: boolean): Promise<TaskWithLocation[]> {
|
async function provideNpmScriptsForFolder(context: ExtensionContext, packageJsonUri: Uri, showWarning: boolean): Promise<ITaskWithLocation[]> {
|
||||||
let emptyTasks: TaskWithLocation[] = [];
|
let emptyTasks: ITaskWithLocation[] = [];
|
||||||
|
|
||||||
let folder = workspace.getWorkspaceFolder(packageJsonUri);
|
let folder = workspace.getWorkspaceFolder(packageJsonUri);
|
||||||
if (!folder) {
|
if (!folder) {
|
||||||
|
@ -273,7 +273,7 @@ async function provideNpmScriptsForFolder(context: ExtensionContext, packageJson
|
||||||
return emptyTasks;
|
return emptyTasks;
|
||||||
}
|
}
|
||||||
|
|
||||||
const result: TaskWithLocation[] = [];
|
const result: ITaskWithLocation[] = [];
|
||||||
|
|
||||||
const packageManager = await getPackageManager(context, folder.uri, showWarning);
|
const packageManager = await getPackageManager(context, folder.uri, showWarning);
|
||||||
|
|
||||||
|
@ -294,8 +294,8 @@ export function getTaskName(script: string, relativePath: string | undefined) {
|
||||||
return script;
|
return script;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function createTask(packageManager: string, script: NpmTaskDefinition | string, cmd: string[], folder: WorkspaceFolder, packageJsonUri: Uri, scriptValue?: string, matcher?: any): Promise<Task> {
|
export async function createTask(packageManager: string, script: INpmTaskDefinition | string, cmd: string[], folder: WorkspaceFolder, packageJsonUri: Uri, scriptValue?: string, matcher?: any): Promise<Task> {
|
||||||
let kind: NpmTaskDefinition;
|
let kind: INpmTaskDefinition;
|
||||||
if (typeof script === 'string') {
|
if (typeof script === 'string') {
|
||||||
kind = { type: 'npm', script: script };
|
kind = { type: 'npm', script: script };
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -147,7 +147,7 @@ import { assertNoRpc } from '../utils';
|
||||||
suite('CustomExecution', () => {
|
suite('CustomExecution', () => {
|
||||||
test('task should start and shutdown successfully', async () => {
|
test('task should start and shutdown successfully', async () => {
|
||||||
window.terminals.forEach(terminal => terminal.dispose());
|
window.terminals.forEach(terminal => terminal.dispose());
|
||||||
interface CustomTestingTaskDefinition extends TaskDefinition {
|
interface ICustomTestingTaskDefinition extends TaskDefinition {
|
||||||
/**
|
/**
|
||||||
* One of the task properties. This can be used to customize the task in the tasks.json
|
* One of the task properties. This can be used to customize the task in the tasks.json
|
||||||
*/
|
*/
|
||||||
|
@ -179,7 +179,7 @@ import { assertNoRpc } from '../utils';
|
||||||
disposables.push(tasks.registerTaskProvider(taskType, {
|
disposables.push(tasks.registerTaskProvider(taskType, {
|
||||||
provideTasks: () => {
|
provideTasks: () => {
|
||||||
const result: Task[] = [];
|
const result: Task[] = [];
|
||||||
const kind: CustomTestingTaskDefinition = {
|
const kind: ICustomTestingTaskDefinition = {
|
||||||
type: taskType,
|
type: taskType,
|
||||||
customProp1: 'testing task one'
|
customProp1: 'testing task one'
|
||||||
};
|
};
|
||||||
|
@ -235,7 +235,7 @@ import { assertNoRpc } from '../utils';
|
||||||
});
|
});
|
||||||
|
|
||||||
test('sync task should flush all data on close', async () => {
|
test('sync task should flush all data on close', async () => {
|
||||||
interface CustomTestingTaskDefinition extends TaskDefinition {
|
interface ICustomTestingTaskDefinition extends TaskDefinition {
|
||||||
/**
|
/**
|
||||||
* One of the task properties. This can be used to customize the task in the tasks.json
|
* One of the task properties. This can be used to customize the task in the tasks.json
|
||||||
*/
|
*/
|
||||||
|
@ -250,7 +250,7 @@ import { assertNoRpc } from '../utils';
|
||||||
disposables.push(tasks.registerTaskProvider(taskType, {
|
disposables.push(tasks.registerTaskProvider(taskType, {
|
||||||
provideTasks: () => {
|
provideTasks: () => {
|
||||||
const result: Task[] = [];
|
const result: Task[] = [];
|
||||||
const kind: CustomTestingTaskDefinition = {
|
const kind: ICustomTestingTaskDefinition = {
|
||||||
type: taskType,
|
type: taskType,
|
||||||
customProp1: 'testing task one'
|
customProp1: 'testing task one'
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,27 +15,27 @@ import { IDisposable } from 'vs/base/common/lifecycle';
|
||||||
import { IWorkspace, IWorkspaceContextService, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
import { IWorkspace, IWorkspaceContextService, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ContributedTask, ConfiguringTask, KeyedTaskIdentifier, TaskExecution, Task, TaskEvent, TaskEventKind,
|
ContributedTask, ConfiguringTask, KeyedTaskIdentifier, ITaskExecution, Task, ITaskEvent, TaskEventKind,
|
||||||
PresentationOptions, CommandOptions, CommandConfiguration, RuntimeType, CustomTask, TaskScope, TaskSource,
|
IPresentationOptions, CommandOptions, ICommandConfiguration, RuntimeType, CustomTask, TaskScope, TaskSource,
|
||||||
TaskSourceKind, ExtensionTaskSource, RunOptions, TaskSet, TaskDefinition, TaskGroup
|
TaskSourceKind, IExtensionTaskSource, IRunOptions, ITaskSet, TaskGroup, TaskDefinition, PresentationOptions, RunOptions
|
||||||
} from 'vs/workbench/contrib/tasks/common/tasks';
|
} from 'vs/workbench/contrib/tasks/common/tasks';
|
||||||
|
|
||||||
|
|
||||||
import { ResolveSet, ResolvedVariables } from 'vs/workbench/contrib/tasks/common/taskSystem';
|
import { IResolveSet, IResolvedVariables } from 'vs/workbench/contrib/tasks/common/taskSystem';
|
||||||
import { ITaskService, TaskFilter, ITaskProvider } from 'vs/workbench/contrib/tasks/common/taskService';
|
import { ITaskService, ITaskFilter, ITaskProvider } from 'vs/workbench/contrib/tasks/common/taskService';
|
||||||
|
|
||||||
import { extHostNamedCustomer, IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers';
|
import { extHostNamedCustomer, IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers';
|
||||||
import { ExtHostContext, MainThreadTaskShape, ExtHostTaskShape, MainContext } from 'vs/workbench/api/common/extHost.protocol';
|
import { ExtHostContext, MainThreadTaskShape, ExtHostTaskShape, MainContext } from 'vs/workbench/api/common/extHost.protocol';
|
||||||
import {
|
import {
|
||||||
TaskDefinitionDTO, TaskExecutionDTO, ProcessExecutionOptionsDTO, TaskPresentationOptionsDTO,
|
ITaskDefinitionDTO, ITaskExecutionDTO, IProcessExecutionOptionsDTO, ITaskPresentationOptionsDTO,
|
||||||
ProcessExecutionDTO, ShellExecutionDTO, ShellExecutionOptionsDTO, CustomExecutionDTO, TaskDTO, TaskSourceDTO, TaskHandleDTO, TaskFilterDTO, TaskProcessStartedDTO, TaskProcessEndedDTO, TaskSystemInfoDTO,
|
IProcessExecutionDTO, IShellExecutionDTO, IShellExecutionOptionsDTO, ICustomExecutionDTO, ITaskDTO, ITaskSourceDTO, ITaskHandleDTO, ITaskFilterDTO, ITaskProcessStartedDTO, ITaskProcessEndedDTO, ITaskSystemInfoDTO,
|
||||||
RunOptionsDTO, TaskGroupDTO
|
IRunOptionsDTO, ITaskGroupDTO
|
||||||
} from 'vs/workbench/api/common/shared/tasks';
|
} from 'vs/workbench/api/common/shared/tasks';
|
||||||
import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver';
|
import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver';
|
||||||
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||||
|
|
||||||
namespace TaskExecutionDTO {
|
namespace TaskExecutionDTO {
|
||||||
export function from(value: TaskExecution): TaskExecutionDTO {
|
export function from(value: ITaskExecution): ITaskExecutionDTO {
|
||||||
return {
|
return {
|
||||||
id: value.id,
|
id: value.id,
|
||||||
task: TaskDTO.from(value.task)
|
task: TaskDTO.from(value.task)
|
||||||
|
@ -44,7 +44,7 @@ namespace TaskExecutionDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace TaskProcessStartedDTO {
|
namespace TaskProcessStartedDTO {
|
||||||
export function from(value: TaskExecution, processId: number): TaskProcessStartedDTO {
|
export function from(value: ITaskExecution, processId: number): ITaskProcessStartedDTO {
|
||||||
return {
|
return {
|
||||||
id: value.id,
|
id: value.id,
|
||||||
processId
|
processId
|
||||||
|
@ -53,7 +53,7 @@ namespace TaskProcessStartedDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace TaskProcessEndedDTO {
|
namespace TaskProcessEndedDTO {
|
||||||
export function from(value: TaskExecution, exitCode: number | undefined): TaskProcessEndedDTO {
|
export function from(value: ITaskExecution, exitCode: number | undefined): ITaskProcessEndedDTO {
|
||||||
return {
|
return {
|
||||||
id: value.id,
|
id: value.id,
|
||||||
exitCode
|
exitCode
|
||||||
|
@ -62,12 +62,12 @@ namespace TaskProcessEndedDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace TaskDefinitionDTO {
|
namespace TaskDefinitionDTO {
|
||||||
export function from(value: KeyedTaskIdentifier): TaskDefinitionDTO {
|
export function from(value: KeyedTaskIdentifier): ITaskDefinitionDTO {
|
||||||
const result = Object.assign(Object.create(null), value);
|
const result = Object.assign(Object.create(null), value);
|
||||||
delete result._key;
|
delete result._key;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
export function to(value: TaskDefinitionDTO, executeOnly: boolean): KeyedTaskIdentifier | undefined {
|
export function to(value: ITaskDefinitionDTO, executeOnly: boolean): KeyedTaskIdentifier | undefined {
|
||||||
let result = TaskDefinition.createTaskIdentifier(value, console);
|
let result = TaskDefinition.createTaskIdentifier(value, console);
|
||||||
if (result === undefined && executeOnly) {
|
if (result === undefined && executeOnly) {
|
||||||
result = {
|
result = {
|
||||||
|
@ -80,13 +80,13 @@ namespace TaskDefinitionDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace TaskPresentationOptionsDTO {
|
namespace TaskPresentationOptionsDTO {
|
||||||
export function from(value: PresentationOptions | undefined): TaskPresentationOptionsDTO | undefined {
|
export function from(value: IPresentationOptions | undefined): ITaskPresentationOptionsDTO | undefined {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return Object.assign(Object.create(null), value);
|
return Object.assign(Object.create(null), value);
|
||||||
}
|
}
|
||||||
export function to(value: TaskPresentationOptionsDTO | undefined): PresentationOptions {
|
export function to(value: ITaskPresentationOptionsDTO | undefined): IPresentationOptions {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return PresentationOptions.defaults;
|
return PresentationOptions.defaults;
|
||||||
}
|
}
|
||||||
|
@ -95,13 +95,13 @@ namespace TaskPresentationOptionsDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace RunOptionsDTO {
|
namespace RunOptionsDTO {
|
||||||
export function from(value: RunOptions): RunOptionsDTO | undefined {
|
export function from(value: IRunOptions): IRunOptionsDTO | undefined {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return Object.assign(Object.create(null), value);
|
return Object.assign(Object.create(null), value);
|
||||||
}
|
}
|
||||||
export function to(value: RunOptionsDTO | undefined): RunOptions {
|
export function to(value: IRunOptionsDTO | undefined): IRunOptions {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return RunOptions.defaults;
|
return RunOptions.defaults;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ namespace RunOptionsDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ProcessExecutionOptionsDTO {
|
namespace ProcessExecutionOptionsDTO {
|
||||||
export function from(value: CommandOptions): ProcessExecutionOptionsDTO | undefined {
|
export function from(value: CommandOptions): IProcessExecutionOptionsDTO | undefined {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ namespace ProcessExecutionOptionsDTO {
|
||||||
env: value.env
|
env: value.env
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
export function to(value: ProcessExecutionOptionsDTO | undefined): CommandOptions {
|
export function to(value: IProcessExecutionOptionsDTO | undefined): CommandOptions {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return CommandOptions.defaults;
|
return CommandOptions.defaults;
|
||||||
}
|
}
|
||||||
|
@ -131,14 +131,14 @@ namespace ProcessExecutionOptionsDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ProcessExecutionDTO {
|
namespace ProcessExecutionDTO {
|
||||||
export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO): value is ProcessExecutionDTO {
|
export function is(value: IShellExecutionDTO | IProcessExecutionDTO | ICustomExecutionDTO): value is IProcessExecutionDTO {
|
||||||
const candidate = value as ProcessExecutionDTO;
|
const candidate = value as IProcessExecutionDTO;
|
||||||
return candidate && !!candidate.process;
|
return candidate && !!candidate.process;
|
||||||
}
|
}
|
||||||
export function from(value: CommandConfiguration): ProcessExecutionDTO {
|
export function from(value: ICommandConfiguration): IProcessExecutionDTO {
|
||||||
const process: string = Types.isString(value.name) ? value.name : value.name!.value;
|
const process: string = Types.isString(value.name) ? value.name : value.name!.value;
|
||||||
const args: string[] = value.args ? value.args.map(value => Types.isString(value) ? value : value.value) : [];
|
const args: string[] = value.args ? value.args.map(value => Types.isString(value) ? value : value.value) : [];
|
||||||
const result: ProcessExecutionDTO = {
|
const result: IProcessExecutionDTO = {
|
||||||
process: process,
|
process: process,
|
||||||
args: args
|
args: args
|
||||||
};
|
};
|
||||||
|
@ -147,8 +147,8 @@ namespace ProcessExecutionDTO {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
export function to(value: ProcessExecutionDTO): CommandConfiguration {
|
export function to(value: IProcessExecutionDTO): ICommandConfiguration {
|
||||||
const result: CommandConfiguration = {
|
const result: ICommandConfiguration = {
|
||||||
runtime: RuntimeType.Process,
|
runtime: RuntimeType.Process,
|
||||||
name: value.process,
|
name: value.process,
|
||||||
args: value.args,
|
args: value.args,
|
||||||
|
@ -160,11 +160,11 @@ namespace ProcessExecutionDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ShellExecutionOptionsDTO {
|
namespace ShellExecutionOptionsDTO {
|
||||||
export function from(value: CommandOptions): ShellExecutionOptionsDTO | undefined {
|
export function from(value: CommandOptions): IShellExecutionOptionsDTO | undefined {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
const result: ShellExecutionOptionsDTO = {
|
const result: IShellExecutionOptionsDTO = {
|
||||||
cwd: value.cwd || CommandOptions.defaults.cwd,
|
cwd: value.cwd || CommandOptions.defaults.cwd,
|
||||||
env: value.env
|
env: value.env
|
||||||
};
|
};
|
||||||
|
@ -175,7 +175,7 @@ namespace ShellExecutionOptionsDTO {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
export function to(value: ShellExecutionOptionsDTO): CommandOptions | undefined {
|
export function to(value: IShellExecutionOptionsDTO): CommandOptions | undefined {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -199,12 +199,12 @@ namespace ShellExecutionOptionsDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ShellExecutionDTO {
|
namespace ShellExecutionDTO {
|
||||||
export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO): value is ShellExecutionDTO {
|
export function is(value: IShellExecutionDTO | IProcessExecutionDTO | ICustomExecutionDTO): value is IShellExecutionDTO {
|
||||||
const candidate = value as ShellExecutionDTO;
|
const candidate = value as IShellExecutionDTO;
|
||||||
return candidate && (!!candidate.commandLine || !!candidate.command);
|
return candidate && (!!candidate.commandLine || !!candidate.command);
|
||||||
}
|
}
|
||||||
export function from(value: CommandConfiguration): ShellExecutionDTO {
|
export function from(value: ICommandConfiguration): IShellExecutionDTO {
|
||||||
const result: ShellExecutionDTO = {};
|
const result: IShellExecutionDTO = {};
|
||||||
if (value.name && Types.isString(value.name) && (value.args === undefined || value.args === null || value.args.length === 0)) {
|
if (value.name && Types.isString(value.name) && (value.args === undefined || value.args === null || value.args.length === 0)) {
|
||||||
result.commandLine = value.name;
|
result.commandLine = value.name;
|
||||||
} else {
|
} else {
|
||||||
|
@ -216,8 +216,8 @@ namespace ShellExecutionDTO {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
export function to(value: ShellExecutionDTO): CommandConfiguration {
|
export function to(value: IShellExecutionDTO): ICommandConfiguration {
|
||||||
const result: CommandConfiguration = {
|
const result: ICommandConfiguration = {
|
||||||
runtime: RuntimeType.Shell,
|
runtime: RuntimeType.Shell,
|
||||||
name: value.commandLine ? value.commandLine : value.command,
|
name: value.commandLine ? value.commandLine : value.command,
|
||||||
args: value.args,
|
args: value.args,
|
||||||
|
@ -231,18 +231,18 @@ namespace ShellExecutionDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CustomExecutionDTO {
|
namespace CustomExecutionDTO {
|
||||||
export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO): value is CustomExecutionDTO {
|
export function is(value: IShellExecutionDTO | IProcessExecutionDTO | ICustomExecutionDTO): value is ICustomExecutionDTO {
|
||||||
const candidate = value as CustomExecutionDTO;
|
const candidate = value as ICustomExecutionDTO;
|
||||||
return candidate && candidate.customExecution === 'customExecution';
|
return candidate && candidate.customExecution === 'customExecution';
|
||||||
}
|
}
|
||||||
|
|
||||||
export function from(value: CommandConfiguration): CustomExecutionDTO {
|
export function from(value: ICommandConfiguration): ICustomExecutionDTO {
|
||||||
return {
|
return {
|
||||||
customExecution: 'customExecution'
|
customExecution: 'customExecution'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function to(value: CustomExecutionDTO): CommandConfiguration {
|
export function to(value: ICustomExecutionDTO): ICommandConfiguration {
|
||||||
return {
|
return {
|
||||||
runtime: RuntimeType.CustomExecution,
|
runtime: RuntimeType.CustomExecution,
|
||||||
presentation: undefined
|
presentation: undefined
|
||||||
|
@ -251,8 +251,8 @@ namespace CustomExecutionDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace TaskSourceDTO {
|
namespace TaskSourceDTO {
|
||||||
export function from(value: TaskSource): TaskSourceDTO {
|
export function from(value: TaskSource): ITaskSourceDTO {
|
||||||
const result: TaskSourceDTO = {
|
const result: ITaskSourceDTO = {
|
||||||
label: value.label
|
label: value.label
|
||||||
};
|
};
|
||||||
if (value.kind === TaskSourceKind.Extension) {
|
if (value.kind === TaskSourceKind.Extension) {
|
||||||
|
@ -268,7 +268,7 @@ namespace TaskSourceDTO {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
export function to(value: TaskSourceDTO, workspace: IWorkspaceContextService): ExtensionTaskSource {
|
export function to(value: ITaskSourceDTO, workspace: IWorkspaceContextService): IExtensionTaskSource {
|
||||||
let scope: TaskScope;
|
let scope: TaskScope;
|
||||||
let workspaceFolder: IWorkspaceFolder | undefined;
|
let workspaceFolder: IWorkspaceFolder | undefined;
|
||||||
if ((value.scope === undefined) || ((typeof value.scope === 'number') && (value.scope !== TaskScope.Global))) {
|
if ((value.scope === undefined) || ((typeof value.scope === 'number') && (value.scope !== TaskScope.Global))) {
|
||||||
|
@ -285,7 +285,7 @@ namespace TaskSourceDTO {
|
||||||
scope = TaskScope.Folder;
|
scope = TaskScope.Folder;
|
||||||
workspaceFolder = Types.withNullAsUndefined(workspace.getWorkspaceFolder(URI.revive(value.scope)));
|
workspaceFolder = Types.withNullAsUndefined(workspace.getWorkspaceFolder(URI.revive(value.scope)));
|
||||||
}
|
}
|
||||||
const result: ExtensionTaskSource = {
|
const result: IExtensionTaskSource = {
|
||||||
kind: TaskSourceKind.Extension,
|
kind: TaskSourceKind.Extension,
|
||||||
label: value.label,
|
label: value.label,
|
||||||
extension: value.extensionId,
|
extension: value.extensionId,
|
||||||
|
@ -297,18 +297,18 @@ namespace TaskSourceDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace TaskHandleDTO {
|
namespace TaskHandleDTO {
|
||||||
export function is(value: any): value is TaskHandleDTO {
|
export function is(value: any): value is ITaskHandleDTO {
|
||||||
const candidate: TaskHandleDTO = value;
|
const candidate: ITaskHandleDTO = value;
|
||||||
return candidate && Types.isString(candidate.id) && !!candidate.workspaceFolder;
|
return candidate && Types.isString(candidate.id) && !!candidate.workspaceFolder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace TaskDTO {
|
namespace TaskDTO {
|
||||||
export function from(task: Task | ConfiguringTask): TaskDTO | undefined {
|
export function from(task: Task | ConfiguringTask): ITaskDTO | undefined {
|
||||||
if (task === undefined || task === null || (!CustomTask.is(task) && !ContributedTask.is(task) && !ConfiguringTask.is(task))) {
|
if (task === undefined || task === null || (!CustomTask.is(task) && !ContributedTask.is(task) && !ConfiguringTask.is(task))) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
const result: TaskDTO = {
|
const result: ITaskDTO = {
|
||||||
_id: task._id,
|
_id: task._id,
|
||||||
name: task.configurationProperties.name,
|
name: task.configurationProperties.name,
|
||||||
definition: TaskDefinitionDTO.from(task.getDefinition(true)),
|
definition: TaskDefinitionDTO.from(task.getDefinition(true)),
|
||||||
|
@ -342,12 +342,12 @@ namespace TaskDTO {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function to(task: TaskDTO | undefined, workspace: IWorkspaceContextService, executeOnly: boolean): ContributedTask | undefined {
|
export function to(task: ITaskDTO | undefined, workspace: IWorkspaceContextService, executeOnly: boolean): ContributedTask | undefined {
|
||||||
if (!task || (typeof task.name !== 'string')) {
|
if (!task || (typeof task.name !== 'string')) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
let command: CommandConfiguration | undefined;
|
let command: ICommandConfiguration | undefined;
|
||||||
if (task.execution) {
|
if (task.execution) {
|
||||||
if (ShellExecutionDTO.is(task.execution)) {
|
if (ShellExecutionDTO.is(task.execution)) {
|
||||||
command = ShellExecutionDTO.to(task.execution);
|
command = ShellExecutionDTO.to(task.execution);
|
||||||
|
@ -390,7 +390,7 @@ namespace TaskDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace TaskGroupDTO {
|
namespace TaskGroupDTO {
|
||||||
export function from(value: string | TaskGroup | undefined): TaskGroupDTO | undefined {
|
export function from(value: string | TaskGroup | undefined): ITaskGroupDTO | undefined {
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -402,10 +402,10 @@ namespace TaskGroupDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace TaskFilterDTO {
|
namespace TaskFilterDTO {
|
||||||
export function from(value: TaskFilter): TaskFilterDTO {
|
export function from(value: ITaskFilter): ITaskFilterDTO {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
export function to(value: TaskFilterDTO | undefined): TaskFilter | undefined {
|
export function to(value: ITaskFilterDTO | undefined): ITaskFilter | undefined {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -425,11 +425,11 @@ export class MainThreadTask implements MainThreadTaskShape {
|
||||||
) {
|
) {
|
||||||
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostTask);
|
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostTask);
|
||||||
this._providers = new Map();
|
this._providers = new Map();
|
||||||
this._taskService.onDidStateChange(async (event: TaskEvent) => {
|
this._taskService.onDidStateChange(async (event: ITaskEvent) => {
|
||||||
const task = event.__task!;
|
const task = event.__task!;
|
||||||
if (event.kind === TaskEventKind.Start) {
|
if (event.kind === TaskEventKind.Start) {
|
||||||
const execution = TaskExecutionDTO.from(task.getTaskExecution());
|
const execution = TaskExecutionDTO.from(task.getTaskExecution());
|
||||||
let resolvedDefinition: TaskDefinitionDTO = execution.task!.definition;
|
let resolvedDefinition: ITaskDefinitionDTO = execution.task!.definition;
|
||||||
if (execution.task?.execution && CustomExecutionDTO.is(execution.task.execution) && event.resolvedVariables) {
|
if (execution.task?.execution && CustomExecutionDTO.is(execution.task.execution) && event.resolvedVariables) {
|
||||||
const dictionary: IStringDictionary<string> = {};
|
const dictionary: IStringDictionary<string> = {};
|
||||||
Array.from(event.resolvedVariables.entries()).forEach(entry => dictionary[entry[0]] = entry[1]);
|
Array.from(event.resolvedVariables.entries()).forEach(entry => dictionary[entry[0]] = entry[1]);
|
||||||
|
@ -454,7 +454,7 @@ export class MainThreadTask implements MainThreadTaskShape {
|
||||||
this._providers.clear();
|
this._providers.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
$createTaskId(taskDTO: TaskDTO): Promise<string> {
|
$createTaskId(taskDTO: ITaskDTO): Promise<string> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let task = TaskDTO.to(taskDTO, this._workspaceContextServer, true);
|
let task = TaskDTO.to(taskDTO, this._workspaceContextServer, true);
|
||||||
if (task) {
|
if (task) {
|
||||||
|
@ -481,7 +481,7 @@ export class MainThreadTask implements MainThreadTaskShape {
|
||||||
return {
|
return {
|
||||||
tasks,
|
tasks,
|
||||||
extension: value.extension
|
extension: value.extension
|
||||||
} as TaskSet;
|
} as ITaskSet;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
resolveTask: (task: ConfiguringTask) => {
|
resolveTask: (task: ConfiguringTask) => {
|
||||||
|
@ -514,9 +514,9 @@ export class MainThreadTask implements MainThreadTaskShape {
|
||||||
return Promise.resolve(undefined);
|
return Promise.resolve(undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
public $fetchTasks(filter?: TaskFilterDTO): Promise<TaskDTO[]> {
|
public $fetchTasks(filter?: ITaskFilterDTO): Promise<ITaskDTO[]> {
|
||||||
return this._taskService.tasks(TaskFilterDTO.to(filter)).then((tasks) => {
|
return this._taskService.tasks(TaskFilterDTO.to(filter)).then((tasks) => {
|
||||||
const result: TaskDTO[] = [];
|
const result: ITaskDTO[] = [];
|
||||||
for (let task of tasks) {
|
for (let task of tasks) {
|
||||||
const item = TaskDTO.from(task);
|
const item = TaskDTO.from(task);
|
||||||
if (item) {
|
if (item) {
|
||||||
|
@ -543,7 +543,7 @@ export class MainThreadTask implements MainThreadTaskShape {
|
||||||
return workspace;
|
return workspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async $getTaskExecution(value: TaskHandleDTO | TaskDTO): Promise<TaskExecutionDTO> {
|
public async $getTaskExecution(value: ITaskHandleDTO | ITaskDTO): Promise<ITaskExecutionDTO> {
|
||||||
if (TaskHandleDTO.is(value)) {
|
if (TaskHandleDTO.is(value)) {
|
||||||
const workspace = this.getWorkspace(value.workspaceFolder);
|
const workspace = this.getWorkspace(value.workspaceFolder);
|
||||||
if (workspace) {
|
if (workspace) {
|
||||||
|
@ -569,8 +569,8 @@ export class MainThreadTask implements MainThreadTaskShape {
|
||||||
|
|
||||||
// Passing in a TaskHandleDTO will cause the task to get re-resolved, which is important for tasks are coming from the core,
|
// Passing in a TaskHandleDTO will cause the task to get re-resolved, which is important for tasks are coming from the core,
|
||||||
// such as those gotten from a fetchTasks, since they can have missing configuration properties.
|
// such as those gotten from a fetchTasks, since they can have missing configuration properties.
|
||||||
public $executeTask(value: TaskHandleDTO | TaskDTO): Promise<TaskExecutionDTO> {
|
public $executeTask(value: ITaskHandleDTO | ITaskDTO): Promise<ITaskExecutionDTO> {
|
||||||
return new Promise<TaskExecutionDTO>((resolve, reject) => {
|
return new Promise<ITaskExecutionDTO>((resolve, reject) => {
|
||||||
if (TaskHandleDTO.is(value)) {
|
if (TaskHandleDTO.is(value)) {
|
||||||
const workspace = this.getWorkspace(value.workspaceFolder);
|
const workspace = this.getWorkspace(value.workspaceFolder);
|
||||||
if (workspace) {
|
if (workspace) {
|
||||||
|
@ -578,7 +578,7 @@ export class MainThreadTask implements MainThreadTaskShape {
|
||||||
if (!task) {
|
if (!task) {
|
||||||
reject(new Error('Task not found'));
|
reject(new Error('Task not found'));
|
||||||
} else {
|
} else {
|
||||||
const result: TaskExecutionDTO = {
|
const result: ITaskExecutionDTO = {
|
||||||
id: value.id,
|
id: value.id,
|
||||||
task: TaskDTO.from(task)
|
task: TaskDTO.from(task)
|
||||||
};
|
};
|
||||||
|
@ -604,7 +604,7 @@ export class MainThreadTask implements MainThreadTaskShape {
|
||||||
this._taskService.run(task).then(undefined, reason => {
|
this._taskService.run(task).then(undefined, reason => {
|
||||||
// eat the error, it has already been surfaced to the user and we don't care about it here
|
// eat the error, it has already been surfaced to the user and we don't care about it here
|
||||||
});
|
});
|
||||||
const result: TaskExecutionDTO = {
|
const result: ITaskExecutionDTO = {
|
||||||
id: task._id,
|
id: task._id,
|
||||||
task: TaskDTO.from(task)
|
task: TaskDTO.from(task)
|
||||||
};
|
};
|
||||||
|
@ -650,7 +650,7 @@ export class MainThreadTask implements MainThreadTaskShape {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public $registerTaskSystem(key: string, info: TaskSystemInfoDTO): void {
|
public $registerTaskSystem(key: string, info: ITaskSystemInfoDTO): void {
|
||||||
let platform: Platform.Platform;
|
let platform: Platform.Platform;
|
||||||
switch (info.platform) {
|
switch (info.platform) {
|
||||||
case 'Web':
|
case 'Web':
|
||||||
|
@ -674,7 +674,7 @@ export class MainThreadTask implements MainThreadTaskShape {
|
||||||
return URI.from({ scheme: info.scheme, authority: info.authority, path });
|
return URI.from({ scheme: info.scheme, authority: info.authority, path });
|
||||||
},
|
},
|
||||||
context: this._extHostContext,
|
context: this._extHostContext,
|
||||||
resolveVariables: (workspaceFolder: IWorkspaceFolder, toResolve: ResolveSet, target: ConfigurationTarget): Promise<ResolvedVariables | undefined> => {
|
resolveVariables: (workspaceFolder: IWorkspaceFolder, toResolve: IResolveSet, target: ConfigurationTarget): Promise<IResolvedVariables | undefined> => {
|
||||||
const vars: string[] = [];
|
const vars: string[] = [];
|
||||||
toResolve.variables.forEach(item => vars.push(item));
|
toResolve.variables.forEach(item => vars.push(item));
|
||||||
return Promise.resolve(this._proxy.$resolveVariables(workspaceFolder.uri, { process: toResolve.process, variables: vars })).then(values => {
|
return Promise.resolve(this._proxy.$resolveVariables(workspaceFolder.uri, { process: toResolve.process, variables: vars })).then(values => {
|
||||||
|
@ -682,13 +682,13 @@ export class MainThreadTask implements MainThreadTaskShape {
|
||||||
forEach(values.variables, (entry) => {
|
forEach(values.variables, (entry) => {
|
||||||
partiallyResolvedVars.push(entry.value);
|
partiallyResolvedVars.push(entry.value);
|
||||||
});
|
});
|
||||||
return new Promise<ResolvedVariables | undefined>((resolve, reject) => {
|
return new Promise<IResolvedVariables | undefined>((resolve, reject) => {
|
||||||
this._configurationResolverService.resolveWithInteraction(workspaceFolder, partiallyResolvedVars, 'tasks', undefined, target).then(resolvedVars => {
|
this._configurationResolverService.resolveWithInteraction(workspaceFolder, partiallyResolvedVars, 'tasks', undefined, target).then(resolvedVars => {
|
||||||
if (!resolvedVars) {
|
if (!resolvedVars) {
|
||||||
resolve(undefined);
|
resolve(undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
const result: ResolvedVariables = {
|
const result: IResolvedVariables = {
|
||||||
process: undefined,
|
process: undefined,
|
||||||
variables: new Map<string, string>()
|
variables: new Map<string, string>()
|
||||||
};
|
};
|
||||||
|
|
|
@ -1111,14 +1111,14 @@ export interface MainThreadSearchShape extends IDisposable {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MainThreadTaskShape extends IDisposable {
|
export interface MainThreadTaskShape extends IDisposable {
|
||||||
$createTaskId(task: tasks.TaskDTO): Promise<string>;
|
$createTaskId(task: tasks.ITaskDTO): Promise<string>;
|
||||||
$registerTaskProvider(handle: number, type: string): Promise<void>;
|
$registerTaskProvider(handle: number, type: string): Promise<void>;
|
||||||
$unregisterTaskProvider(handle: number): Promise<void>;
|
$unregisterTaskProvider(handle: number): Promise<void>;
|
||||||
$fetchTasks(filter?: tasks.TaskFilterDTO): Promise<tasks.TaskDTO[]>;
|
$fetchTasks(filter?: tasks.ITaskFilterDTO): Promise<tasks.ITaskDTO[]>;
|
||||||
$getTaskExecution(value: tasks.TaskHandleDTO | tasks.TaskDTO): Promise<tasks.TaskExecutionDTO>;
|
$getTaskExecution(value: tasks.ITaskHandleDTO | tasks.ITaskDTO): Promise<tasks.ITaskExecutionDTO>;
|
||||||
$executeTask(task: tasks.TaskHandleDTO | tasks.TaskDTO): Promise<tasks.TaskExecutionDTO>;
|
$executeTask(task: tasks.ITaskHandleDTO | tasks.ITaskDTO): Promise<tasks.ITaskExecutionDTO>;
|
||||||
$terminateTask(id: string): Promise<void>;
|
$terminateTask(id: string): Promise<void>;
|
||||||
$registerTaskSystem(scheme: string, info: tasks.TaskSystemInfoDTO): void;
|
$registerTaskSystem(scheme: string, info: tasks.ITaskSystemInfoDTO): void;
|
||||||
$customExecutionComplete(id: string, result?: number): Promise<void>;
|
$customExecutionComplete(id: string, result?: number): Promise<void>;
|
||||||
$registerSupportedExecutions(custom?: boolean, shell?: boolean, process?: boolean): Promise<void>;
|
$registerSupportedExecutions(custom?: boolean, shell?: boolean, process?: boolean): Promise<void>;
|
||||||
}
|
}
|
||||||
|
@ -1841,12 +1841,12 @@ export interface ExtHostSCMShape {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ExtHostTaskShape {
|
export interface ExtHostTaskShape {
|
||||||
$provideTasks(handle: number, validTypes: { [key: string]: boolean }): Promise<tasks.TaskSetDTO>;
|
$provideTasks(handle: number, validTypes: { [key: string]: boolean }): Promise<tasks.ITaskSetDTO>;
|
||||||
$resolveTask(handle: number, taskDTO: tasks.TaskDTO): Promise<tasks.TaskDTO | undefined>;
|
$resolveTask(handle: number, taskDTO: tasks.ITaskDTO): Promise<tasks.ITaskDTO | undefined>;
|
||||||
$onDidStartTask(execution: tasks.TaskExecutionDTO, terminalId: number, resolvedDefinition: tasks.TaskDefinitionDTO): void;
|
$onDidStartTask(execution: tasks.ITaskExecutionDTO, terminalId: number, resolvedDefinition: tasks.ITaskDefinitionDTO): void;
|
||||||
$onDidStartTaskProcess(value: tasks.TaskProcessStartedDTO): void;
|
$onDidStartTaskProcess(value: tasks.ITaskProcessStartedDTO): void;
|
||||||
$onDidEndTaskProcess(value: tasks.TaskProcessEndedDTO): void;
|
$onDidEndTaskProcess(value: tasks.ITaskProcessEndedDTO): void;
|
||||||
$OnDidEndTask(execution: tasks.TaskExecutionDTO): void;
|
$OnDidEndTask(execution: tasks.ITaskExecutionDTO): void;
|
||||||
$resolveVariables(workspaceFolder: UriComponents, toResolve: { process?: { name: string; cwd?: string }; variables: string[] }): Promise<{ process?: string; variables: { [key: string]: string } }>;
|
$resolveVariables(workspaceFolder: UriComponents, toResolve: { process?: { name: string; cwd?: string }; variables: string[] }): Promise<{ process?: string; variables: { [key: string]: string } }>;
|
||||||
$jsonTasksSupported(): Promise<boolean>;
|
$jsonTasksSupported(): Promise<boolean>;
|
||||||
$findExecutable(command: string, cwd?: string, paths?: string[]): Promise<string | undefined>;
|
$findExecutable(command: string, cwd?: string, paths?: string[]): Promise<string | undefined>;
|
||||||
|
|
|
@ -38,20 +38,20 @@ export interface IExtHostTask extends ExtHostTaskShape {
|
||||||
onDidEndTaskProcess: Event<vscode.TaskProcessEndEvent>;
|
onDidEndTaskProcess: Event<vscode.TaskProcessEndEvent>;
|
||||||
|
|
||||||
registerTaskProvider(extension: IExtensionDescription, type: string, provider: vscode.TaskProvider): vscode.Disposable;
|
registerTaskProvider(extension: IExtensionDescription, type: string, provider: vscode.TaskProvider): vscode.Disposable;
|
||||||
registerTaskSystem(scheme: string, info: tasks.TaskSystemInfoDTO): void;
|
registerTaskSystem(scheme: string, info: tasks.ITaskSystemInfoDTO): void;
|
||||||
fetchTasks(filter?: vscode.TaskFilter): Promise<vscode.Task[]>;
|
fetchTasks(filter?: vscode.TaskFilter): Promise<vscode.Task[]>;
|
||||||
executeTask(extension: IExtensionDescription, task: vscode.Task): Promise<vscode.TaskExecution>;
|
executeTask(extension: IExtensionDescription, task: vscode.Task): Promise<vscode.TaskExecution>;
|
||||||
terminateTask(execution: vscode.TaskExecution): Promise<void>;
|
terminateTask(execution: vscode.TaskExecution): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace TaskDefinitionDTO {
|
export namespace TaskDefinitionDTO {
|
||||||
export function from(value: vscode.TaskDefinition): tasks.TaskDefinitionDTO | undefined {
|
export function from(value: vscode.TaskDefinition): tasks.ITaskDefinitionDTO | undefined {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
export function to(value: tasks.TaskDefinitionDTO): vscode.TaskDefinition | undefined {
|
export function to(value: tasks.ITaskDefinitionDTO): vscode.TaskDefinition | undefined {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -60,13 +60,13 @@ export namespace TaskDefinitionDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace TaskPresentationOptionsDTO {
|
export namespace TaskPresentationOptionsDTO {
|
||||||
export function from(value: vscode.TaskPresentationOptions): tasks.TaskPresentationOptionsDTO | undefined {
|
export function from(value: vscode.TaskPresentationOptions): tasks.ITaskPresentationOptionsDTO | undefined {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
export function to(value: tasks.TaskPresentationOptionsDTO): vscode.TaskPresentationOptions | undefined {
|
export function to(value: tasks.ITaskPresentationOptionsDTO): vscode.TaskPresentationOptions | undefined {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -75,13 +75,13 @@ export namespace TaskPresentationOptionsDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace ProcessExecutionOptionsDTO {
|
export namespace ProcessExecutionOptionsDTO {
|
||||||
export function from(value: vscode.ProcessExecutionOptions): tasks.ProcessExecutionOptionsDTO | undefined {
|
export function from(value: vscode.ProcessExecutionOptions): tasks.IProcessExecutionOptionsDTO | undefined {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
export function to(value: tasks.ProcessExecutionOptionsDTO): vscode.ProcessExecutionOptions | undefined {
|
export function to(value: tasks.IProcessExecutionOptionsDTO): vscode.ProcessExecutionOptions | undefined {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -90,19 +90,19 @@ export namespace ProcessExecutionOptionsDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace ProcessExecutionDTO {
|
export namespace ProcessExecutionDTO {
|
||||||
export function is(value: tasks.ShellExecutionDTO | tasks.ProcessExecutionDTO | tasks.CustomExecutionDTO | undefined): value is tasks.ProcessExecutionDTO {
|
export function is(value: tasks.IShellExecutionDTO | tasks.IProcessExecutionDTO | tasks.ICustomExecutionDTO | undefined): value is tasks.IProcessExecutionDTO {
|
||||||
if (value) {
|
if (value) {
|
||||||
const candidate = value as tasks.ProcessExecutionDTO;
|
const candidate = value as tasks.IProcessExecutionDTO;
|
||||||
return candidate && !!candidate.process;
|
return candidate && !!candidate.process;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function from(value: vscode.ProcessExecution): tasks.ProcessExecutionDTO | undefined {
|
export function from(value: vscode.ProcessExecution): tasks.IProcessExecutionDTO | undefined {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
const result: tasks.ProcessExecutionDTO = {
|
const result: tasks.IProcessExecutionDTO = {
|
||||||
process: value.process,
|
process: value.process,
|
||||||
args: value.args
|
args: value.args
|
||||||
};
|
};
|
||||||
|
@ -111,7 +111,7 @@ export namespace ProcessExecutionDTO {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
export function to(value: tasks.ProcessExecutionDTO): types.ProcessExecution | undefined {
|
export function to(value: tasks.IProcessExecutionDTO): types.ProcessExecution | undefined {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -120,13 +120,13 @@ export namespace ProcessExecutionDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace ShellExecutionOptionsDTO {
|
export namespace ShellExecutionOptionsDTO {
|
||||||
export function from(value: vscode.ShellExecutionOptions): tasks.ShellExecutionOptionsDTO | undefined {
|
export function from(value: vscode.ShellExecutionOptions): tasks.IShellExecutionOptionsDTO | undefined {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
export function to(value: tasks.ShellExecutionOptionsDTO): vscode.ShellExecutionOptions | undefined {
|
export function to(value: tasks.IShellExecutionOptionsDTO): vscode.ShellExecutionOptions | undefined {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -135,19 +135,19 @@ export namespace ShellExecutionOptionsDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace ShellExecutionDTO {
|
export namespace ShellExecutionDTO {
|
||||||
export function is(value: tasks.ShellExecutionDTO | tasks.ProcessExecutionDTO | tasks.CustomExecutionDTO | undefined): value is tasks.ShellExecutionDTO {
|
export function is(value: tasks.IShellExecutionDTO | tasks.IProcessExecutionDTO | tasks.ICustomExecutionDTO | undefined): value is tasks.IShellExecutionDTO {
|
||||||
if (value) {
|
if (value) {
|
||||||
const candidate = value as tasks.ShellExecutionDTO;
|
const candidate = value as tasks.IShellExecutionDTO;
|
||||||
return candidate && (!!candidate.commandLine || !!candidate.command);
|
return candidate && (!!candidate.commandLine || !!candidate.command);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function from(value: vscode.ShellExecution): tasks.ShellExecutionDTO | undefined {
|
export function from(value: vscode.ShellExecution): tasks.IShellExecutionDTO | undefined {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
const result: tasks.ShellExecutionDTO = {
|
const result: tasks.IShellExecutionDTO = {
|
||||||
};
|
};
|
||||||
if (value.commandLine !== undefined) {
|
if (value.commandLine !== undefined) {
|
||||||
result.commandLine = value.commandLine;
|
result.commandLine = value.commandLine;
|
||||||
|
@ -160,7 +160,7 @@ export namespace ShellExecutionDTO {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
export function to(value: tasks.ShellExecutionDTO): types.ShellExecution | undefined {
|
export function to(value: tasks.IShellExecutionDTO): types.ShellExecution | undefined {
|
||||||
if (value === undefined || value === null || (value.command === undefined && value.commandLine === undefined)) {
|
if (value === undefined || value === null || (value.command === undefined && value.commandLine === undefined)) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -173,16 +173,16 @@ export namespace ShellExecutionDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace CustomExecutionDTO {
|
export namespace CustomExecutionDTO {
|
||||||
export function is(value: tasks.ShellExecutionDTO | tasks.ProcessExecutionDTO | tasks.CustomExecutionDTO | undefined): value is tasks.CustomExecutionDTO {
|
export function is(value: tasks.IShellExecutionDTO | tasks.IProcessExecutionDTO | tasks.ICustomExecutionDTO | undefined): value is tasks.ICustomExecutionDTO {
|
||||||
if (value) {
|
if (value) {
|
||||||
let candidate = value as tasks.CustomExecutionDTO;
|
let candidate = value as tasks.ICustomExecutionDTO;
|
||||||
return candidate && candidate.customExecution === 'customExecution';
|
return candidate && candidate.customExecution === 'customExecution';
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function from(value: vscode.CustomExecution): tasks.CustomExecutionDTO {
|
export function from(value: vscode.CustomExecution): tasks.ICustomExecutionDTO {
|
||||||
return {
|
return {
|
||||||
customExecution: 'customExecution'
|
customExecution: 'customExecution'
|
||||||
};
|
};
|
||||||
|
@ -195,7 +195,7 @@ export namespace CustomExecutionDTO {
|
||||||
|
|
||||||
|
|
||||||
export namespace TaskHandleDTO {
|
export namespace TaskHandleDTO {
|
||||||
export function from(value: types.Task, workspaceService?: IExtHostWorkspace): tasks.TaskHandleDTO {
|
export function from(value: types.Task, workspaceService?: IExtHostWorkspace): tasks.ITaskHandleDTO {
|
||||||
let folder: UriComponents | string;
|
let folder: UriComponents | string;
|
||||||
if (value.scope !== undefined && typeof value.scope !== 'number') {
|
if (value.scope !== undefined && typeof value.scope !== 'number') {
|
||||||
folder = value.scope.uri;
|
folder = value.scope.uri;
|
||||||
|
@ -213,7 +213,7 @@ export namespace TaskHandleDTO {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export namespace TaskGroupDTO {
|
export namespace TaskGroupDTO {
|
||||||
export function from(value: vscode.TaskGroup): tasks.TaskGroupDTO | undefined {
|
export function from(value: vscode.TaskGroup): tasks.ITaskGroupDTO | undefined {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -222,11 +222,11 @@ export namespace TaskGroupDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace TaskDTO {
|
export namespace TaskDTO {
|
||||||
export function fromMany(tasks: vscode.Task[], extension: IExtensionDescription): tasks.TaskDTO[] {
|
export function fromMany(tasks: vscode.Task[], extension: IExtensionDescription): tasks.ITaskDTO[] {
|
||||||
if (tasks === undefined || tasks === null) {
|
if (tasks === undefined || tasks === null) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const result: tasks.TaskDTO[] = [];
|
const result: tasks.ITaskDTO[] = [];
|
||||||
for (let task of tasks) {
|
for (let task of tasks) {
|
||||||
const converted = from(task, extension);
|
const converted = from(task, extension);
|
||||||
if (converted) {
|
if (converted) {
|
||||||
|
@ -236,11 +236,11 @@ export namespace TaskDTO {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function from(value: vscode.Task, extension: IExtensionDescription): tasks.TaskDTO | undefined {
|
export function from(value: vscode.Task, extension: IExtensionDescription): tasks.ITaskDTO | undefined {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
let execution: tasks.ShellExecutionDTO | tasks.ProcessExecutionDTO | tasks.CustomExecutionDTO | undefined;
|
let execution: tasks.IShellExecutionDTO | tasks.IProcessExecutionDTO | tasks.ICustomExecutionDTO | undefined;
|
||||||
if (value.execution instanceof types.ProcessExecution) {
|
if (value.execution instanceof types.ProcessExecution) {
|
||||||
execution = ProcessExecutionDTO.from(value.execution);
|
execution = ProcessExecutionDTO.from(value.execution);
|
||||||
} else if (value.execution instanceof types.ShellExecution) {
|
} else if (value.execution instanceof types.ShellExecution) {
|
||||||
|
@ -249,7 +249,7 @@ export namespace TaskDTO {
|
||||||
execution = CustomExecutionDTO.from(<types.CustomExecution>value.execution);
|
execution = CustomExecutionDTO.from(<types.CustomExecution>value.execution);
|
||||||
}
|
}
|
||||||
|
|
||||||
const definition: tasks.TaskDefinitionDTO | undefined = TaskDefinitionDTO.from(value.definition);
|
const definition: tasks.ITaskDefinitionDTO | undefined = TaskDefinitionDTO.from(value.definition);
|
||||||
let scope: number | UriComponents;
|
let scope: number | UriComponents;
|
||||||
if (value.scope) {
|
if (value.scope) {
|
||||||
if (typeof value.scope === 'number') {
|
if (typeof value.scope === 'number') {
|
||||||
|
@ -264,7 +264,7 @@ export namespace TaskDTO {
|
||||||
if (!definition || !scope) {
|
if (!definition || !scope) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
const result: tasks.TaskDTO = {
|
const result: tasks.ITaskDTO = {
|
||||||
_id: (value as types.Task)._id!,
|
_id: (value as types.Task)._id!,
|
||||||
definition,
|
definition,
|
||||||
name: value.name,
|
name: value.name,
|
||||||
|
@ -284,7 +284,7 @@ export namespace TaskDTO {
|
||||||
};
|
};
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
export async function to(value: tasks.TaskDTO | undefined, workspace: IExtHostWorkspaceProvider, providedCustomExeutions: Map<string, types.CustomExecution>): Promise<types.Task | undefined> {
|
export async function to(value: tasks.ITaskDTO | undefined, workspace: IExtHostWorkspaceProvider, providedCustomExeutions: Map<string, types.CustomExecution>): Promise<types.Task | undefined> {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -339,11 +339,11 @@ export namespace TaskDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace TaskFilterDTO {
|
export namespace TaskFilterDTO {
|
||||||
export function from(value: vscode.TaskFilter | undefined): tasks.TaskFilterDTO | undefined {
|
export function from(value: vscode.TaskFilter | undefined): tasks.ITaskFilterDTO | undefined {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function to(value: tasks.TaskFilterDTO): vscode.TaskFilter | undefined {
|
export function to(value: tasks.ITaskFilterDTO): vscode.TaskFilter | undefined {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -367,15 +367,15 @@ class TaskExecutionImpl implements vscode.TaskExecution {
|
||||||
this.#tasks.terminateTask(this);
|
this.#tasks.terminateTask(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public fireDidStartProcess(value: tasks.TaskProcessStartedDTO): void {
|
public fireDidStartProcess(value: tasks.ITaskProcessStartedDTO): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
public fireDidEndProcess(value: tasks.TaskProcessEndedDTO): void {
|
public fireDidEndProcess(value: tasks.ITaskProcessEndedDTO): void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace TaskExecutionDTO {
|
export namespace TaskExecutionDTO {
|
||||||
export function from(value: vscode.TaskExecution): tasks.TaskExecutionDTO {
|
export function from(value: vscode.TaskExecution): tasks.ITaskExecutionDTO {
|
||||||
return {
|
return {
|
||||||
id: (value as TaskExecutionImpl)._id,
|
id: (value as TaskExecutionImpl)._id,
|
||||||
task: undefined
|
task: undefined
|
||||||
|
@ -453,7 +453,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public registerTaskSystem(scheme: string, info: tasks.TaskSystemInfoDTO): void {
|
public registerTaskSystem(scheme: string, info: tasks.ITaskSystemInfoDTO): void {
|
||||||
this._proxy.$registerTaskSystem(scheme, info);
|
this._proxy.$registerTaskSystem(scheme, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,7 +489,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask
|
||||||
return this._onDidExecuteTask.event;
|
return this._onDidExecuteTask.event;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async $onDidStartTask(execution: tasks.TaskExecutionDTO, terminalId: number, resolvedDefinition: tasks.TaskDefinitionDTO): Promise<void> {
|
public async $onDidStartTask(execution: tasks.ITaskExecutionDTO, terminalId: number, resolvedDefinition: tasks.ITaskDefinitionDTO): Promise<void> {
|
||||||
const customExecution: types.CustomExecution | undefined = this._providedCustomExecutions2.get(execution.id);
|
const customExecution: types.CustomExecution | undefined = this._providedCustomExecutions2.get(execution.id);
|
||||||
if (customExecution) {
|
if (customExecution) {
|
||||||
// Clone the custom execution to keep the original untouched. This is important for multiple runs of the same task.
|
// Clone the custom execution to keep the original untouched. This is important for multiple runs of the same task.
|
||||||
|
@ -507,7 +507,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask
|
||||||
return this._onDidTerminateTask.event;
|
return this._onDidTerminateTask.event;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async $OnDidEndTask(execution: tasks.TaskExecutionDTO): Promise<void> {
|
public async $OnDidEndTask(execution: tasks.ITaskExecutionDTO): Promise<void> {
|
||||||
const _execution = await this.getTaskExecution(execution);
|
const _execution = await this.getTaskExecution(execution);
|
||||||
this._taskExecutionPromises.delete(execution.id);
|
this._taskExecutionPromises.delete(execution.id);
|
||||||
this._taskExecutions.delete(execution.id);
|
this._taskExecutions.delete(execution.id);
|
||||||
|
@ -521,7 +521,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask
|
||||||
return this._onDidTaskProcessStarted.event;
|
return this._onDidTaskProcessStarted.event;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async $onDidStartTaskProcess(value: tasks.TaskProcessStartedDTO): Promise<void> {
|
public async $onDidStartTaskProcess(value: tasks.ITaskProcessStartedDTO): Promise<void> {
|
||||||
const execution = await this.getTaskExecution(value.id);
|
const execution = await this.getTaskExecution(value.id);
|
||||||
this._onDidTaskProcessStarted.fire({
|
this._onDidTaskProcessStarted.fire({
|
||||||
execution: execution,
|
execution: execution,
|
||||||
|
@ -533,7 +533,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask
|
||||||
return this._onDidTaskProcessEnded.event;
|
return this._onDidTaskProcessEnded.event;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async $onDidEndTaskProcess(value: tasks.TaskProcessEndedDTO): Promise<void> {
|
public async $onDidEndTaskProcess(value: tasks.ITaskProcessEndedDTO): Promise<void> {
|
||||||
const execution = await this.getTaskExecution(value.id);
|
const execution = await this.getTaskExecution(value.id);
|
||||||
this._onDidTaskProcessEnded.fire({
|
this._onDidTaskProcessEnded.fire({
|
||||||
execution: execution,
|
execution: execution,
|
||||||
|
@ -541,9 +541,9 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract provideTasksInternal(validTypes: { [key: string]: boolean }, taskIdPromises: Promise<void>[], handler: HandlerData, value: vscode.Task[] | null | undefined): { tasks: tasks.TaskDTO[]; extension: IExtensionDescription };
|
protected abstract provideTasksInternal(validTypes: { [key: string]: boolean }, taskIdPromises: Promise<void>[], handler: HandlerData, value: vscode.Task[] | null | undefined): { tasks: tasks.ITaskDTO[]; extension: IExtensionDescription };
|
||||||
|
|
||||||
public $provideTasks(handle: number, validTypes: { [key: string]: boolean }): Promise<tasks.TaskSetDTO> {
|
public $provideTasks(handle: number, validTypes: { [key: string]: boolean }): Promise<tasks.ITaskSetDTO> {
|
||||||
const handler = this._handlers.get(handle);
|
const handler = this._handlers.get(handle);
|
||||||
if (!handler) {
|
if (!handler) {
|
||||||
return Promise.reject(new Error('no handler found'));
|
return Promise.reject(new Error('no handler found'));
|
||||||
|
@ -571,9 +571,9 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract resolveTaskInternal(resolvedTaskDTO: tasks.TaskDTO): Promise<tasks.TaskDTO | undefined>;
|
protected abstract resolveTaskInternal(resolvedTaskDTO: tasks.ITaskDTO): Promise<tasks.ITaskDTO | undefined>;
|
||||||
|
|
||||||
public async $resolveTask(handle: number, taskDTO: tasks.TaskDTO): Promise<tasks.TaskDTO | undefined> {
|
public async $resolveTask(handle: number, taskDTO: tasks.ITaskDTO): Promise<tasks.ITaskDTO | undefined> {
|
||||||
const handler = this._handlers.get(handle);
|
const handler = this._handlers.get(handle);
|
||||||
if (!handler) {
|
if (!handler) {
|
||||||
return Promise.reject(new Error('no handler found'));
|
return Promise.reject(new Error('no handler found'));
|
||||||
|
@ -595,7 +595,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask
|
||||||
|
|
||||||
this.checkDeprecation(resolvedTask, handler);
|
this.checkDeprecation(resolvedTask, handler);
|
||||||
|
|
||||||
const resolvedTaskDTO: tasks.TaskDTO | undefined = TaskDTO.from(resolvedTask, handler.extension);
|
const resolvedTaskDTO: tasks.ITaskDTO | undefined = TaskDTO.from(resolvedTask, handler.extension);
|
||||||
if (!resolvedTaskDTO) {
|
if (!resolvedTaskDTO) {
|
||||||
throw new Error('Unexpected: Task cannot be resolved.');
|
throw new Error('Unexpected: Task cannot be resolved.');
|
||||||
}
|
}
|
||||||
|
@ -617,7 +617,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask
|
||||||
return this._handleCounter++;
|
return this._handleCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async addCustomExecution(taskDTO: tasks.TaskDTO, task: vscode.Task, isProvided: boolean): Promise<void> {
|
protected async addCustomExecution(taskDTO: tasks.ITaskDTO, task: vscode.Task, isProvided: boolean): Promise<void> {
|
||||||
const taskId = await this._proxy.$createTaskId(taskDTO);
|
const taskId = await this._proxy.$createTaskId(taskDTO);
|
||||||
if (!isProvided && !this._providedCustomExecutions2.has(taskId)) {
|
if (!isProvided && !this._providedCustomExecutions2.has(taskId)) {
|
||||||
this._notProvidedCustomExecutions.add(taskId);
|
this._notProvidedCustomExecutions.add(taskId);
|
||||||
|
@ -627,7 +627,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask
|
||||||
this._providedCustomExecutions2.set(taskId, <types.CustomExecution>task.execution);
|
this._providedCustomExecutions2.set(taskId, <types.CustomExecution>task.execution);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async getTaskExecution(execution: tasks.TaskExecutionDTO | string, task?: vscode.Task): Promise<TaskExecutionImpl> {
|
protected async getTaskExecution(execution: tasks.ITaskExecutionDTO | string, task?: vscode.Task): Promise<TaskExecutionImpl> {
|
||||||
if (typeof execution === 'string') {
|
if (typeof execution === 'string') {
|
||||||
const taskExecution = this._taskExecutionPromises.get(execution);
|
const taskExecution = this._taskExecutionPromises.get(execution);
|
||||||
if (!taskExecution) {
|
if (!taskExecution) {
|
||||||
|
@ -641,7 +641,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
const createdResult: Promise<TaskExecutionImpl> = new Promise((resolve, reject) => {
|
const createdResult: Promise<TaskExecutionImpl> = new Promise((resolve, reject) => {
|
||||||
function resolvePromiseWithCreatedTask(that: ExtHostTaskBase, execution: tasks.TaskExecutionDTO, taskToCreate: vscode.Task | types.Task | undefined) {
|
function resolvePromiseWithCreatedTask(that: ExtHostTaskBase, execution: tasks.ITaskExecutionDTO, taskToCreate: vscode.Task | types.Task | undefined) {
|
||||||
if (!taskToCreate) {
|
if (!taskToCreate) {
|
||||||
reject('Unexpected: Task does not exist.');
|
reject('Unexpected: Task does not exist.');
|
||||||
} else {
|
} else {
|
||||||
|
@ -673,7 +673,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private customExecutionComplete(execution: tasks.TaskExecutionDTO): void {
|
private customExecutionComplete(execution: tasks.ITaskExecutionDTO): void {
|
||||||
const extensionCallback2: vscode.CustomExecution | undefined = this._activeCustomExecutions2.get(execution.id);
|
const extensionCallback2: vscode.CustomExecution | undefined = this._activeCustomExecutions2.get(execution.id);
|
||||||
if (extensionCallback2) {
|
if (extensionCallback2) {
|
||||||
this._activeCustomExecutions2.delete(execution.id);
|
this._activeCustomExecutions2.delete(execution.id);
|
||||||
|
@ -747,8 +747,8 @@ export class WorkerExtHostTask extends ExtHostTaskBase {
|
||||||
return execution;
|
return execution;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected provideTasksInternal(validTypes: { [key: string]: boolean }, taskIdPromises: Promise<void>[], handler: HandlerData, value: vscode.Task[] | null | undefined): { tasks: tasks.TaskDTO[]; extension: IExtensionDescription } {
|
protected provideTasksInternal(validTypes: { [key: string]: boolean }, taskIdPromises: Promise<void>[], handler: HandlerData, value: vscode.Task[] | null | undefined): { tasks: tasks.ITaskDTO[]; extension: IExtensionDescription } {
|
||||||
const taskDTOs: tasks.TaskDTO[] = [];
|
const taskDTOs: tasks.ITaskDTO[] = [];
|
||||||
if (value) {
|
if (value) {
|
||||||
for (let task of value) {
|
for (let task of value) {
|
||||||
this.checkDeprecation(task, handler);
|
this.checkDeprecation(task, handler);
|
||||||
|
@ -756,7 +756,7 @@ export class WorkerExtHostTask extends ExtHostTaskBase {
|
||||||
this._logService.warn(`The task [${task.source}, ${task.name}] uses an undefined task type. The task will be ignored in the future.`);
|
this._logService.warn(`The task [${task.source}, ${task.name}] uses an undefined task type. The task will be ignored in the future.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const taskDTO: tasks.TaskDTO | undefined = TaskDTO.from(task, handler.extension);
|
const taskDTO: tasks.ITaskDTO | undefined = TaskDTO.from(task, handler.extension);
|
||||||
if (taskDTO && CustomExecutionDTO.is(taskDTO.execution)) {
|
if (taskDTO && CustomExecutionDTO.is(taskDTO.execution)) {
|
||||||
taskDTOs.push(taskDTO);
|
taskDTOs.push(taskDTO);
|
||||||
// The ID is calculated on the main thread task side, so, let's call into it here.
|
// The ID is calculated on the main thread task side, so, let's call into it here.
|
||||||
|
@ -774,7 +774,7 @@ export class WorkerExtHostTask extends ExtHostTaskBase {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async resolveTaskInternal(resolvedTaskDTO: tasks.TaskDTO): Promise<tasks.TaskDTO | undefined> {
|
protected async resolveTaskInternal(resolvedTaskDTO: tasks.ITaskDTO): Promise<tasks.ITaskDTO | undefined> {
|
||||||
if (CustomExecutionDTO.is(resolvedTaskDTO.execution)) {
|
if (CustomExecutionDTO.is(resolvedTaskDTO.execution)) {
|
||||||
return resolvedTaskDTO;
|
return resolvedTaskDTO;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -7,12 +7,12 @@ import { UriComponents } from 'vs/base/common/uri';
|
||||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||||
import type { Dto } from 'vs/workbench/services/extensions/common/proxyIdentifier';
|
import type { Dto } from 'vs/workbench/services/extensions/common/proxyIdentifier';
|
||||||
|
|
||||||
export interface TaskDefinitionDTO {
|
export interface ITaskDefinitionDTO {
|
||||||
type: string;
|
type: string;
|
||||||
[name: string]: any;
|
[name: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskPresentationOptionsDTO {
|
export interface ITaskPresentationOptionsDTO {
|
||||||
reveal?: number;
|
reveal?: number;
|
||||||
echo?: boolean;
|
echo?: boolean;
|
||||||
focus?: boolean;
|
focus?: boolean;
|
||||||
|
@ -23,25 +23,25 @@ export interface TaskPresentationOptionsDTO {
|
||||||
close?: boolean;
|
close?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RunOptionsDTO {
|
export interface IRunOptionsDTO {
|
||||||
reevaluateOnRerun?: boolean;
|
reevaluateOnRerun?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ExecutionOptionsDTO {
|
export interface IExecutionOptionsDTO {
|
||||||
cwd?: string;
|
cwd?: string;
|
||||||
env?: { [key: string]: string };
|
env?: { [key: string]: string };
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProcessExecutionOptionsDTO extends ExecutionOptionsDTO {
|
export interface IProcessExecutionOptionsDTO extends IExecutionOptionsDTO {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProcessExecutionDTO {
|
export interface IProcessExecutionDTO {
|
||||||
process: string;
|
process: string;
|
||||||
args: string[];
|
args: string[];
|
||||||
options?: ProcessExecutionOptionsDTO;
|
options?: IProcessExecutionOptionsDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ShellQuotingOptionsDTO {
|
export interface IShellQuotingOptionsDTO {
|
||||||
escape?: string | {
|
escape?: string | {
|
||||||
escapeChar: string;
|
escapeChar: string;
|
||||||
charsToEscape: string;
|
charsToEscape: string;
|
||||||
|
@ -50,86 +50,86 @@ export interface ShellQuotingOptionsDTO {
|
||||||
weak?: string;
|
weak?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ShellExecutionOptionsDTO extends ExecutionOptionsDTO {
|
export interface IShellExecutionOptionsDTO extends IExecutionOptionsDTO {
|
||||||
executable?: string;
|
executable?: string;
|
||||||
shellArgs?: string[];
|
shellArgs?: string[];
|
||||||
shellQuoting?: ShellQuotingOptionsDTO;
|
shellQuoting?: IShellQuotingOptionsDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ShellQuotedStringDTO {
|
export interface IShellQuotedStringDTO {
|
||||||
value: string;
|
value: string;
|
||||||
quoting: number;
|
quoting: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ShellExecutionDTO {
|
export interface IShellExecutionDTO {
|
||||||
commandLine?: string;
|
commandLine?: string;
|
||||||
command?: string | ShellQuotedStringDTO;
|
command?: string | IShellQuotedStringDTO;
|
||||||
args?: Array<string | ShellQuotedStringDTO>;
|
args?: Array<string | IShellQuotedStringDTO>;
|
||||||
options?: ShellExecutionOptionsDTO;
|
options?: IShellExecutionOptionsDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CustomExecutionDTO {
|
export interface ICustomExecutionDTO {
|
||||||
customExecution: 'customExecution';
|
customExecution: 'customExecution';
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskSourceDTO {
|
export interface ITaskSourceDTO {
|
||||||
label: string;
|
label: string;
|
||||||
extensionId?: string;
|
extensionId?: string;
|
||||||
scope?: number | UriComponents;
|
scope?: number | UriComponents;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskHandleDTO {
|
export interface ITaskHandleDTO {
|
||||||
id: string;
|
id: string;
|
||||||
workspaceFolder: UriComponents | string;
|
workspaceFolder: UriComponents | string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskGroupDTO {
|
export interface ITaskGroupDTO {
|
||||||
isDefault?: boolean;
|
isDefault?: boolean;
|
||||||
_id: string;
|
_id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskDTO {
|
export interface ITaskDTO {
|
||||||
_id: string;
|
_id: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
execution: ProcessExecutionDTO | ShellExecutionDTO | CustomExecutionDTO | undefined;
|
execution: IProcessExecutionDTO | IShellExecutionDTO | ICustomExecutionDTO | undefined;
|
||||||
definition: TaskDefinitionDTO;
|
definition: ITaskDefinitionDTO;
|
||||||
isBackground?: boolean;
|
isBackground?: boolean;
|
||||||
source: TaskSourceDTO;
|
source: ITaskSourceDTO;
|
||||||
group?: TaskGroupDTO;
|
group?: ITaskGroupDTO;
|
||||||
detail?: string;
|
detail?: string;
|
||||||
presentationOptions?: TaskPresentationOptionsDTO;
|
presentationOptions?: ITaskPresentationOptionsDTO;
|
||||||
problemMatchers: string[];
|
problemMatchers: string[];
|
||||||
hasDefinedMatchers: boolean;
|
hasDefinedMatchers: boolean;
|
||||||
runOptions?: RunOptionsDTO;
|
runOptions?: IRunOptionsDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskSetDTO {
|
export interface ITaskSetDTO {
|
||||||
tasks: TaskDTO[];
|
tasks: ITaskDTO[];
|
||||||
extension: Dto<IExtensionDescription>;
|
extension: Dto<IExtensionDescription>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskExecutionDTO {
|
export interface ITaskExecutionDTO {
|
||||||
id: string;
|
id: string;
|
||||||
task: TaskDTO | undefined;
|
task: ITaskDTO | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskProcessStartedDTO {
|
export interface ITaskProcessStartedDTO {
|
||||||
id: string;
|
id: string;
|
||||||
processId: number;
|
processId: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskProcessEndedDTO {
|
export interface ITaskProcessEndedDTO {
|
||||||
id: string;
|
id: string;
|
||||||
exitCode: number | undefined;
|
exitCode: number | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export interface TaskFilterDTO {
|
export interface ITaskFilterDTO {
|
||||||
version?: string;
|
version?: string;
|
||||||
type?: string;
|
type?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskSystemInfoDTO {
|
export interface ITaskSystemInfoDTO {
|
||||||
scheme: string;
|
scheme: string;
|
||||||
authority: string;
|
authority: string;
|
||||||
platform: string;
|
platform: string;
|
||||||
|
|
|
@ -92,8 +92,8 @@ export class ExtHostTask extends ExtHostTaskBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected provideTasksInternal(validTypes: { [key: string]: boolean }, taskIdPromises: Promise<void>[], handler: HandlerData, value: vscode.Task[] | null | undefined): { tasks: tasks.TaskDTO[]; extension: IExtensionDescription } {
|
protected provideTasksInternal(validTypes: { [key: string]: boolean }, taskIdPromises: Promise<void>[], handler: HandlerData, value: vscode.Task[] | null | undefined): { tasks: tasks.ITaskDTO[]; extension: IExtensionDescription } {
|
||||||
const taskDTOs: tasks.TaskDTO[] = [];
|
const taskDTOs: tasks.ITaskDTO[] = [];
|
||||||
if (value) {
|
if (value) {
|
||||||
for (let task of value) {
|
for (let task of value) {
|
||||||
this.checkDeprecation(task, handler);
|
this.checkDeprecation(task, handler);
|
||||||
|
@ -102,7 +102,7 @@ export class ExtHostTask extends ExtHostTaskBase {
|
||||||
this._logService.warn(`The task [${task.source}, ${task.name}] uses an undefined task type. The task will be ignored in the future.`);
|
this._logService.warn(`The task [${task.source}, ${task.name}] uses an undefined task type. The task will be ignored in the future.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const taskDTO: tasks.TaskDTO | undefined = TaskDTO.from(task, handler.extension);
|
const taskDTO: tasks.ITaskDTO | undefined = TaskDTO.from(task, handler.extension);
|
||||||
if (taskDTO) {
|
if (taskDTO) {
|
||||||
taskDTOs.push(taskDTO);
|
taskDTOs.push(taskDTO);
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ export class ExtHostTask extends ExtHostTaskBase {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async resolveTaskInternal(resolvedTaskDTO: tasks.TaskDTO): Promise<tasks.TaskDTO | undefined> {
|
protected async resolveTaskInternal(resolvedTaskDTO: tasks.ITaskDTO): Promise<tasks.ITaskDTO | undefined> {
|
||||||
return resolvedTaskDTO;
|
return resolvedTaskDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { Markers } from 'vs/workbench/contrib/markers/common/markers';
|
||||||
import { ITaskService, ITaskSummary } from 'vs/workbench/contrib/tasks/common/taskService';
|
import { ITaskService, ITaskSummary } from 'vs/workbench/contrib/tasks/common/taskService';
|
||||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||||
import { IWorkspaceFolder, IWorkspace } from 'vs/platform/workspace/common/workspace';
|
import { IWorkspaceFolder, IWorkspace } from 'vs/platform/workspace/common/workspace';
|
||||||
import { TaskEvent, TaskEventKind, TaskIdentifier } from 'vs/workbench/contrib/tasks/common/tasks';
|
import { ITaskEvent, TaskEventKind, ITaskIdentifier } from 'vs/workbench/contrib/tasks/common/tasks';
|
||||||
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||||
import { withUndefinedAsNull } from 'vs/base/common/types';
|
import { withUndefinedAsNull } from 'vs/base/common/types';
|
||||||
import { IMarkerService, MarkerSeverity } from 'vs/platform/markers/common/markers';
|
import { IMarkerService, MarkerSeverity } from 'vs/platform/markers/common/markers';
|
||||||
|
@ -22,7 +22,7 @@ import { Action } from 'vs/base/common/actions';
|
||||||
import { DEBUG_CONFIGURE_COMMAND_ID, DEBUG_CONFIGURE_LABEL } from 'vs/workbench/contrib/debug/browser/debugCommands';
|
import { DEBUG_CONFIGURE_COMMAND_ID, DEBUG_CONFIGURE_LABEL } from 'vs/workbench/contrib/debug/browser/debugCommands';
|
||||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||||
|
|
||||||
function once(match: (e: TaskEvent) => boolean, event: Event<TaskEvent>): Event<TaskEvent> {
|
function once(match: (e: ITaskEvent) => boolean, event: Event<ITaskEvent>): Event<ITaskEvent> {
|
||||||
return (listener, thisArgs = null, disposables?) => {
|
return (listener, thisArgs = null, disposables?) => {
|
||||||
const result = event(e => {
|
const result = event(e => {
|
||||||
if (match(e)) {
|
if (match(e)) {
|
||||||
|
@ -59,7 +59,7 @@ export class DebugTaskRunner {
|
||||||
this.canceled = true;
|
this.canceled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
async runTaskAndCheckErrors(root: IWorkspaceFolder | IWorkspace | undefined, taskId: string | TaskIdentifier | undefined): Promise<TaskRunResult> {
|
async runTaskAndCheckErrors(root: IWorkspaceFolder | IWorkspace | undefined, taskId: string | ITaskIdentifier | undefined): Promise<TaskRunResult> {
|
||||||
try {
|
try {
|
||||||
this.canceled = false;
|
this.canceled = false;
|
||||||
const taskSummary = await this.runTask(root, taskId);
|
const taskSummary = await this.runTask(root, taskId);
|
||||||
|
@ -149,7 +149,7 @@ export class DebugTaskRunner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async runTask(root: IWorkspace | IWorkspaceFolder | undefined, taskId: string | TaskIdentifier | undefined): Promise<ITaskSummary | null> {
|
async runTask(root: IWorkspace | IWorkspaceFolder | undefined, taskId: string | ITaskIdentifier | undefined): Promise<ITaskSummary | null> {
|
||||||
if (!taskId) {
|
if (!taskId) {
|
||||||
return Promise.resolve(null);
|
return Promise.resolve(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||||
import { IEditorPane } from 'vs/workbench/common/editor';
|
import { IEditorPane } from 'vs/workbench/common/editor';
|
||||||
import { DebugCompoundRoot } from 'vs/workbench/contrib/debug/common/debugCompoundRoot';
|
import { DebugCompoundRoot } from 'vs/workbench/contrib/debug/common/debugCompoundRoot';
|
||||||
import { Source } from 'vs/workbench/contrib/debug/common/debugSource';
|
import { Source } from 'vs/workbench/contrib/debug/common/debugSource';
|
||||||
import { TaskIdentifier } from 'vs/workbench/contrib/tasks/common/tasks';
|
import { ITaskIdentifier } from 'vs/workbench/contrib/tasks/common/tasks';
|
||||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||||
|
|
||||||
export const VIEWLET_ID = 'workbench.view.debug';
|
export const VIEWLET_ID = 'workbench.view.debug';
|
||||||
|
@ -650,10 +650,10 @@ export interface IGlobalConfig {
|
||||||
|
|
||||||
export interface IEnvConfig {
|
export interface IEnvConfig {
|
||||||
internalConsoleOptions?: 'neverOpen' | 'openOnSessionStart' | 'openOnFirstSessionStart';
|
internalConsoleOptions?: 'neverOpen' | 'openOnSessionStart' | 'openOnFirstSessionStart';
|
||||||
preRestartTask?: string | TaskIdentifier;
|
preRestartTask?: string | ITaskIdentifier;
|
||||||
postRestartTask?: string | TaskIdentifier;
|
postRestartTask?: string | ITaskIdentifier;
|
||||||
preLaunchTask?: string | TaskIdentifier;
|
preLaunchTask?: string | ITaskIdentifier;
|
||||||
postDebugTask?: string | TaskIdentifier;
|
postDebugTask?: string | ITaskIdentifier;
|
||||||
debugServer?: number;
|
debugServer?: number;
|
||||||
noDebug?: boolean;
|
noDebug?: boolean;
|
||||||
}
|
}
|
||||||
|
@ -687,7 +687,7 @@ export interface IConfig extends IEnvConfig {
|
||||||
export interface ICompound {
|
export interface ICompound {
|
||||||
name: string;
|
name: string;
|
||||||
stopAll?: boolean;
|
stopAll?: boolean;
|
||||||
preLaunchTask?: string | TaskIdentifier;
|
preLaunchTask?: string | ITaskIdentifier;
|
||||||
configurations: (string | { name: string; folder: string })[];
|
configurations: (string | { name: string; folder: string })[];
|
||||||
presentation?: IConfigPresentation;
|
presentation?: IConfigPresentation;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configur
|
||||||
import { IFileService, IFileStatWithPartialMetadata } from 'vs/platform/files/common/files';
|
import { IFileService, IFileStatWithPartialMetadata } from 'vs/platform/files/common/files';
|
||||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||||
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
|
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
|
||||||
import { ProblemMatcherRegistry, NamedProblemMatcher } from 'vs/workbench/contrib/tasks/common/problemMatcher';
|
import { ProblemMatcherRegistry, INamedProblemMatcher } from 'vs/workbench/contrib/tasks/common/problemMatcher';
|
||||||
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
|
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
|
||||||
import { IProgressService, IProgressOptions, ProgressLocation } from 'vs/platform/progress/common/progress';
|
import { IProgressService, IProgressOptions, ProgressLocation } from 'vs/platform/progress/common/progress';
|
||||||
|
|
||||||
|
@ -47,15 +47,15 @@ import { IOutputService, IOutputChannel } from 'vs/workbench/services/output/com
|
||||||
import { ITerminalGroupService, ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal';
|
import { ITerminalGroupService, ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal';
|
||||||
import { ITerminalProfileResolverService } from 'vs/workbench/contrib/terminal/common/terminal';
|
import { ITerminalProfileResolverService } from 'vs/workbench/contrib/terminal/common/terminal';
|
||||||
|
|
||||||
import { ITaskSystem, ITaskResolver, ITaskSummary, TaskExecuteKind, TaskError, TaskErrors, TaskTerminateResponse, TaskSystemInfo, ITaskExecuteResult } from 'vs/workbench/contrib/tasks/common/taskSystem';
|
import { ITaskSystem, ITaskResolver, ITaskSummary, TaskExecuteKind, TaskError, TaskErrors, ITaskTerminateResponse, ITaskSystemInfo, ITaskExecuteResult } from 'vs/workbench/contrib/tasks/common/taskSystem';
|
||||||
import {
|
import {
|
||||||
Task, CustomTask, ConfiguringTask, ContributedTask, InMemoryTask, TaskEvent,
|
Task, CustomTask, ConfiguringTask, ContributedTask, InMemoryTask, ITaskEvent,
|
||||||
TaskSet, TaskGroup, ExecutionEngine, JsonSchemaVersion, TaskSourceKind,
|
ITaskSet, TaskGroup, ExecutionEngine, JsonSchemaVersion, TaskSourceKind,
|
||||||
TaskSorter, TaskIdentifier, KeyedTaskIdentifier, TASK_RUNNING_STATE, TaskRunSource,
|
TaskSorter, ITaskIdentifier, TASK_RUNNING_STATE, TaskRunSource,
|
||||||
KeyedTaskIdentifier as NKeyedTaskIdentifier, TaskDefinition, RuntimeType,
|
KeyedTaskIdentifier as KeyedTaskIdentifier, TaskDefinition, RuntimeType,
|
||||||
USER_TASKS_GROUP_KEY
|
USER_TASKS_GROUP_KEY
|
||||||
} from 'vs/workbench/contrib/tasks/common/tasks';
|
} from 'vs/workbench/contrib/tasks/common/tasks';
|
||||||
import { ITaskService, ITaskProvider, ProblemMatcherRunOptions, CustomizationProperties, TaskFilter, WorkspaceFolderTaskResult, CustomExecutionSupportedContext, ShellExecutionSupportedContext, ProcessExecutionSupportedContext } from 'vs/workbench/contrib/tasks/common/taskService';
|
import { ITaskService, ITaskProvider, IProblemMatcherRunOptions, ICustomizationProperties, ITaskFilter, IWorkspaceFolderTaskResult, CustomExecutionSupportedContext, ShellExecutionSupportedContext, ProcessExecutionSupportedContext } from 'vs/workbench/contrib/tasks/common/taskService';
|
||||||
import { getTemplates as getTaskTemplates } from 'vs/workbench/contrib/tasks/common/taskTemplates';
|
import { getTemplates as getTaskTemplates } from 'vs/workbench/contrib/tasks/common/taskTemplates';
|
||||||
|
|
||||||
import * as TaskConfig from '../common/taskConfiguration';
|
import * as TaskConfig from '../common/taskConfiguration';
|
||||||
|
@ -76,7 +76,7 @@ import { ITextEditorSelection, TextEditorSelectionRevealType } from 'vs/platform
|
||||||
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';
|
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';
|
||||||
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
|
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||||
import { IViewsService, IViewDescriptorService } from 'vs/workbench/common/views';
|
import { IViewsService, IViewDescriptorService } from 'vs/workbench/common/views';
|
||||||
import { isWorkspaceFolder, TaskQuickPickEntry, QUICKOPEN_DETAIL_CONFIG, TaskQuickPick, QUICKOPEN_SKIP_CONFIG, configureTaskIcon } from 'vs/workbench/contrib/tasks/browser/taskQuickPick';
|
import { isWorkspaceFolder, ITaskQuickPickEntry, QUICKOPEN_DETAIL_CONFIG, TaskQuickPick, QUICKOPEN_SKIP_CONFIG, configureTaskIcon } from 'vs/workbench/contrib/tasks/browser/taskQuickPick';
|
||||||
import { ILogService } from 'vs/platform/log/common/log';
|
import { ILogService } from 'vs/platform/log/common/log';
|
||||||
import { once } from 'vs/base/common/functional';
|
import { once } from 'vs/base/common/functional';
|
||||||
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
|
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
|
||||||
|
@ -129,13 +129,13 @@ class ProblemReporter implements TaskConfig.IProblemReporter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WorkspaceFolderConfigurationResult {
|
export interface IWorkspaceFolderConfigurationResult {
|
||||||
workspaceFolder: IWorkspaceFolder;
|
workspaceFolder: IWorkspaceFolder;
|
||||||
config: TaskConfig.ExternalTaskRunnerConfiguration | undefined;
|
config: TaskConfig.IExternalTaskRunnerConfiguration | undefined;
|
||||||
hasErrors: boolean;
|
hasErrors: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface CommandUpgrade {
|
interface ICommandUpgrade {
|
||||||
command?: string;
|
command?: string;
|
||||||
args?: string[];
|
args?: string[];
|
||||||
}
|
}
|
||||||
|
@ -206,9 +206,9 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
private _showIgnoreMessage?: boolean;
|
private _showIgnoreMessage?: boolean;
|
||||||
private _providers: Map<number, ITaskProvider>;
|
private _providers: Map<number, ITaskProvider>;
|
||||||
private _providerTypes: Map<number, string>;
|
private _providerTypes: Map<number, string>;
|
||||||
protected _taskSystemInfos: Map<string, TaskSystemInfo[]>;
|
protected _taskSystemInfos: Map<string, ITaskSystemInfo[]>;
|
||||||
|
|
||||||
protected _workspaceTasksPromise?: Promise<Map<string, WorkspaceFolderTaskResult>>;
|
protected _workspaceTasksPromise?: Promise<Map<string, IWorkspaceFolderTaskResult>>;
|
||||||
|
|
||||||
protected _taskSystem?: ITaskSystem;
|
protected _taskSystem?: ITaskSystem;
|
||||||
protected _taskSystemListener?: IDisposable;
|
protected _taskSystemListener?: IDisposable;
|
||||||
|
@ -218,7 +218,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
protected _taskRunningState: IContextKey<boolean>;
|
protected _taskRunningState: IContextKey<boolean>;
|
||||||
|
|
||||||
protected _outputChannel: IOutputChannel;
|
protected _outputChannel: IOutputChannel;
|
||||||
protected readonly _onDidStateChange: Emitter<TaskEvent>;
|
protected readonly _onDidStateChange: Emitter<ITaskEvent>;
|
||||||
private _waitForSupportedExecutions: Promise<void>;
|
private _waitForSupportedExecutions: Promise<void>;
|
||||||
private _onDidRegisterSupportedExecutions: Emitter<void> = new Emitter();
|
private _onDidRegisterSupportedExecutions: Emitter<void> = new Emitter();
|
||||||
private _onDidChangeTaskSystemInfo: Emitter<void> = new Emitter();
|
private _onDidChangeTaskSystemInfo: Emitter<void> = new Emitter();
|
||||||
|
@ -266,7 +266,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
this._outputChannel = this.outputService.getChannel(AbstractTaskService.OutputChannelId)!;
|
this._outputChannel = this.outputService.getChannel(AbstractTaskService.OutputChannelId)!;
|
||||||
this._providers = new Map<number, ITaskProvider>();
|
this._providers = new Map<number, ITaskProvider>();
|
||||||
this._providerTypes = new Map<number, string>();
|
this._providerTypes = new Map<number, string>();
|
||||||
this._taskSystemInfos = new Map<string, TaskSystemInfo[]>();
|
this._taskSystemInfos = new Map<string, ITaskSystemInfo[]>();
|
||||||
this._register(this.contextService.onDidChangeWorkspaceFolders(() => {
|
this._register(this.contextService.onDidChangeWorkspaceFolders(() => {
|
||||||
let folderSetup = this.computeWorkspaceFolderSetup();
|
let folderSetup = this.computeWorkspaceFolderSetup();
|
||||||
if (this.executionEngine !== folderSetup[2]) {
|
if (this.executionEngine !== folderSetup[2]) {
|
||||||
|
@ -301,7 +301,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let entry: TaskQuickPickEntry | null | undefined;
|
let entry: ITaskQuickPickEntry | null | undefined;
|
||||||
if (tasks && tasks.length > 0) {
|
if (tasks && tasks.length > 0) {
|
||||||
entry = await this.showQuickPick(tasks, nls.localize('TaskService.pickBuildTaskForLabel', 'Select the build task (there is no default build task defined)'));
|
entry = await this.showQuickPick(tasks, nls.localize('TaskService.pickBuildTaskForLabel', 'Select the build task (there is no default build task defined)'));
|
||||||
}
|
}
|
||||||
|
@ -336,7 +336,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
this._onDidRegisterSupportedExecutions.fire();
|
this._onDidRegisterSupportedExecutions.fire();
|
||||||
}
|
}
|
||||||
|
|
||||||
public get onDidStateChange(): Event<TaskEvent> {
|
public get onDidStateChange(): Event<ITaskEvent> {
|
||||||
return this._onDidStateChange.event;
|
return this._onDidStateChange.event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -577,7 +577,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return infosCount > 0;
|
return infosCount > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public registerTaskSystem(key: string, info: TaskSystemInfo): void {
|
public registerTaskSystem(key: string, info: ITaskSystemInfo): void {
|
||||||
// Ideally the Web caller of registerRegisterTaskSystem would use the correct key.
|
// Ideally the Web caller of registerRegisterTaskSystem would use the correct key.
|
||||||
// However, the caller doesn't know about the workspace folders at the time of the call, even though we know about them here.
|
// However, the caller doesn't know about the workspace folders at the time of the call, even though we know about them here.
|
||||||
if (info.platform === Platform.Platform.Web) {
|
if (info.platform === Platform.Platform.Web) {
|
||||||
|
@ -600,7 +600,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private getTaskSystemInfo(key: string): TaskSystemInfo | undefined {
|
private getTaskSystemInfo(key: string): ITaskSystemInfo | undefined {
|
||||||
const infos = this._taskSystemInfos.get(key);
|
const infos = this._taskSystemInfos.get(key);
|
||||||
return (infos && infos.length) ? infos[0] : undefined;
|
return (infos && infos.length) ? infos[0] : undefined;
|
||||||
}
|
}
|
||||||
|
@ -650,7 +650,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getTask(folder: IWorkspace | IWorkspaceFolder | string, identifier: string | TaskIdentifier, compareId: boolean = false): Promise<Task | undefined> {
|
public async getTask(folder: IWorkspace | IWorkspaceFolder | string, identifier: string | ITaskIdentifier, compareId: boolean = false): Promise<Task | undefined> {
|
||||||
if (!(await this.trust())) {
|
if (!(await this.trust())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -750,9 +750,9 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract versionAndEngineCompatible(filter?: TaskFilter): boolean;
|
protected abstract versionAndEngineCompatible(filter?: ITaskFilter): boolean;
|
||||||
|
|
||||||
public async tasks(filter?: TaskFilter): Promise<Task[]> {
|
public async tasks(filter?: ITaskFilter): Promise<Task[]> {
|
||||||
if (!(await this.trust())) {
|
if (!(await this.trust())) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -1056,7 +1056,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async run(task: Task | undefined, options?: ProblemMatcherRunOptions, runSource: TaskRunSource = TaskRunSource.System): Promise<ITaskSummary | undefined> {
|
public async run(task: Task | undefined, options?: IProblemMatcherRunOptions, runSource: TaskRunSource = TaskRunSource.System): Promise<ITaskSummary | undefined> {
|
||||||
if (!(await this.trust())) {
|
if (!(await this.trust())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1111,7 +1111,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
private getTypeForTask(task: Task): string {
|
private getTypeForTask(task: Task): string {
|
||||||
let type: string;
|
let type: string;
|
||||||
if (CustomTask.is(task)) {
|
if (CustomTask.is(task)) {
|
||||||
let configProperties: TaskConfig.ConfigurationProperties = task._source.config.element;
|
let configProperties: TaskConfig.IConfigurationProperties = task._source.config.element;
|
||||||
type = (<any>configProperties).type;
|
type = (<any>configProperties).type;
|
||||||
} else {
|
} else {
|
||||||
type = task.getDefinition()!.type;
|
type = task.getDefinition()!.type;
|
||||||
|
@ -1137,7 +1137,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return !task.hasDefinedMatchers && !!task.configurationProperties.problemMatchers && (task.configurationProperties.problemMatchers.length === 0);
|
return !task.hasDefinedMatchers && !!task.configurationProperties.problemMatchers && (task.configurationProperties.problemMatchers.length === 0);
|
||||||
}
|
}
|
||||||
if (CustomTask.is(task)) {
|
if (CustomTask.is(task)) {
|
||||||
let configProperties: TaskConfig.ConfigurationProperties = task._source.config.element;
|
let configProperties: TaskConfig.IConfigurationProperties = task._source.config.element;
|
||||||
return configProperties.problemMatcher === undefined && !task.hasDefinedMatchers;
|
return configProperties.problemMatcher === undefined && !task.hasDefinedMatchers;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -1159,13 +1159,13 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
}
|
}
|
||||||
|
|
||||||
private attachProblemMatcher(task: ContributedTask | CustomTask): Promise<Task | undefined> {
|
private attachProblemMatcher(task: ContributedTask | CustomTask): Promise<Task | undefined> {
|
||||||
interface ProblemMatcherPickEntry extends IQuickPickItem {
|
interface IProblemMatcherPickEntry extends IQuickPickItem {
|
||||||
matcher: NamedProblemMatcher | undefined;
|
matcher: INamedProblemMatcher | undefined;
|
||||||
never?: boolean;
|
never?: boolean;
|
||||||
learnMore?: boolean;
|
learnMore?: boolean;
|
||||||
setting?: string;
|
setting?: string;
|
||||||
}
|
}
|
||||||
let entries: QuickPickInput<ProblemMatcherPickEntry>[] = [];
|
let entries: QuickPickInput<IProblemMatcherPickEntry>[] = [];
|
||||||
for (let key of ProblemMatcherRegistry.keys()) {
|
for (let key of ProblemMatcherRegistry.keys()) {
|
||||||
let matcher = ProblemMatcherRegistry.get(key);
|
let matcher = ProblemMatcherRegistry.get(key);
|
||||||
if (matcher.deprecated) {
|
if (matcher.deprecated) {
|
||||||
|
@ -1192,7 +1192,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
entries.unshift({ type: 'separator', label: nls.localize('TaskService.associate', 'associate') });
|
entries.unshift({ type: 'separator', label: nls.localize('TaskService.associate', 'associate') });
|
||||||
let taskType: string;
|
let taskType: string;
|
||||||
if (CustomTask.is(task)) {
|
if (CustomTask.is(task)) {
|
||||||
let configProperties: TaskConfig.ConfigurationProperties = task._source.config.element;
|
let configProperties: TaskConfig.IConfigurationProperties = task._source.config.element;
|
||||||
taskType = (<any>configProperties).type;
|
taskType = (<any>configProperties).type;
|
||||||
} else {
|
} else {
|
||||||
taskType = task.getDefinition().type;
|
taskType = task.getDefinition().type;
|
||||||
|
@ -1216,7 +1216,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
} else if (selected.matcher) {
|
} else if (selected.matcher) {
|
||||||
let newTask = task.clone();
|
let newTask = task.clone();
|
||||||
let matcherReference = `$${selected.matcher.name}`;
|
let matcherReference = `$${selected.matcher.name}`;
|
||||||
let properties: CustomizationProperties = { problemMatcher: [matcherReference] };
|
let properties: ICustomizationProperties = { problemMatcher: [matcherReference] };
|
||||||
newTask.configurationProperties.problemMatchers = [matcherReference];
|
newTask.configurationProperties.problemMatchers = [matcherReference];
|
||||||
let matcher = ProblemMatcherRegistry.get(selected.matcher.name);
|
let matcher = ProblemMatcherRegistry.get(selected.matcher.name);
|
||||||
if (matcher && matcher.watching !== undefined) {
|
if (matcher && matcher.watching !== undefined) {
|
||||||
|
@ -1271,7 +1271,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async formatTaskForJson(resource: URI, task: TaskConfig.CustomTask | TaskConfig.ConfiguringTask): Promise<string> {
|
private async formatTaskForJson(resource: URI, task: TaskConfig.ICustomTask | TaskConfig.IConfiguringTask): Promise<string> {
|
||||||
let reference: IReference<IResolvedTextEditorModel> | undefined;
|
let reference: IReference<IResolvedTextEditorModel> | undefined;
|
||||||
let stringValue: string = '';
|
let stringValue: string = '';
|
||||||
try {
|
try {
|
||||||
|
@ -1292,7 +1292,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return stringValue;
|
return stringValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private openEditorAtTask(resource: URI | undefined, task: TaskConfig.CustomTask | TaskConfig.ConfiguringTask | string | undefined, configIndex: number = -1): Promise<boolean> {
|
private openEditorAtTask(resource: URI | undefined, task: TaskConfig.ICustomTask | TaskConfig.IConfiguringTask | string | undefined, configIndex: number = -1): Promise<boolean> {
|
||||||
if (resource === undefined) {
|
if (resource === undefined) {
|
||||||
return Promise.resolve(false);
|
return Promise.resolve(false);
|
||||||
}
|
}
|
||||||
|
@ -1305,7 +1305,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
const contentValue = content.toString();
|
const contentValue = content.toString();
|
||||||
let stringValue: string | undefined;
|
let stringValue: string | undefined;
|
||||||
if (configIndex !== -1) {
|
if (configIndex !== -1) {
|
||||||
const json: TaskConfig.ExternalTaskRunnerConfiguration = this.configurationService.getValue<TaskConfig.ExternalTaskRunnerConfiguration>('tasks', { resource });
|
const json: TaskConfig.IExternalTaskRunnerConfiguration = this.configurationService.getValue<TaskConfig.IExternalTaskRunnerConfiguration>('tasks', { resource });
|
||||||
if (json.tasks && (json.tasks.length > configIndex)) {
|
if (json.tasks && (json.tasks.length > configIndex)) {
|
||||||
stringValue = await this.formatTaskForJson(resource, json.tasks[configIndex]);
|
stringValue = await this.formatTaskForJson(resource, json.tasks[configIndex]);
|
||||||
}
|
}
|
||||||
|
@ -1346,15 +1346,15 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private createCustomizableTask(task: ContributedTask | CustomTask | ConfiguringTask): TaskConfig.CustomTask | TaskConfig.ConfiguringTask | undefined {
|
private createCustomizableTask(task: ContributedTask | CustomTask | ConfiguringTask): TaskConfig.ICustomTask | TaskConfig.IConfiguringTask | undefined {
|
||||||
let toCustomize: TaskConfig.CustomTask | TaskConfig.ConfiguringTask | undefined;
|
let toCustomize: TaskConfig.ICustomTask | TaskConfig.IConfiguringTask | undefined;
|
||||||
let taskConfig = CustomTask.is(task) || ConfiguringTask.is(task) ? task._source.config : undefined;
|
let taskConfig = CustomTask.is(task) || ConfiguringTask.is(task) ? task._source.config : undefined;
|
||||||
if (taskConfig && taskConfig.element) {
|
if (taskConfig && taskConfig.element) {
|
||||||
toCustomize = { ...(taskConfig.element) };
|
toCustomize = { ...(taskConfig.element) };
|
||||||
} else if (ContributedTask.is(task)) {
|
} else if (ContributedTask.is(task)) {
|
||||||
toCustomize = {
|
toCustomize = {
|
||||||
};
|
};
|
||||||
let identifier: TaskConfig.TaskIdentifier = Object.assign(Object.create(null), task.defines);
|
let identifier: TaskConfig.ITaskIdentifier = Object.assign(Object.create(null), task.defines);
|
||||||
delete identifier['_key'];
|
delete identifier['_key'];
|
||||||
Object.keys(identifier).forEach(key => (<any>toCustomize)![key] = identifier[key]);
|
Object.keys(identifier).forEach(key => (<any>toCustomize)![key] = identifier[key]);
|
||||||
if (task.configurationProperties.problemMatchers && task.configurationProperties.problemMatchers.length > 0 && Types.isStringArray(task.configurationProperties.problemMatchers)) {
|
if (task.configurationProperties.problemMatchers && task.configurationProperties.problemMatchers.length > 0 && Types.isStringArray(task.configurationProperties.problemMatchers)) {
|
||||||
|
@ -1379,7 +1379,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return toCustomize;
|
return toCustomize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async customize(task: ContributedTask | CustomTask | ConfiguringTask, properties?: CustomizationProperties, openConfig?: boolean): Promise<void> {
|
public async customize(task: ContributedTask | CustomTask | ConfiguringTask, properties?: ICustomizationProperties, openConfig?: boolean): Promise<void> {
|
||||||
if (!(await this.trust())) {
|
if (!(await this.trust())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1519,13 +1519,13 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
}
|
}
|
||||||
|
|
||||||
private createRunnableTask(tasks: TaskMap, group: TaskGroup): { task: Task; resolver: ITaskResolver } | undefined {
|
private createRunnableTask(tasks: TaskMap, group: TaskGroup): { task: Task; resolver: ITaskResolver } | undefined {
|
||||||
interface ResolverData {
|
interface IResolverData {
|
||||||
id: Map<string, Task>;
|
id: Map<string, Task>;
|
||||||
label: Map<string, Task>;
|
label: Map<string, Task>;
|
||||||
identifier: Map<string, Task>;
|
identifier: Map<string, Task>;
|
||||||
}
|
}
|
||||||
|
|
||||||
let resolverData: Map<string, ResolverData> = new Map();
|
let resolverData: Map<string, IResolverData> = new Map();
|
||||||
let workspaceTasks: Task[] = [];
|
let workspaceTasks: Task[] = [];
|
||||||
let extensionTasks: Task[] = [];
|
let extensionTasks: Task[] = [];
|
||||||
tasks.forEach((tasks, folder) => {
|
tasks.forEach((tasks, folder) => {
|
||||||
|
@ -1603,7 +1603,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
|
|
||||||
let resolverData: Map<string, ResolverData> | undefined;
|
let resolverData: Map<string, ResolverData> | undefined;
|
||||||
|
|
||||||
async function quickResolve(that: AbstractTaskService, uri: URI | string, identifier: string | TaskIdentifier) {
|
async function quickResolve(that: AbstractTaskService, uri: URI | string, identifier: string | ITaskIdentifier) {
|
||||||
const foundTasks = await that._findWorkspaceTasks((task: Task | ConfiguringTask): boolean => {
|
const foundTasks = await that._findWorkspaceTasks((task: Task | ConfiguringTask): boolean => {
|
||||||
const taskUri = ((ConfiguringTask.is(task) || CustomTask.is(task)) ? task._source.config.workspaceFolder?.uri : undefined);
|
const taskUri = ((ConfiguringTask.is(task) || CustomTask.is(task)) ? task._source.config.workspaceFolder?.uri : undefined);
|
||||||
const originalUri = (typeof uri === 'string' ? uri : uri.toString());
|
const originalUri = (typeof uri === 'string' ? uri : uri.toString());
|
||||||
|
@ -1652,7 +1652,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return resolverData;
|
return resolverData;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fullResolve(that: AbstractTaskService, uri: URI | string, identifier: string | TaskIdentifier) {
|
async function fullResolve(that: AbstractTaskService, uri: URI | string, identifier: string | ITaskIdentifier) {
|
||||||
const allResolverData = await getResolverData(that);
|
const allResolverData = await getResolverData(that);
|
||||||
let data = allResolverData.get(typeof uri === 'string' ? uri : uri.toString());
|
let data = allResolverData.get(typeof uri === 'string' ? uri : uri.toString());
|
||||||
if (!data) {
|
if (!data) {
|
||||||
|
@ -1667,7 +1667,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
resolve: async (uri: URI | string, identifier: string | TaskIdentifier | undefined) => {
|
resolve: async (uri: URI | string, identifier: string | ITaskIdentifier | undefined) => {
|
||||||
if (!identifier) {
|
if (!identifier) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -1775,7 +1775,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async terminate(task: Task): Promise<TaskTerminateResponse> {
|
public async terminate(task: Task): Promise<ITaskTerminateResponse> {
|
||||||
if (!(await this.trust())) {
|
if (!(await this.trust())) {
|
||||||
return { success: true, task: undefined };
|
return { success: true, task: undefined };
|
||||||
}
|
}
|
||||||
|
@ -1786,9 +1786,9 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return this._taskSystem.terminate(task);
|
return this._taskSystem.terminate(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
private terminateAll(): Promise<TaskTerminateResponse[]> {
|
private terminateAll(): Promise<ITaskTerminateResponse[]> {
|
||||||
if (!this._taskSystem) {
|
if (!this._taskSystem) {
|
||||||
return Promise.resolve<TaskTerminateResponse[]>([]);
|
return Promise.resolve<ITaskTerminateResponse[]>([]);
|
||||||
}
|
}
|
||||||
return this._taskSystem.terminateAll();
|
return this._taskSystem.terminateAll();
|
||||||
}
|
}
|
||||||
|
@ -1832,10 +1832,10 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
TaskDefinitionRegistry.all().forEach(definition => validTypes[definition.taskType] = true);
|
TaskDefinitionRegistry.all().forEach(definition => validTypes[definition.taskType] = true);
|
||||||
validTypes['shell'] = true;
|
validTypes['shell'] = true;
|
||||||
validTypes['process'] = true;
|
validTypes['process'] = true;
|
||||||
return new Promise<TaskSet[]>(resolve => {
|
return new Promise<ITaskSet[]>(resolve => {
|
||||||
let result: TaskSet[] = [];
|
let result: ITaskSet[] = [];
|
||||||
let counter: number = 0;
|
let counter: number = 0;
|
||||||
let done = (value: TaskSet | undefined) => {
|
let done = (value: ITaskSet | undefined) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
result.push(value);
|
result.push(value);
|
||||||
}
|
}
|
||||||
|
@ -1870,7 +1870,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
}
|
}
|
||||||
foundAnyProviders = true;
|
foundAnyProviders = true;
|
||||||
counter++;
|
counter++;
|
||||||
provider.provideTasks(validTypes).then((taskSet: TaskSet) => {
|
provider.provideTasks(validTypes).then((taskSet: ITaskSet) => {
|
||||||
// Check that the tasks provided are of the correct type
|
// Check that the tasks provided are of the correct type
|
||||||
for (const task of taskSet.tasks) {
|
for (const task of taskSet.tasks) {
|
||||||
if (task.type !== this._providerTypes.get(handle)) {
|
if (task.type !== this._providerTypes.get(handle)) {
|
||||||
|
@ -2043,7 +2043,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private getLegacyTaskConfigurations(workspaceTasks: TaskSet): IStringDictionary<CustomTask> | undefined {
|
private getLegacyTaskConfigurations(workspaceTasks: ITaskSet): IStringDictionary<CustomTask> | undefined {
|
||||||
let result: IStringDictionary<CustomTask> | undefined;
|
let result: IStringDictionary<CustomTask> | undefined;
|
||||||
function getResult(): IStringDictionary<CustomTask> {
|
function getResult(): IStringDictionary<CustomTask> {
|
||||||
if (result) {
|
if (result) {
|
||||||
|
@ -2058,7 +2058,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
// This is for backwards compatibility with the 0.1.0 task annotation code
|
// This is for backwards compatibility with the 0.1.0 task annotation code
|
||||||
// if we had a gulp, jake or grunt command a task specification was a annotation
|
// if we had a gulp, jake or grunt command a task specification was a annotation
|
||||||
if (commandName === 'gulp' || commandName === 'grunt' || commandName === 'jake') {
|
if (commandName === 'gulp' || commandName === 'grunt' || commandName === 'jake') {
|
||||||
let identifier = NKeyedTaskIdentifier.create({
|
let identifier = KeyedTaskIdentifier.create({
|
||||||
type: commandName,
|
type: commandName,
|
||||||
task: task.configurationProperties.name
|
task: task.configurationProperties.name
|
||||||
});
|
});
|
||||||
|
@ -2069,7 +2069,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getWorkspaceTasks(runSource: TaskRunSource = TaskRunSource.User): Promise<Map<string, WorkspaceFolderTaskResult>> {
|
public async getWorkspaceTasks(runSource: TaskRunSource = TaskRunSource.User): Promise<Map<string, IWorkspaceFolderTaskResult>> {
|
||||||
if (!(await this.trust())) {
|
if (!(await this.trust())) {
|
||||||
return new Map();
|
return new Map();
|
||||||
}
|
}
|
||||||
|
@ -2080,7 +2080,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return this.updateWorkspaceTasks(runSource);
|
return this.updateWorkspaceTasks(runSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateWorkspaceTasks(runSource: TaskRunSource = TaskRunSource.User): Promise<Map<string, WorkspaceFolderTaskResult>> {
|
private updateWorkspaceTasks(runSource: TaskRunSource = TaskRunSource.User): Promise<Map<string, IWorkspaceFolderTaskResult>> {
|
||||||
this._workspaceTasksPromise = this.computeWorkspaceTasks(runSource);
|
this._workspaceTasksPromise = this.computeWorkspaceTasks(runSource);
|
||||||
return this._workspaceTasksPromise;
|
return this._workspaceTasksPromise;
|
||||||
}
|
}
|
||||||
|
@ -2094,13 +2094,13 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return folder;
|
return folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected computeWorkspaceTasks(runSource: TaskRunSource = TaskRunSource.User): Promise<Map<string, WorkspaceFolderTaskResult>> {
|
protected computeWorkspaceTasks(runSource: TaskRunSource = TaskRunSource.User): Promise<Map<string, IWorkspaceFolderTaskResult>> {
|
||||||
let promises: Promise<WorkspaceFolderTaskResult | undefined>[] = [];
|
let promises: Promise<IWorkspaceFolderTaskResult | undefined>[] = [];
|
||||||
for (let folder of this.workspaceFolders) {
|
for (let folder of this.workspaceFolders) {
|
||||||
promises.push(this.computeWorkspaceFolderTasks(folder, runSource).then((value) => value, () => undefined));
|
promises.push(this.computeWorkspaceFolderTasks(folder, runSource).then((value) => value, () => undefined));
|
||||||
}
|
}
|
||||||
return Promise.all(promises).then(async (values) => {
|
return Promise.all(promises).then(async (values) => {
|
||||||
let result = new Map<string, WorkspaceFolderTaskResult>();
|
let result = new Map<string, IWorkspaceFolderTaskResult>();
|
||||||
for (let value of values) {
|
for (let value of values) {
|
||||||
if (value) {
|
if (value) {
|
||||||
result.set(value.workspaceFolder.uri.toString(), value);
|
result.set(value.workspaceFolder.uri.toString(), value);
|
||||||
|
@ -2127,7 +2127,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return !!ShellExecutionSupportedContext.getValue(this.contextKeyService) && !!ProcessExecutionSupportedContext.getValue(this.contextKeyService);
|
return !!ShellExecutionSupportedContext.getValue(this.contextKeyService) && !!ProcessExecutionSupportedContext.getValue(this.contextKeyService);
|
||||||
}
|
}
|
||||||
|
|
||||||
private computeWorkspaceFolderTasks(workspaceFolder: IWorkspaceFolder, runSource: TaskRunSource = TaskRunSource.User): Promise<WorkspaceFolderTaskResult> {
|
private computeWorkspaceFolderTasks(workspaceFolder: IWorkspaceFolder, runSource: TaskRunSource = TaskRunSource.User): Promise<IWorkspaceFolderTaskResult> {
|
||||||
return (this.executionEngine === ExecutionEngine.Process
|
return (this.executionEngine === ExecutionEngine.Process
|
||||||
? this.computeLegacyConfiguration(workspaceFolder)
|
? this.computeLegacyConfiguration(workspaceFolder)
|
||||||
: this.computeConfiguration(workspaceFolder)).
|
: this.computeConfiguration(workspaceFolder)).
|
||||||
|
@ -2135,8 +2135,8 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
if (!workspaceFolderConfiguration || !workspaceFolderConfiguration.config || workspaceFolderConfiguration.hasErrors) {
|
if (!workspaceFolderConfiguration || !workspaceFolderConfiguration.config || workspaceFolderConfiguration.hasErrors) {
|
||||||
return Promise.resolve({ workspaceFolder, set: undefined, configurations: undefined, hasErrors: workspaceFolderConfiguration ? workspaceFolderConfiguration.hasErrors : false });
|
return Promise.resolve({ workspaceFolder, set: undefined, configurations: undefined, hasErrors: workspaceFolderConfiguration ? workspaceFolderConfiguration.hasErrors : false });
|
||||||
}
|
}
|
||||||
return ProblemMatcherRegistry.onReady().then(async (): Promise<WorkspaceFolderTaskResult> => {
|
return ProblemMatcherRegistry.onReady().then(async (): Promise<IWorkspaceFolderTaskResult> => {
|
||||||
let taskSystemInfo: TaskSystemInfo | undefined = this.getTaskSystemInfo(workspaceFolder.uri.scheme);
|
let taskSystemInfo: ITaskSystemInfo | undefined = this.getTaskSystemInfo(workspaceFolder.uri.scheme);
|
||||||
let problemReporter = new ProblemReporter(this._outputChannel);
|
let problemReporter = new ProblemReporter(this._outputChannel);
|
||||||
let parseResult = TaskConfig.parse(workspaceFolder, undefined, taskSystemInfo ? taskSystemInfo.platform : Platform.platform, workspaceFolderConfiguration.config!, problemReporter, TaskConfig.TaskConfigSource.TasksJson, this.contextKeyService);
|
let parseResult = TaskConfig.parse(workspaceFolder, undefined, taskSystemInfo ? taskSystemInfo.platform : Platform.platform, workspaceFolderConfiguration.config!, problemReporter, TaskConfig.TaskConfigSource.TasksJson, this.contextKeyService);
|
||||||
let hasErrors = false;
|
let hasErrors = false;
|
||||||
|
@ -2165,7 +2165,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private testParseExternalConfig(config: TaskConfig.ExternalTaskRunnerConfiguration | undefined, location: string): { config: TaskConfig.ExternalTaskRunnerConfiguration | undefined; hasParseErrors: boolean } {
|
private testParseExternalConfig(config: TaskConfig.IExternalTaskRunnerConfiguration | undefined, location: string): { config: TaskConfig.IExternalTaskRunnerConfiguration | undefined; hasParseErrors: boolean } {
|
||||||
if (!config) {
|
if (!config) {
|
||||||
return { config: undefined, hasParseErrors: false };
|
return { config: undefined, hasParseErrors: false };
|
||||||
}
|
}
|
||||||
|
@ -2187,7 +2187,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return { config, hasParseErrors: false };
|
return { config, hasParseErrors: false };
|
||||||
}
|
}
|
||||||
|
|
||||||
private async computeWorkspaceFileTasks(workspaceFolder: IWorkspaceFolder, runSource: TaskRunSource = TaskRunSource.User): Promise<WorkspaceFolderTaskResult> {
|
private async computeWorkspaceFileTasks(workspaceFolder: IWorkspaceFolder, runSource: TaskRunSource = TaskRunSource.User): Promise<IWorkspaceFolderTaskResult> {
|
||||||
if (this.executionEngine === ExecutionEngine.Process) {
|
if (this.executionEngine === ExecutionEngine.Process) {
|
||||||
return this.emptyWorkspaceTaskResults(workspaceFolder);
|
return this.emptyWorkspaceTaskResults(workspaceFolder);
|
||||||
}
|
}
|
||||||
|
@ -2207,7 +2207,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return { workspaceFolder, set: { tasks: custom }, configurations: customizedTasks, hasErrors: configuration.hasParseErrors };
|
return { workspaceFolder, set: { tasks: custom }, configurations: customizedTasks, hasErrors: configuration.hasParseErrors };
|
||||||
}
|
}
|
||||||
|
|
||||||
private async computeUserTasks(workspaceFolder: IWorkspaceFolder, runSource: TaskRunSource = TaskRunSource.User): Promise<WorkspaceFolderTaskResult> {
|
private async computeUserTasks(workspaceFolder: IWorkspaceFolder, runSource: TaskRunSource = TaskRunSource.User): Promise<IWorkspaceFolderTaskResult> {
|
||||||
if (this.executionEngine === ExecutionEngine.Process) {
|
if (this.executionEngine === ExecutionEngine.Process) {
|
||||||
return this.emptyWorkspaceTaskResults(workspaceFolder);
|
return this.emptyWorkspaceTaskResults(workspaceFolder);
|
||||||
}
|
}
|
||||||
|
@ -2227,15 +2227,15 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return { workspaceFolder, set: { tasks: custom }, configurations: customizedTasks, hasErrors: configuration.hasParseErrors };
|
return { workspaceFolder, set: { tasks: custom }, configurations: customizedTasks, hasErrors: configuration.hasParseErrors };
|
||||||
}
|
}
|
||||||
|
|
||||||
private emptyWorkspaceTaskResults(workspaceFolder: IWorkspaceFolder): WorkspaceFolderTaskResult {
|
private emptyWorkspaceTaskResults(workspaceFolder: IWorkspaceFolder): IWorkspaceFolderTaskResult {
|
||||||
return { workspaceFolder, set: undefined, configurations: undefined, hasErrors: false };
|
return { workspaceFolder, set: undefined, configurations: undefined, hasErrors: false };
|
||||||
}
|
}
|
||||||
|
|
||||||
private async computeTasksForSingleConfig(workspaceFolder: IWorkspaceFolder, config: TaskConfig.ExternalTaskRunnerConfiguration | undefined, runSource: TaskRunSource, custom: CustomTask[], customized: IStringDictionary<ConfiguringTask>, source: TaskConfig.TaskConfigSource, isRecentTask: boolean = false): Promise<boolean> {
|
private async computeTasksForSingleConfig(workspaceFolder: IWorkspaceFolder, config: TaskConfig.IExternalTaskRunnerConfiguration | undefined, runSource: TaskRunSource, custom: CustomTask[], customized: IStringDictionary<ConfiguringTask>, source: TaskConfig.TaskConfigSource, isRecentTask: boolean = false): Promise<boolean> {
|
||||||
if (!config) {
|
if (!config) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let taskSystemInfo: TaskSystemInfo | undefined = workspaceFolder ? this.getTaskSystemInfo(workspaceFolder.uri.scheme) : undefined;
|
let taskSystemInfo: ITaskSystemInfo | undefined = workspaceFolder ? this.getTaskSystemInfo(workspaceFolder.uri.scheme) : undefined;
|
||||||
let problemReporter = new ProblemReporter(this._outputChannel);
|
let problemReporter = new ProblemReporter(this._outputChannel);
|
||||||
let parseResult = TaskConfig.parse(workspaceFolder, this._workspace, taskSystemInfo ? taskSystemInfo.platform : Platform.platform, config, problemReporter, source, this.contextKeyService, isRecentTask);
|
let parseResult = TaskConfig.parse(workspaceFolder, this._workspace, taskSystemInfo ? taskSystemInfo.platform : Platform.platform, config, problemReporter, source, this.contextKeyService, isRecentTask);
|
||||||
let hasErrors = false;
|
let hasErrors = false;
|
||||||
|
@ -2262,12 +2262,12 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return hasErrors;
|
return hasErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
private computeConfiguration(workspaceFolder: IWorkspaceFolder): Promise<WorkspaceFolderConfigurationResult> {
|
private computeConfiguration(workspaceFolder: IWorkspaceFolder): Promise<IWorkspaceFolderConfigurationResult> {
|
||||||
let { config, hasParseErrors } = this.getConfiguration(workspaceFolder);
|
let { config, hasParseErrors } = this.getConfiguration(workspaceFolder);
|
||||||
return Promise.resolve<WorkspaceFolderConfigurationResult>({ workspaceFolder, config, hasErrors: hasParseErrors });
|
return Promise.resolve<IWorkspaceFolderConfigurationResult>({ workspaceFolder, config, hasErrors: hasParseErrors });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract computeLegacyConfiguration(workspaceFolder: IWorkspaceFolder): Promise<WorkspaceFolderConfigurationResult>;
|
protected abstract computeLegacyConfiguration(workspaceFolder: IWorkspaceFolder): Promise<IWorkspaceFolderConfigurationResult>;
|
||||||
|
|
||||||
private computeWorkspaceFolderSetup(): [IWorkspaceFolder[], IWorkspaceFolder[], ExecutionEngine, JsonSchemaVersion, IWorkspace | undefined] {
|
private computeWorkspaceFolderSetup(): [IWorkspaceFolder[], IWorkspaceFolder[], ExecutionEngine, JsonSchemaVersion, IWorkspace | undefined] {
|
||||||
let workspaceFolders: IWorkspaceFolder[] = [];
|
let workspaceFolders: IWorkspaceFolder[] = [];
|
||||||
|
@ -2324,12 +2324,12 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return TaskConfig.JsonSchemaVersion.from(config);
|
return TaskConfig.JsonSchemaVersion.from(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getConfiguration(workspaceFolder: IWorkspaceFolder, source?: string): { config: TaskConfig.ExternalTaskRunnerConfiguration | undefined; hasParseErrors: boolean } {
|
protected getConfiguration(workspaceFolder: IWorkspaceFolder, source?: string): { config: TaskConfig.IExternalTaskRunnerConfiguration | undefined; hasParseErrors: boolean } {
|
||||||
let result;
|
let result;
|
||||||
if ((source !== TaskSourceKind.User) && (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY)) {
|
if ((source !== TaskSourceKind.User) && (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY)) {
|
||||||
result = undefined;
|
result = undefined;
|
||||||
} else {
|
} else {
|
||||||
const wholeConfig = this.configurationService.inspect<TaskConfig.ExternalTaskRunnerConfiguration>('tasks', { resource: workspaceFolder.uri });
|
const wholeConfig = this.configurationService.inspect<TaskConfig.IExternalTaskRunnerConfiguration>('tasks', { resource: workspaceFolder.uri });
|
||||||
switch (source) {
|
switch (source) {
|
||||||
case TaskSourceKind.User: {
|
case TaskSourceKind.User: {
|
||||||
if (wholeConfig.userValue !== wholeConfig.workspaceFolderValue) {
|
if (wholeConfig.userValue !== wholeConfig.workspaceFolderValue) {
|
||||||
|
@ -2427,12 +2427,12 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return this.configurationService.getValue<boolean>(QUICKOPEN_DETAIL_CONFIG);
|
return this.configurationService.getValue<boolean>(QUICKOPEN_DETAIL_CONFIG);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async createTaskQuickPickEntries(tasks: Task[], group: boolean = false, sort: boolean = false, selectedEntry?: TaskQuickPickEntry, includeRecents: boolean = true): Promise<TaskQuickPickEntry[]> {
|
private async createTaskQuickPickEntries(tasks: Task[], group: boolean = false, sort: boolean = false, selectedEntry?: ITaskQuickPickEntry, includeRecents: boolean = true): Promise<ITaskQuickPickEntry[]> {
|
||||||
let encounteredTasks: { [key: string]: TaskQuickPickEntry[] } = {};
|
let encounteredTasks: { [key: string]: ITaskQuickPickEntry[] } = {};
|
||||||
if (tasks === undefined || tasks === null || tasks.length === 0) {
|
if (tasks === undefined || tasks === null || tasks.length === 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const TaskQuickPickEntry = (task: Task): TaskQuickPickEntry => {
|
const TaskQuickPickEntry = (task: Task): ITaskQuickPickEntry => {
|
||||||
const newEntry = { label: task._label, description: this.getTaskDescription(task), task, detail: this.showDetail() ? task.configurationProperties.detail : undefined };
|
const newEntry = { label: task._label, description: this.getTaskDescription(task), task, detail: this.showDetail() ? task.configurationProperties.detail : undefined };
|
||||||
if (encounteredTasks[task._id]) {
|
if (encounteredTasks[task._id]) {
|
||||||
if (encounteredTasks[task._id].length === 1) {
|
if (encounteredTasks[task._id].length === 1) {
|
||||||
|
@ -2446,12 +2446,12 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return newEntry;
|
return newEntry;
|
||||||
|
|
||||||
};
|
};
|
||||||
function fillEntries(entries: QuickPickInput<TaskQuickPickEntry>[], tasks: Task[], groupLabel: string): void {
|
function fillEntries(entries: QuickPickInput<ITaskQuickPickEntry>[], tasks: Task[], groupLabel: string): void {
|
||||||
if (tasks.length) {
|
if (tasks.length) {
|
||||||
entries.push({ type: 'separator', label: groupLabel });
|
entries.push({ type: 'separator', label: groupLabel });
|
||||||
}
|
}
|
||||||
for (let task of tasks) {
|
for (let task of tasks) {
|
||||||
let entry: TaskQuickPickEntry = TaskQuickPickEntry(task);
|
let entry: ITaskQuickPickEntry = TaskQuickPickEntry(task);
|
||||||
entry.buttons = [{ iconClass: ThemeIcon.asClassName(configureTaskIcon), tooltip: nls.localize('configureTask', "Configure Task") }];
|
entry.buttons = [{ iconClass: ThemeIcon.asClassName(configureTaskIcon), tooltip: nls.localize('configureTask', "Configure Task") }];
|
||||||
if (selectedEntry && (task === selectedEntry.task)) {
|
if (selectedEntry && (task === selectedEntry.task)) {
|
||||||
entries.unshift(selectedEntry);
|
entries.unshift(selectedEntry);
|
||||||
|
@ -2460,7 +2460,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let entries: TaskQuickPickEntry[];
|
let entries: ITaskQuickPickEntry[];
|
||||||
if (group) {
|
if (group) {
|
||||||
entries = [];
|
entries = [];
|
||||||
if (tasks.length === 1) {
|
if (tasks.length === 1) {
|
||||||
|
@ -2512,20 +2512,20 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
const sorter = this.createSorter();
|
const sorter = this.createSorter();
|
||||||
tasks = tasks.sort((a, b) => sorter.compare(a, b));
|
tasks = tasks.sort((a, b) => sorter.compare(a, b));
|
||||||
}
|
}
|
||||||
entries = tasks.map<TaskQuickPickEntry>(task => TaskQuickPickEntry(task));
|
entries = tasks.map<ITaskQuickPickEntry>(task => TaskQuickPickEntry(task));
|
||||||
}
|
}
|
||||||
encounteredTasks = {};
|
encounteredTasks = {};
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async showTwoLevelQuickPick(placeHolder: string, defaultEntry?: TaskQuickPickEntry) {
|
private async showTwoLevelQuickPick(placeHolder: string, defaultEntry?: ITaskQuickPickEntry) {
|
||||||
return TaskQuickPick.show(this, this.configurationService, this.quickInputService, this.notificationService, this.dialogService, placeHolder, defaultEntry);
|
return TaskQuickPick.show(this, this.configurationService, this.quickInputService, this.notificationService, this.dialogService, placeHolder, defaultEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async showQuickPick(tasks: Promise<Task[]> | Task[], placeHolder: string, defaultEntry?: TaskQuickPickEntry, group: boolean = false, sort: boolean = false, selectedEntry?: TaskQuickPickEntry, additionalEntries?: TaskQuickPickEntry[]): Promise<TaskQuickPickEntry | undefined | null> {
|
private async showQuickPick(tasks: Promise<Task[]> | Task[], placeHolder: string, defaultEntry?: ITaskQuickPickEntry, group: boolean = false, sort: boolean = false, selectedEntry?: ITaskQuickPickEntry, additionalEntries?: ITaskQuickPickEntry[]): Promise<ITaskQuickPickEntry | undefined | null> {
|
||||||
const tokenSource = new CancellationTokenSource();
|
const tokenSource = new CancellationTokenSource();
|
||||||
const cancellationToken: CancellationToken = tokenSource.token;
|
const cancellationToken: CancellationToken = tokenSource.token;
|
||||||
let _createEntries = new Promise<QuickPickInput<TaskQuickPickEntry>[]>((resolve) => {
|
let _createEntries = new Promise<QuickPickInput<ITaskQuickPickEntry>[]>((resolve) => {
|
||||||
if (Array.isArray(tasks)) {
|
if (Array.isArray(tasks)) {
|
||||||
resolve(this.createTaskQuickPickEntries(tasks, group, sort, selectedEntry));
|
resolve(this.createTaskQuickPickEntries(tasks, group, sort, selectedEntry));
|
||||||
} else {
|
} else {
|
||||||
|
@ -2543,7 +2543,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
})]);
|
})]);
|
||||||
|
|
||||||
if (!timeout && ((await _createEntries).length === 1) && this.configurationService.getValue<boolean>(QUICKOPEN_SKIP_CONFIG)) {
|
if (!timeout && ((await _createEntries).length === 1) && this.configurationService.getValue<boolean>(QUICKOPEN_SKIP_CONFIG)) {
|
||||||
return (<TaskQuickPickEntry>(await _createEntries)[0]);
|
return (<ITaskQuickPickEntry>(await _createEntries)[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const pickEntries = _createEntries.then((entries) => {
|
const pickEntries = _createEntries.then((entries) => {
|
||||||
|
@ -2558,7 +2558,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return entries;
|
return entries;
|
||||||
});
|
});
|
||||||
|
|
||||||
const picker: IQuickPick<TaskQuickPickEntry> = this.quickInputService.createQuickPick();
|
const picker: IQuickPick<ITaskQuickPickEntry> = this.quickInputService.createQuickPick();
|
||||||
picker.placeholder = placeHolder;
|
picker.placeholder = placeHolder;
|
||||||
picker.matchOnDescription = true;
|
picker.matchOnDescription = true;
|
||||||
|
|
||||||
|
@ -2578,14 +2578,14 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
});
|
});
|
||||||
picker.show();
|
picker.show();
|
||||||
|
|
||||||
return new Promise<TaskQuickPickEntry | undefined | null>(resolve => {
|
return new Promise<ITaskQuickPickEntry | undefined | null>(resolve => {
|
||||||
this._register(picker.onDidAccept(async () => {
|
this._register(picker.onDidAccept(async () => {
|
||||||
let selection = picker.selectedItems ? picker.selectedItems[0] : undefined;
|
let selection = picker.selectedItems ? picker.selectedItems[0] : undefined;
|
||||||
if (cancellationToken.isCancellationRequested) {
|
if (cancellationToken.isCancellationRequested) {
|
||||||
// canceled when there's only one task
|
// canceled when there's only one task
|
||||||
const task = (await pickEntries)[0];
|
const task = (await pickEntries)[0];
|
||||||
if ((<any>task).task) {
|
if ((<any>task).task) {
|
||||||
selection = <TaskQuickPickEntry>task;
|
selection = <ITaskQuickPickEntry>task;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
picker.dispose();
|
picker.dispose();
|
||||||
|
@ -2682,7 +2682,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private tasksAndGroupedTasks(filter?: TaskFilter): { tasks: Promise<Task[]>; grouped: Promise<TaskMap> } {
|
private tasksAndGroupedTasks(filter?: ITaskFilter): { tasks: Promise<Task[]>; grouped: Promise<TaskMap> } {
|
||||||
if (!this.versionAndEngineCompatible(filter)) {
|
if (!this.versionAndEngineCompatible(filter)) {
|
||||||
return { tasks: Promise.resolve<Task[]>([]), grouped: Promise.resolve(new TaskMap()) };
|
return { tasks: Promise.resolve<Task[]>([]), grouped: Promise.resolve(new TaskMap()) };
|
||||||
}
|
}
|
||||||
|
@ -2816,7 +2816,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
|
|
||||||
let taskGroupTasks: (Task | ConfiguringTask)[] = [];
|
let taskGroupTasks: (Task | ConfiguringTask)[] = [];
|
||||||
|
|
||||||
async function runSingleTask(task: Task | undefined, problemMatcherOptions: ProblemMatcherRunOptions | undefined, that: AbstractTaskService) {
|
async function runSingleTask(task: Task | undefined, problemMatcherOptions: IProblemMatcherRunOptions | undefined, that: AbstractTaskService) {
|
||||||
that.run(task, problemMatcherOptions, TaskRunSource.User).then(undefined, reason => {
|
that.run(task, problemMatcherOptions, TaskRunSource.User).then(undefined, reason => {
|
||||||
// eat the error, it has already been surfaced to the user and we don't care about it here
|
// eat the error, it has already been surfaced to the user and we don't care about it here
|
||||||
});
|
});
|
||||||
|
@ -3056,13 +3056,13 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
let result: string | KeyedTaskIdentifier | undefined = undefined;
|
let result: string | KeyedTaskIdentifier | undefined = undefined;
|
||||||
if (Types.isString(arg)) {
|
if (Types.isString(arg)) {
|
||||||
result = arg;
|
result = arg;
|
||||||
} else if (arg && Types.isString((arg as TaskIdentifier).type)) {
|
} else if (arg && Types.isString((arg as ITaskIdentifier).type)) {
|
||||||
result = TaskDefinition.createTaskIdentifier(arg as TaskIdentifier, console);
|
result = TaskDefinition.createTaskIdentifier(arg as ITaskIdentifier, console);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private configHasTasks(taskConfig?: TaskConfig.ExternalTaskRunnerConfiguration): boolean {
|
private configHasTasks(taskConfig?: TaskConfig.IExternalTaskRunnerConfiguration): boolean {
|
||||||
return !!taskConfig && !!taskConfig.tasks && taskConfig.tasks.length > 0;
|
return !!taskConfig && !!taskConfig.tasks && taskConfig.tasks.length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3070,7 +3070,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
let configFileCreated = false;
|
let configFileCreated = false;
|
||||||
this.fileService.stat(resource).then((stat) => stat, () => undefined).then(async (stat) => {
|
this.fileService.stat(resource).then((stat) => stat, () => undefined).then(async (stat) => {
|
||||||
const fileExists: boolean = !!stat;
|
const fileExists: boolean = !!stat;
|
||||||
const configValue = this.configurationService.inspect<TaskConfig.ExternalTaskRunnerConfiguration>('tasks');
|
const configValue = this.configurationService.inspect<TaskConfig.IExternalTaskRunnerConfiguration>('tasks');
|
||||||
let tasksExistInFile: boolean;
|
let tasksExistInFile: boolean;
|
||||||
let target: ConfigurationTarget;
|
let target: ConfigurationTarget;
|
||||||
switch (taskSource) {
|
switch (taskSource) {
|
||||||
|
@ -3270,7 +3270,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let selectedTask: Task | undefined;
|
let selectedTask: Task | undefined;
|
||||||
let selectedEntry: TaskQuickPickEntry;
|
let selectedEntry: ITaskQuickPickEntry;
|
||||||
for (let task of tasks) {
|
for (let task of tasks) {
|
||||||
let taskGroup: TaskGroup | undefined = TaskGroup.from(task.configurationProperties.group);
|
let taskGroup: TaskGroup | undefined = TaskGroup.from(task.configurationProperties.group);
|
||||||
if (taskGroup && taskGroup.isDefault && taskGroup._id === TaskGroup.Build._id) {
|
if (taskGroup && taskGroup.isDefault && taskGroup._id === TaskGroup.Build._id) {
|
||||||
|
@ -3322,7 +3322,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let selectedTask: Task | undefined;
|
let selectedTask: Task | undefined;
|
||||||
let selectedEntry: TaskQuickPickEntry;
|
let selectedEntry: ITaskQuickPickEntry;
|
||||||
|
|
||||||
for (let task of tasks) {
|
for (let task of tasks) {
|
||||||
let taskGroup: TaskGroup | undefined = TaskGroup.from(task.configurationProperties.group);
|
let taskGroup: TaskGroup | undefined = TaskGroup.from(task.configurationProperties.group);
|
||||||
|
@ -3412,7 +3412,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
private upgradeTask(task: Task, suppressTaskName: boolean, globalConfig: { windows?: CommandUpgrade; osx?: CommandUpgrade; linux?: CommandUpgrade }): TaskConfig.CustomTask | TaskConfig.ConfiguringTask | undefined {
|
private upgradeTask(task: Task, suppressTaskName: boolean, globalConfig: { windows?: ICommandUpgrade; osx?: ICommandUpgrade; linux?: ICommandUpgrade }): TaskConfig.ICustomTask | TaskConfig.IConfiguringTask | undefined {
|
||||||
if (!CustomTask.is(task)) {
|
if (!CustomTask.is(task)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3488,12 +3488,12 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const configTasks: (TaskConfig.CustomTask | TaskConfig.ConfiguringTask)[] = [];
|
const configTasks: (TaskConfig.ICustomTask | TaskConfig.IConfiguringTask)[] = [];
|
||||||
const suppressTaskName = !!this.configurationService.getValue('tasks.suppressTaskName', { resource: folder.uri });
|
const suppressTaskName = !!this.configurationService.getValue('tasks.suppressTaskName', { resource: folder.uri });
|
||||||
const globalConfig = {
|
const globalConfig = {
|
||||||
windows: <CommandUpgrade>this.configurationService.getValue('tasks.windows', { resource: folder.uri }),
|
windows: <ICommandUpgrade>this.configurationService.getValue('tasks.windows', { resource: folder.uri }),
|
||||||
osx: <CommandUpgrade>this.configurationService.getValue('tasks.osx', { resource: folder.uri }),
|
osx: <ICommandUpgrade>this.configurationService.getValue('tasks.osx', { resource: folder.uri }),
|
||||||
linux: <CommandUpgrade>this.configurationService.getValue('tasks.linux', { resource: folder.uri })
|
linux: <ICommandUpgrade>this.configurationService.getValue('tasks.linux', { resource: folder.uri })
|
||||||
};
|
};
|
||||||
tasks.get(folder).forEach(task => {
|
tasks.get(folder).forEach(task => {
|
||||||
const configTask = this.upgradeTask(task, suppressTaskName, globalConfig);
|
const configTask = this.upgradeTask(task, suppressTaskName, globalConfig);
|
||||||
|
|
|
@ -7,9 +7,9 @@ import * as nls from 'vs/nls';
|
||||||
import * as resources from 'vs/base/common/resources';
|
import * as resources from 'vs/base/common/resources';
|
||||||
import { Disposable } from 'vs/base/common/lifecycle';
|
import { Disposable } from 'vs/base/common/lifecycle';
|
||||||
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||||
import { ITaskService, WorkspaceFolderTaskResult } from 'vs/workbench/contrib/tasks/common/taskService';
|
import { ITaskService, IWorkspaceFolderTaskResult } from 'vs/workbench/contrib/tasks/common/taskService';
|
||||||
import { forEach } from 'vs/base/common/collections';
|
import { forEach } from 'vs/base/common/collections';
|
||||||
import { RunOnOptions, Task, TaskRunSource, TaskSource, TaskSourceKind, TASKS_CATEGORY, WorkspaceFileTaskSource, WorkspaceTaskSource } from 'vs/workbench/contrib/tasks/common/tasks';
|
import { RunOnOptions, Task, TaskRunSource, TaskSource, TaskSourceKind, TASKS_CATEGORY, WorkspaceFileTaskSource, IWorkspaceTaskSource } from 'vs/workbench/contrib/tasks/common/tasks';
|
||||||
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
|
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
|
||||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||||
import { IQuickPickItem, IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
|
import { IQuickPickItem, IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
|
||||||
|
@ -77,7 +77,7 @@ export class RunAutomaticTasks extends Disposable implements IWorkbenchContribut
|
||||||
const taskKind = TaskSourceKind.toConfigurationTarget(source.kind);
|
const taskKind = TaskSourceKind.toConfigurationTarget(source.kind);
|
||||||
switch (taskKind) {
|
switch (taskKind) {
|
||||||
case ConfigurationTarget.WORKSPACE_FOLDER: {
|
case ConfigurationTarget.WORKSPACE_FOLDER: {
|
||||||
return resources.joinPath((<WorkspaceTaskSource>source).config.workspaceFolder!.uri, (<WorkspaceTaskSource>source).config.file);
|
return resources.joinPath((<IWorkspaceTaskSource>source).config.workspaceFolder!.uri, (<IWorkspaceTaskSource>source).config.file);
|
||||||
}
|
}
|
||||||
case ConfigurationTarget.WORKSPACE: {
|
case ConfigurationTarget.WORKSPACE: {
|
||||||
return (<WorkspaceFileTaskSource>source).config.workspace?.configuration ?? undefined;
|
return (<WorkspaceFileTaskSource>source).config.workspace?.configuration ?? undefined;
|
||||||
|
@ -86,7 +86,7 @@ export class RunAutomaticTasks extends Disposable implements IWorkbenchContribut
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static findAutoTasks(taskService: ITaskService, workspaceTaskResult: Map<string, WorkspaceFolderTaskResult>): { tasks: Array<Task | Promise<Task | undefined>>; taskNames: Array<string>; locations: Map<string, URI> } {
|
private static findAutoTasks(taskService: ITaskService, workspaceTaskResult: Map<string, IWorkspaceFolderTaskResult>): { tasks: Array<Task | Promise<Task | undefined>>; taskNames: Array<string>; locations: Map<string, URI> } {
|
||||||
const tasks = new Array<Task | Promise<Task | undefined>>();
|
const tasks = new Array<Task | Promise<Task | undefined>>();
|
||||||
const taskNames = new Array<string>();
|
const taskNames = new Array<string>();
|
||||||
const locations = new Map<string, URI>();
|
const locations = new Map<string, URI>();
|
||||||
|
@ -129,7 +129,7 @@ export class RunAutomaticTasks extends Disposable implements IWorkbenchContribut
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async promptForPermission(taskService: ITaskService, storageService: IStorageService, notificationService: INotificationService, workspaceTrustManagementService: IWorkspaceTrustManagementService,
|
public static async promptForPermission(taskService: ITaskService, storageService: IStorageService, notificationService: INotificationService, workspaceTrustManagementService: IWorkspaceTrustManagementService,
|
||||||
openerService: IOpenerService, workspaceTaskResult: Map<string, WorkspaceFolderTaskResult>) {
|
openerService: IOpenerService, workspaceTaskResult: Map<string, IWorkspaceFolderTaskResult>) {
|
||||||
const isWorkspaceTrusted = workspaceTrustManagementService.isWorkspaceTrusted;
|
const isWorkspaceTrusted = workspaceTrustManagementService.isWorkspaceTrusted;
|
||||||
if (!isWorkspaceTrusted) {
|
if (!isWorkspaceTrusted) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -20,7 +20,7 @@ import { StatusbarAlignment, IStatusbarService, IStatusbarEntryAccessor, IStatus
|
||||||
|
|
||||||
import { IOutputChannelRegistry, Extensions as OutputExt } from 'vs/workbench/services/output/common/output';
|
import { IOutputChannelRegistry, Extensions as OutputExt } from 'vs/workbench/services/output/common/output';
|
||||||
|
|
||||||
import { TaskEvent, TaskEventKind, TaskGroup, TASKS_CATEGORY, TASK_RUNNING_STATE } from 'vs/workbench/contrib/tasks/common/tasks';
|
import { ITaskEvent, TaskEventKind, TaskGroup, TASKS_CATEGORY, TASK_RUNNING_STATE } from 'vs/workbench/contrib/tasks/common/tasks';
|
||||||
import { ITaskService, ProcessExecutionSupportedContext, ShellExecutionSupportedContext } from 'vs/workbench/contrib/tasks/common/taskService';
|
import { ITaskService, ProcessExecutionSupportedContext, ShellExecutionSupportedContext } from 'vs/workbench/contrib/tasks/common/taskService';
|
||||||
|
|
||||||
import { Extensions as WorkbenchExtensions, IWorkbenchContributionsRegistry, IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
import { Extensions as WorkbenchExtensions, IWorkbenchContributionsRegistry, IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||||
|
@ -146,7 +146,7 @@ export class TaskStatusBarContributions extends Disposable implements IWorkbench
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ignoreEventForUpdateRunningTasksCount(event: TaskEvent): boolean {
|
private ignoreEventForUpdateRunningTasksCount(event: ITaskEvent): boolean {
|
||||||
if (!this.taskService.inTerminal()) {
|
if (!this.taskService.inTerminal()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import * as Objects from 'vs/base/common/objects';
|
||||||
import { Task, ContributedTask, CustomTask, ConfiguringTask, TaskSorter, KeyedTaskIdentifier } from 'vs/workbench/contrib/tasks/common/tasks';
|
import { Task, ContributedTask, CustomTask, ConfiguringTask, TaskSorter, KeyedTaskIdentifier } from 'vs/workbench/contrib/tasks/common/tasks';
|
||||||
import { IWorkspace, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
import { IWorkspace, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||||
import * as Types from 'vs/base/common/types';
|
import * as Types from 'vs/base/common/types';
|
||||||
import { ITaskService, WorkspaceFolderTaskResult } from 'vs/workbench/contrib/tasks/common/taskService';
|
import { ITaskService, IWorkspaceFolderTaskResult } from 'vs/workbench/contrib/tasks/common/taskService';
|
||||||
import { IQuickPickItem, QuickPickInput, IQuickPick, IQuickInputButton } from 'vs/base/parts/quickinput/common/quickInput';
|
import { IQuickPickItem, QuickPickInput, IQuickPick, IQuickInputButton } from 'vs/base/parts/quickinput/common/quickInput';
|
||||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||||
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
|
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
|
||||||
|
@ -27,11 +27,11 @@ export function isWorkspaceFolder(folder: IWorkspace | IWorkspaceFolder): folder
|
||||||
return 'uri' in folder;
|
return 'uri' in folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskQuickPickEntry extends IQuickPickItem {
|
export interface ITaskQuickPickEntry extends IQuickPickItem {
|
||||||
task: Task | undefined | null;
|
task: Task | undefined | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskTwoLevelQuickPickEntry extends IQuickPickItem {
|
export interface ITaskTwoLevelQuickPickEntry extends IQuickPickItem {
|
||||||
task: Task | ConfiguringTask | string | undefined | null;
|
task: Task | ConfiguringTask | string | undefined | null;
|
||||||
settingType?: string;
|
settingType?: string;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ const removeTaskIcon = registerIcon('tasks-remove', Codicon.close, nls.localize(
|
||||||
|
|
||||||
export class TaskQuickPick extends Disposable {
|
export class TaskQuickPick extends Disposable {
|
||||||
private sorter: TaskSorter;
|
private sorter: TaskSorter;
|
||||||
private topLevelEntries: QuickPickInput<TaskTwoLevelQuickPickEntry>[] | undefined;
|
private topLevelEntries: QuickPickInput<ITaskTwoLevelQuickPickEntry>[] | undefined;
|
||||||
constructor(
|
constructor(
|
||||||
private taskService: ITaskService,
|
private taskService: ITaskService,
|
||||||
private configurationService: IConfigurationService,
|
private configurationService: IConfigurationService,
|
||||||
|
@ -74,13 +74,13 @@ export class TaskQuickPick extends Disposable {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
private createTaskEntry(task: Task | ConfiguringTask, extraButtons: IQuickInputButton[] = []): TaskTwoLevelQuickPickEntry {
|
private createTaskEntry(task: Task | ConfiguringTask, extraButtons: IQuickInputButton[] = []): ITaskTwoLevelQuickPickEntry {
|
||||||
const entry: TaskTwoLevelQuickPickEntry = { label: this.guessTaskLabel(task), description: this.taskService.getTaskDescription(task), task, detail: this.showDetail() ? task.configurationProperties.detail : undefined };
|
const entry: ITaskTwoLevelQuickPickEntry = { label: this.guessTaskLabel(task), description: this.taskService.getTaskDescription(task), task, detail: this.showDetail() ? task.configurationProperties.detail : undefined };
|
||||||
entry.buttons = [{ iconClass: ThemeIcon.asClassName(configureTaskIcon), tooltip: nls.localize('configureTask', "Configure Task") }, ...extraButtons];
|
entry.buttons = [{ iconClass: ThemeIcon.asClassName(configureTaskIcon), tooltip: nls.localize('configureTask', "Configure Task") }, ...extraButtons];
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
private createEntriesForGroup(entries: QuickPickInput<TaskTwoLevelQuickPickEntry>[], tasks: (Task | ConfiguringTask)[],
|
private createEntriesForGroup(entries: QuickPickInput<ITaskTwoLevelQuickPickEntry>[], tasks: (Task | ConfiguringTask)[],
|
||||||
groupLabel: string, extraButtons: IQuickInputButton[] = []) {
|
groupLabel: string, extraButtons: IQuickInputButton[] = []) {
|
||||||
entries.push({ type: 'separator', label: groupLabel });
|
entries.push({ type: 'separator', label: groupLabel });
|
||||||
tasks.forEach(task => {
|
tasks.forEach(task => {
|
||||||
|
@ -88,7 +88,7 @@ export class TaskQuickPick extends Disposable {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private createTypeEntries(entries: QuickPickInput<TaskTwoLevelQuickPickEntry>[], types: string[]) {
|
private createTypeEntries(entries: QuickPickInput<ITaskTwoLevelQuickPickEntry>[], types: string[]) {
|
||||||
entries.push({ type: 'separator', label: nls.localize('contributedTasks', "contributed") });
|
entries.push({ type: 'separator', label: nls.localize('contributedTasks', "contributed") });
|
||||||
types.forEach(type => {
|
types.forEach(type => {
|
||||||
entries.push({ label: `$(folder) ${type}`, task: type, ariaLabel: nls.localize('taskType', "All {0} tasks", type) });
|
entries.push({ label: `$(folder) ${type}`, task: type, ariaLabel: nls.localize('taskType', "All {0} tasks", type) });
|
||||||
|
@ -96,7 +96,7 @@ export class TaskQuickPick extends Disposable {
|
||||||
entries.push({ label: SHOW_ALL, task: SHOW_ALL, alwaysShow: true });
|
entries.push({ label: SHOW_ALL, task: SHOW_ALL, alwaysShow: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleFolderTaskResult(result: Map<string, WorkspaceFolderTaskResult>): (Task | ConfiguringTask)[] {
|
private handleFolderTaskResult(result: Map<string, IWorkspaceFolderTaskResult>): (Task | ConfiguringTask)[] {
|
||||||
let tasks: (Task | ConfiguringTask)[] = [];
|
let tasks: (Task | ConfiguringTask)[] = [];
|
||||||
Array.from(result).forEach(([key, folderTasks]) => {
|
Array.from(result).forEach(([key, folderTasks]) => {
|
||||||
if (folderTasks.set) {
|
if (folderTasks.set) {
|
||||||
|
@ -142,7 +142,7 @@ export class TaskQuickPick extends Disposable {
|
||||||
return { configuredTasks: dedupedConfiguredTasks, recentTasks: prunedRecentTasks };
|
return { configuredTasks: dedupedConfiguredTasks, recentTasks: prunedRecentTasks };
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getTopLevelEntries(defaultEntry?: TaskQuickPickEntry): Promise<{ entries: QuickPickInput<TaskTwoLevelQuickPickEntry>[]; isSingleConfigured?: Task | ConfiguringTask }> {
|
public async getTopLevelEntries(defaultEntry?: ITaskQuickPickEntry): Promise<{ entries: QuickPickInput<ITaskTwoLevelQuickPickEntry>[]; isSingleConfigured?: Task | ConfiguringTask }> {
|
||||||
if (this.topLevelEntries !== undefined) {
|
if (this.topLevelEntries !== undefined) {
|
||||||
return { entries: this.topLevelEntries };
|
return { entries: this.topLevelEntries };
|
||||||
}
|
}
|
||||||
|
@ -193,8 +193,8 @@ export class TaskQuickPick extends Disposable {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async show(placeHolder: string, defaultEntry?: TaskQuickPickEntry, startAtType?: string): Promise<Task | undefined | null> {
|
public async show(placeHolder: string, defaultEntry?: ITaskQuickPickEntry, startAtType?: string): Promise<Task | undefined | null> {
|
||||||
const picker: IQuickPick<TaskTwoLevelQuickPickEntry> = this.quickInputService.createQuickPick();
|
const picker: IQuickPick<ITaskTwoLevelQuickPickEntry> = this.quickInputService.createQuickPick();
|
||||||
picker.placeholder = placeHolder;
|
picker.placeholder = placeHolder;
|
||||||
picker.matchOnDescription = true;
|
picker.matchOnDescription = true;
|
||||||
picker.ignoreFocusOut = false;
|
picker.ignoreFocusOut = false;
|
||||||
|
@ -237,7 +237,7 @@ export class TaskQuickPick extends Disposable {
|
||||||
picker.dispose();
|
picker.dispose();
|
||||||
return this.toTask(topLevelEntriesResult.isSingleConfigured);
|
return this.toTask(topLevelEntriesResult.isSingleConfigured);
|
||||||
}
|
}
|
||||||
const taskQuickPickEntries: QuickPickInput<TaskTwoLevelQuickPickEntry>[] = topLevelEntriesResult.entries;
|
const taskQuickPickEntries: QuickPickInput<ITaskTwoLevelQuickPickEntry>[] = topLevelEntriesResult.entries;
|
||||||
firstLevelTask = await this.doPickerFirstLevel(picker, taskQuickPickEntries);
|
firstLevelTask = await this.doPickerFirstLevel(picker, taskQuickPickEntries);
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
|
@ -265,9 +265,9 @@ export class TaskQuickPick extends Disposable {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async doPickerFirstLevel(picker: IQuickPick<TaskTwoLevelQuickPickEntry>, taskQuickPickEntries: QuickPickInput<TaskTwoLevelQuickPickEntry>[]): Promise<Task | ConfiguringTask | string | null | undefined> {
|
private async doPickerFirstLevel(picker: IQuickPick<ITaskTwoLevelQuickPickEntry>, taskQuickPickEntries: QuickPickInput<ITaskTwoLevelQuickPickEntry>[]): Promise<Task | ConfiguringTask | string | null | undefined> {
|
||||||
picker.items = taskQuickPickEntries;
|
picker.items = taskQuickPickEntries;
|
||||||
const firstLevelPickerResult = await new Promise<TaskTwoLevelQuickPickEntry | undefined | null>(resolve => {
|
const firstLevelPickerResult = await new Promise<ITaskTwoLevelQuickPickEntry | undefined | null>(resolve => {
|
||||||
Event.once(picker.onDidAccept)(async () => {
|
Event.once(picker.onDidAccept)(async () => {
|
||||||
resolve(picker.selectedItems ? picker.selectedItems[0] : undefined);
|
resolve(picker.selectedItems ? picker.selectedItems[0] : undefined);
|
||||||
});
|
});
|
||||||
|
@ -275,7 +275,7 @@ export class TaskQuickPick extends Disposable {
|
||||||
return firstLevelPickerResult?.task;
|
return firstLevelPickerResult?.task;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async doPickerSecondLevel(picker: IQuickPick<TaskTwoLevelQuickPickEntry>, type: string) {
|
private async doPickerSecondLevel(picker: IQuickPick<ITaskTwoLevelQuickPickEntry>, type: string) {
|
||||||
picker.busy = true;
|
picker.busy = true;
|
||||||
if (type === SHOW_ALL) {
|
if (type === SHOW_ALL) {
|
||||||
const items = (await this.taskService.tasks()).sort((a, b) => this.sorter.compare(a, b)).map(task => this.createTaskEntry(task));
|
const items = (await this.taskService.tasks()).sort((a, b) => this.sorter.compare(a, b)).map(task => this.createTaskEntry(task));
|
||||||
|
@ -286,7 +286,7 @@ export class TaskQuickPick extends Disposable {
|
||||||
picker.items = await this.getEntriesForProvider(type);
|
picker.items = await this.getEntriesForProvider(type);
|
||||||
}
|
}
|
||||||
picker.busy = false;
|
picker.busy = false;
|
||||||
const secondLevelPickerResult = await new Promise<TaskTwoLevelQuickPickEntry | undefined | null>(resolve => {
|
const secondLevelPickerResult = await new Promise<ITaskTwoLevelQuickPickEntry | undefined | null>(resolve => {
|
||||||
Event.once(picker.onDidAccept)(async () => {
|
Event.once(picker.onDidAccept)(async () => {
|
||||||
resolve(picker.selectedItems ? picker.selectedItems[0] : undefined);
|
resolve(picker.selectedItems ? picker.selectedItems[0] : undefined);
|
||||||
});
|
});
|
||||||
|
@ -295,8 +295,8 @@ export class TaskQuickPick extends Disposable {
|
||||||
return secondLevelPickerResult;
|
return secondLevelPickerResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static allSettingEntries(configurationService: IConfigurationService): (TaskTwoLevelQuickPickEntry & { settingType: string })[] {
|
public static allSettingEntries(configurationService: IConfigurationService): (ITaskTwoLevelQuickPickEntry & { settingType: string })[] {
|
||||||
const entries: (TaskTwoLevelQuickPickEntry & { settingType: string })[] = [];
|
const entries: (ITaskTwoLevelQuickPickEntry & { settingType: string })[] = [];
|
||||||
const gruntEntry = TaskQuickPick.getSettingEntry(configurationService, 'grunt');
|
const gruntEntry = TaskQuickPick.getSettingEntry(configurationService, 'grunt');
|
||||||
if (gruntEntry) {
|
if (gruntEntry) {
|
||||||
entries.push(gruntEntry);
|
entries.push(gruntEntry);
|
||||||
|
@ -312,7 +312,7 @@ export class TaskQuickPick extends Disposable {
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getSettingEntry(configurationService: IConfigurationService, type: string): (TaskTwoLevelQuickPickEntry & { settingType: string }) | undefined {
|
public static getSettingEntry(configurationService: IConfigurationService, type: string): (ITaskTwoLevelQuickPickEntry & { settingType: string }) | undefined {
|
||||||
if (configurationService.getValue(`${type}.autoDetect`) === 'off') {
|
if (configurationService.getValue(`${type}.autoDetect`) === 'off') {
|
||||||
return {
|
return {
|
||||||
label: nls.localize('TaskQuickPick.changeSettingsOptions', "$(gear) {0} task detection is turned off. Enable {1} task detection...",
|
label: nls.localize('TaskQuickPick.changeSettingsOptions', "$(gear) {0} task detection is turned off. Enable {1} task detection...",
|
||||||
|
@ -325,9 +325,9 @@ export class TaskQuickPick extends Disposable {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getEntriesForProvider(type: string): Promise<QuickPickInput<TaskTwoLevelQuickPickEntry>[]> {
|
private async getEntriesForProvider(type: string): Promise<QuickPickInput<ITaskTwoLevelQuickPickEntry>[]> {
|
||||||
const tasks = (await this.taskService.tasks({ type })).sort((a, b) => this.sorter.compare(a, b));
|
const tasks = (await this.taskService.tasks({ type })).sort((a, b) => this.sorter.compare(a, b));
|
||||||
let taskQuickPickEntries: QuickPickInput<TaskTwoLevelQuickPickEntry>[];
|
let taskQuickPickEntries: QuickPickInput<ITaskTwoLevelQuickPickEntry>[];
|
||||||
if (tasks.length > 0) {
|
if (tasks.length > 0) {
|
||||||
taskQuickPickEntries = tasks.map(task => this.createTaskEntry(task));
|
taskQuickPickEntries = tasks.map(task => this.createTaskEntry(task));
|
||||||
taskQuickPickEntries.push({
|
taskQuickPickEntries.push({
|
||||||
|
@ -367,7 +367,7 @@ export class TaskQuickPick extends Disposable {
|
||||||
|
|
||||||
static async show(taskService: ITaskService, configurationService: IConfigurationService,
|
static async show(taskService: ITaskService, configurationService: IConfigurationService,
|
||||||
quickInputService: IQuickInputService, notificationService: INotificationService,
|
quickInputService: IQuickInputService, notificationService: INotificationService,
|
||||||
dialogService: IDialogService, placeHolder: string, defaultEntry?: TaskQuickPickEntry) {
|
dialogService: IDialogService, placeHolder: string, defaultEntry?: ITaskQuickPickEntry) {
|
||||||
const taskQuickPick = new TaskQuickPick(taskService, configurationService, quickInputService, notificationService, dialogService);
|
const taskQuickPick = new TaskQuickPick(taskService, configurationService, quickInputService, notificationService, dialogService);
|
||||||
return taskQuickPick.show(placeHolder, defaultEntry);
|
return taskQuickPick.show(placeHolder, defaultEntry);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@ import * as nls from 'vs/nls';
|
||||||
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||||
import { ITaskSystem } from 'vs/workbench/contrib/tasks/common/taskSystem';
|
import { ITaskSystem } from 'vs/workbench/contrib/tasks/common/taskSystem';
|
||||||
import { ExecutionEngine } from 'vs/workbench/contrib/tasks/common/tasks';
|
import { ExecutionEngine } from 'vs/workbench/contrib/tasks/common/tasks';
|
||||||
import { AbstractTaskService, WorkspaceFolderConfigurationResult } from 'vs/workbench/contrib/tasks/browser/abstractTaskService';
|
import { AbstractTaskService, IWorkspaceFolderConfigurationResult } from 'vs/workbench/contrib/tasks/browser/abstractTaskService';
|
||||||
import { TaskFilter, ITaskService } from 'vs/workbench/contrib/tasks/common/taskService';
|
import { ITaskFilter, ITaskService } from 'vs/workbench/contrib/tasks/common/taskService';
|
||||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||||
|
|
||||||
export class TaskService extends AbstractTaskService {
|
export class TaskService extends AbstractTaskService {
|
||||||
|
@ -32,11 +32,11 @@ export class TaskService extends AbstractTaskService {
|
||||||
return this._taskSystem!;
|
return this._taskSystem!;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected computeLegacyConfiguration(workspaceFolder: IWorkspaceFolder): Promise<WorkspaceFolderConfigurationResult> {
|
protected computeLegacyConfiguration(workspaceFolder: IWorkspaceFolder): Promise<IWorkspaceFolderConfigurationResult> {
|
||||||
throw new Error(TaskService.ProcessTaskSystemSupportMessage);
|
throw new Error(TaskService.ProcessTaskSystemSupportMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected versionAndEngineCompatible(filter?: TaskFilter): boolean {
|
protected versionAndEngineCompatible(filter?: ITaskFilter): boolean {
|
||||||
return this.executionEngine === ExecutionEngine.Terminal;
|
return this.executionEngine === ExecutionEngine.Terminal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,14 +8,14 @@ import { Codicon } from 'vs/base/common/codicons';
|
||||||
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
|
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
|
||||||
import Severity from 'vs/base/common/severity';
|
import Severity from 'vs/base/common/severity';
|
||||||
import { AbstractProblemCollector, StartStopProblemCollector } from 'vs/workbench/contrib/tasks/common/problemCollectors';
|
import { AbstractProblemCollector, StartStopProblemCollector } from 'vs/workbench/contrib/tasks/common/problemCollectors';
|
||||||
import { TaskEvent, TaskEventKind, TaskRunType } from 'vs/workbench/contrib/tasks/common/tasks';
|
import { ITaskEvent, TaskEventKind, TaskRunType } from 'vs/workbench/contrib/tasks/common/tasks';
|
||||||
import { ITaskService, Task } from 'vs/workbench/contrib/tasks/common/taskService';
|
import { ITaskService, Task } from 'vs/workbench/contrib/tasks/common/taskService';
|
||||||
import { ITerminalInstance } from 'vs/workbench/contrib/terminal/browser/terminal';
|
import { ITerminalInstance } from 'vs/workbench/contrib/terminal/browser/terminal';
|
||||||
import { ITerminalStatus } from 'vs/workbench/contrib/terminal/browser/terminalStatusList';
|
import { ITerminalStatus } from 'vs/workbench/contrib/terminal/browser/terminalStatusList';
|
||||||
import { MarkerSeverity } from 'vs/platform/markers/common/markers';
|
import { MarkerSeverity } from 'vs/platform/markers/common/markers';
|
||||||
import { spinningLoading } from 'vs/platform/theme/common/iconRegistry';
|
import { spinningLoading } from 'vs/platform/theme/common/iconRegistry';
|
||||||
|
|
||||||
interface TerminalData {
|
interface ITerminalData {
|
||||||
terminal: ITerminalInstance;
|
terminal: ITerminalInstance;
|
||||||
task: Task;
|
task: Task;
|
||||||
status: ITerminalStatus;
|
status: ITerminalStatus;
|
||||||
|
@ -36,7 +36,7 @@ const INFO_TASK_STATUS: ITerminalStatus = { id: TASK_TERMINAL_STATUS_ID, icon: C
|
||||||
const INFO_INACTIVE_TASK_STATUS: ITerminalStatus = { id: TASK_TERMINAL_STATUS_ID, icon: Codicon.info, severity: Severity.Info, tooltip: nls.localize('taskTerminalStatus.infosInactive', "Task has infos and is waiting...") };
|
const INFO_INACTIVE_TASK_STATUS: ITerminalStatus = { id: TASK_TERMINAL_STATUS_ID, icon: Codicon.info, severity: Severity.Info, tooltip: nls.localize('taskTerminalStatus.infosInactive', "Task has infos and is waiting...") };
|
||||||
|
|
||||||
export class TaskTerminalStatus extends Disposable {
|
export class TaskTerminalStatus extends Disposable {
|
||||||
private terminalMap: Map<string, TerminalData> = new Map();
|
private terminalMap: Map<string, ITerminalData> = new Map();
|
||||||
|
|
||||||
constructor(taskService: ITaskService) {
|
constructor(taskService: ITaskService) {
|
||||||
super();
|
super();
|
||||||
|
@ -56,7 +56,7 @@ export class TaskTerminalStatus extends Disposable {
|
||||||
this.terminalMap.set(task._id, { terminal, task, status, problemMatcher, taskRunEnded: false });
|
this.terminalMap.set(task._id, { terminal, task, status, problemMatcher, taskRunEnded: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
private terminalFromEvent(event: TaskEvent): TerminalData | undefined {
|
private terminalFromEvent(event: ITaskEvent): ITerminalData | undefined {
|
||||||
if (!event.__task) {
|
if (!event.__task) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ export class TaskTerminalStatus extends Disposable {
|
||||||
return this.terminalMap.get(event.__task._id);
|
return this.terminalMap.get(event.__task._id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private eventEnd(event: TaskEvent) {
|
private eventEnd(event: ITaskEvent) {
|
||||||
const terminalData = this.terminalFromEvent(event);
|
const terminalData = this.terminalFromEvent(event);
|
||||||
if (!terminalData) {
|
if (!terminalData) {
|
||||||
return;
|
return;
|
||||||
|
@ -82,7 +82,7 @@ export class TaskTerminalStatus extends Disposable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private eventInactive(event: TaskEvent) {
|
private eventInactive(event: ITaskEvent) {
|
||||||
const terminalData = this.terminalFromEvent(event);
|
const terminalData = this.terminalFromEvent(event);
|
||||||
if (!terminalData || !terminalData.problemMatcher || terminalData.taskRunEnded) {
|
if (!terminalData || !terminalData.problemMatcher || terminalData.taskRunEnded) {
|
||||||
return;
|
return;
|
||||||
|
@ -99,7 +99,7 @@ export class TaskTerminalStatus extends Disposable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private eventActive(event: TaskEvent) {
|
private eventActive(event: ITaskEvent) {
|
||||||
const terminalData = this.terminalFromEvent(event);
|
const terminalData = this.terminalFromEvent(event);
|
||||||
if (!terminalData) {
|
if (!terminalData) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -12,7 +12,7 @@ import { ITaskService, Task } from 'vs/workbench/contrib/tasks/common/taskServic
|
||||||
import { CustomTask, ContributedTask, ConfiguringTask } from 'vs/workbench/contrib/tasks/common/tasks';
|
import { CustomTask, ContributedTask, ConfiguringTask } from 'vs/workbench/contrib/tasks/common/tasks';
|
||||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||||
import { DisposableStore } from 'vs/base/common/lifecycle';
|
import { DisposableStore } from 'vs/base/common/lifecycle';
|
||||||
import { TaskQuickPick, TaskTwoLevelQuickPickEntry } from 'vs/workbench/contrib/tasks/browser/taskQuickPick';
|
import { TaskQuickPick, ITaskTwoLevelQuickPickEntry } from 'vs/workbench/contrib/tasks/browser/taskQuickPick';
|
||||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||||
import { isString } from 'vs/base/common/types';
|
import { isString } from 'vs/base/common/types';
|
||||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||||
|
@ -56,8 +56,8 @@ export class TasksQuickAccessProvider extends PickerQuickAccessProvider<IPickerQ
|
||||||
taskPicks.push(entry);
|
taskPicks.push(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
const task: Task | ConfiguringTask | string = (<TaskTwoLevelQuickPickEntry>entry).task!;
|
const task: Task | ConfiguringTask | string = (<ITaskTwoLevelQuickPickEntry>entry).task!;
|
||||||
const quickAccessEntry: IPickerQuickAccessItem = <TaskTwoLevelQuickPickEntry>entry;
|
const quickAccessEntry: IPickerQuickAccessItem = <ITaskTwoLevelQuickPickEntry>entry;
|
||||||
quickAccessEntry.highlights = { label: highlights };
|
quickAccessEntry.highlights = { label: highlights };
|
||||||
quickAccessEntry.trigger = (index) => {
|
quickAccessEntry.trigger = (index) => {
|
||||||
if ((index === 1) && (quickAccessEntry.buttons?.length === 2)) {
|
if ((index === 1) && (quickAccessEntry.buttons?.length === 2)) {
|
||||||
|
|
|
@ -30,12 +30,12 @@ import { ITerminalService, ITerminalInstance, ITerminalGroupService } from 'vs/w
|
||||||
import { IOutputService } from 'vs/workbench/services/output/common/output';
|
import { IOutputService } from 'vs/workbench/services/output/common/output';
|
||||||
import { StartStopProblemCollector, WatchingProblemCollector, ProblemCollectorEventKind, ProblemHandlingStrategy } from 'vs/workbench/contrib/tasks/common/problemCollectors';
|
import { StartStopProblemCollector, WatchingProblemCollector, ProblemCollectorEventKind, ProblemHandlingStrategy } from 'vs/workbench/contrib/tasks/common/problemCollectors';
|
||||||
import {
|
import {
|
||||||
Task, CustomTask, ContributedTask, RevealKind, CommandOptions, ShellConfiguration, RuntimeType, PanelKind,
|
Task, CustomTask, ContributedTask, RevealKind, CommandOptions, IShellConfiguration, RuntimeType, PanelKind,
|
||||||
TaskEvent, TaskEventKind, ShellQuotingOptions, ShellQuoting, CommandString, CommandConfiguration, ExtensionTaskSource, TaskScope, RevealProblemKind, DependsOrder, TaskSourceKind, InMemoryTask
|
TaskEvent, TaskEventKind, IShellQuotingOptions, ShellQuoting, CommandString, ICommandConfiguration, IExtensionTaskSource, TaskScope, RevealProblemKind, DependsOrder, TaskSourceKind, InMemoryTask, ITaskEvent
|
||||||
} from 'vs/workbench/contrib/tasks/common/tasks';
|
} from 'vs/workbench/contrib/tasks/common/tasks';
|
||||||
import {
|
import {
|
||||||
ITaskSystem, ITaskSummary, ITaskExecuteResult, TaskExecuteKind, TaskError, TaskErrors, ITaskResolver,
|
ITaskSystem, ITaskSummary, ITaskExecuteResult, TaskExecuteKind, TaskError, TaskErrors, ITaskResolver,
|
||||||
Triggers, TaskTerminateResponse, TaskSystemInfoResolver, TaskSystemInfo, ResolveSet, ResolvedVariables
|
Triggers, ITaskTerminateResponse, ITaskSystemInfoResolver, ITaskSystemInfo, IResolveSet, IResolvedVariables
|
||||||
} from 'vs/workbench/contrib/tasks/common/taskSystem';
|
} from 'vs/workbench/contrib/tasks/common/taskSystem';
|
||||||
import { URI } from 'vs/base/common/uri';
|
import { URI } from 'vs/base/common/uri';
|
||||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||||
|
@ -51,13 +51,13 @@ import { ITaskService } from 'vs/workbench/contrib/tasks/common/taskService';
|
||||||
import { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/browser/panecomposite';
|
import { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/browser/panecomposite';
|
||||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||||
|
|
||||||
interface TerminalData {
|
interface ITerminalData {
|
||||||
terminal: ITerminalInstance;
|
terminal: ITerminalInstance;
|
||||||
lastTask: string;
|
lastTask: string;
|
||||||
group?: string;
|
group?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ActiveTerminalData {
|
interface IActiveTerminalData {
|
||||||
terminal: ITerminalInstance;
|
terminal: ITerminalInstance;
|
||||||
task: Task;
|
task: Task;
|
||||||
promise: Promise<ITaskSummary>;
|
promise: Promise<ITaskSummary>;
|
||||||
|
@ -85,7 +85,7 @@ class InstanceManager {
|
||||||
|
|
||||||
class VariableResolver {
|
class VariableResolver {
|
||||||
private static regex = /\$\{(.*?)\}/g;
|
private static regex = /\$\{(.*?)\}/g;
|
||||||
constructor(public workspaceFolder: IWorkspaceFolder | undefined, public taskSystemInfo: TaskSystemInfo | undefined, public readonly values: Map<string, string>, private _service: IConfigurationResolverService | undefined) {
|
constructor(public workspaceFolder: IWorkspaceFolder | undefined, public taskSystemInfo: ITaskSystemInfo | undefined, public readonly values: Map<string, string>, private _service: IConfigurationResolverService | undefined) {
|
||||||
}
|
}
|
||||||
async resolve(value: string): Promise<string> {
|
async resolve(value: string): Promise<string> {
|
||||||
const replacers: Promise<string>[] = [];
|
const replacers: Promise<string>[] = [];
|
||||||
|
@ -115,8 +115,8 @@ export class VerifiedTask {
|
||||||
readonly task: Task;
|
readonly task: Task;
|
||||||
readonly resolver: ITaskResolver;
|
readonly resolver: ITaskResolver;
|
||||||
readonly trigger: string;
|
readonly trigger: string;
|
||||||
resolvedVariables?: ResolvedVariables;
|
resolvedVariables?: IResolvedVariables;
|
||||||
systemInfo?: TaskSystemInfo;
|
systemInfo?: ITaskSystemInfo;
|
||||||
workspaceFolder?: IWorkspaceFolder;
|
workspaceFolder?: IWorkspaceFolder;
|
||||||
shellLaunchConfig?: IShellLaunchConfig;
|
shellLaunchConfig?: IShellLaunchConfig;
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ export class VerifiedTask {
|
||||||
return verified;
|
return verified;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getVerifiedTask(): { task: Task; resolver: ITaskResolver; trigger: string; resolvedVariables: ResolvedVariables; systemInfo: TaskSystemInfo; workspaceFolder: IWorkspaceFolder; shellLaunchConfig: IShellLaunchConfig } {
|
public getVerifiedTask(): { task: Task; resolver: ITaskResolver; trigger: string; resolvedVariables: IResolvedVariables; systemInfo: ITaskSystemInfo; workspaceFolder: IWorkspaceFolder; shellLaunchConfig: IShellLaunchConfig } {
|
||||||
if (this.verify()) {
|
if (this.verify()) {
|
||||||
return { task: this.task, resolver: this.resolver, trigger: this.trigger, resolvedVariables: this.resolvedVariables!, systemInfo: this.systemInfo!, workspaceFolder: this.workspaceFolder!, shellLaunchConfig: this.shellLaunchConfig! };
|
return { task: this.task, resolver: this.resolver, trigger: this.trigger, resolvedVariables: this.resolvedVariables!, systemInfo: this.systemInfo!, workspaceFolder: this.workspaceFolder!, shellLaunchConfig: this.shellLaunchConfig! };
|
||||||
} else {
|
} else {
|
||||||
|
@ -149,7 +149,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
|
|
||||||
private static readonly ProcessVarName = '__process__';
|
private static readonly ProcessVarName = '__process__';
|
||||||
|
|
||||||
private static shellQuotes: IStringDictionary<ShellQuotingOptions> = {
|
private static shellQuotes: IStringDictionary<IShellQuotingOptions> = {
|
||||||
'cmd': {
|
'cmd': {
|
||||||
strong: '"'
|
strong: '"'
|
||||||
},
|
},
|
||||||
|
@ -179,19 +179,19 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static osShellQuotes: IStringDictionary<ShellQuotingOptions> = {
|
private static osShellQuotes: IStringDictionary<IShellQuotingOptions> = {
|
||||||
'Linux': TerminalTaskSystem.shellQuotes['bash'],
|
'Linux': TerminalTaskSystem.shellQuotes['bash'],
|
||||||
'Mac': TerminalTaskSystem.shellQuotes['bash'],
|
'Mac': TerminalTaskSystem.shellQuotes['bash'],
|
||||||
'Windows': TerminalTaskSystem.shellQuotes['powershell']
|
'Windows': TerminalTaskSystem.shellQuotes['powershell']
|
||||||
};
|
};
|
||||||
|
|
||||||
private activeTasks: IStringDictionary<ActiveTerminalData>;
|
private activeTasks: IStringDictionary<IActiveTerminalData>;
|
||||||
private instances: IStringDictionary<InstanceManager>;
|
private instances: IStringDictionary<InstanceManager>;
|
||||||
private busyTasks: IStringDictionary<Task>;
|
private busyTasks: IStringDictionary<Task>;
|
||||||
private terminals: IStringDictionary<TerminalData>;
|
private terminals: IStringDictionary<ITerminalData>;
|
||||||
private idleTaskTerminals: LinkedMap<string, string>;
|
private idleTaskTerminals: LinkedMap<string, string>;
|
||||||
private sameTaskTerminals: IStringDictionary<string>;
|
private sameTaskTerminals: IStringDictionary<string>;
|
||||||
private taskSystemInfoResolver: TaskSystemInfoResolver;
|
private taskSystemInfoResolver: ITaskSystemInfoResolver;
|
||||||
private lastTask: VerifiedTask | undefined;
|
private lastTask: VerifiedTask | undefined;
|
||||||
// Should always be set in run
|
// Should always be set in run
|
||||||
private currentTask!: VerifiedTask;
|
private currentTask!: VerifiedTask;
|
||||||
|
@ -201,7 +201,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
private terminalStatusManager: TaskTerminalStatus;
|
private terminalStatusManager: TaskTerminalStatus;
|
||||||
private terminalCreationQueue: Promise<ITerminalInstance | void> = Promise.resolve();
|
private terminalCreationQueue: Promise<ITerminalInstance | void> = Promise.resolve();
|
||||||
|
|
||||||
private readonly _onDidStateChange: Emitter<TaskEvent>;
|
private readonly _onDidStateChange: Emitter<ITaskEvent>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private terminalService: ITerminalService,
|
private terminalService: ITerminalService,
|
||||||
|
@ -222,7 +222,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
private configurationService: IConfigurationService,
|
private configurationService: IConfigurationService,
|
||||||
private notificationService: INotificationService,
|
private notificationService: INotificationService,
|
||||||
taskService: ITaskService,
|
taskService: ITaskService,
|
||||||
taskSystemInfoResolver: TaskSystemInfoResolver,
|
taskSystemInfoResolver: ITaskSystemInfoResolver,
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
this._register(this.terminalStatusManager = new TaskTerminalStatus(taskService));
|
this._register(this.terminalStatusManager = new TaskTerminalStatus(taskService));
|
||||||
}
|
}
|
||||||
|
|
||||||
public get onDidStateChange(): Event<TaskEvent> {
|
public get onDidStateChange(): Event<ITaskEvent> {
|
||||||
return this._onDidStateChange.event;
|
return this._onDidStateChange.event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,7 +425,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
this.removeInstances(task);
|
this.removeInstances(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
private fireTaskEvent(event: TaskEvent) {
|
private fireTaskEvent(event: ITaskEvent) {
|
||||||
if (event.__task) {
|
if (event.__task) {
|
||||||
const activeTask = this.activeTasks[event.__task.getMapKey()];
|
const activeTask = this.activeTasks[event.__task.getMapKey()];
|
||||||
if (activeTask) {
|
if (activeTask) {
|
||||||
|
@ -435,12 +435,12 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
this._onDidStateChange.fire(event);
|
this._onDidStateChange.fire(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
public terminate(task: Task): Promise<TaskTerminateResponse> {
|
public terminate(task: Task): Promise<ITaskTerminateResponse> {
|
||||||
let activeTerminal = this.activeTasks[task.getMapKey()];
|
let activeTerminal = this.activeTasks[task.getMapKey()];
|
||||||
if (!activeTerminal) {
|
if (!activeTerminal) {
|
||||||
return Promise.resolve<TaskTerminateResponse>({ success: false, task: undefined });
|
return Promise.resolve<ITaskTerminateResponse>({ success: false, task: undefined });
|
||||||
}
|
}
|
||||||
return new Promise<TaskTerminateResponse>((resolve, reject) => {
|
return new Promise<ITaskTerminateResponse>((resolve, reject) => {
|
||||||
let terminal = activeTerminal.terminal;
|
let terminal = activeTerminal.terminal;
|
||||||
|
|
||||||
const onExit = terminal.onExit(() => {
|
const onExit = terminal.onExit(() => {
|
||||||
|
@ -457,12 +457,12 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public terminateAll(): Promise<TaskTerminateResponse[]> {
|
public terminateAll(): Promise<ITaskTerminateResponse[]> {
|
||||||
let promises: Promise<TaskTerminateResponse>[] = [];
|
let promises: Promise<ITaskTerminateResponse>[] = [];
|
||||||
Object.keys(this.activeTasks).forEach((key) => {
|
Object.keys(this.activeTasks).forEach((key) => {
|
||||||
let terminalData = this.activeTasks[key];
|
let terminalData = this.activeTasks[key];
|
||||||
let terminal = terminalData.terminal;
|
let terminal = terminalData.terminal;
|
||||||
promises.push(new Promise<TaskTerminateResponse>((resolve, reject) => {
|
promises.push(new Promise<ITaskTerminateResponse>((resolve, reject) => {
|
||||||
const onExit = terminal.onExit(() => {
|
const onExit = terminal.onExit(() => {
|
||||||
let task = terminalData.task;
|
let task = terminalData.task;
|
||||||
try {
|
try {
|
||||||
|
@ -477,7 +477,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
terminal.dispose();
|
terminal.dispose();
|
||||||
});
|
});
|
||||||
this.activeTasks = Object.create(null);
|
this.activeTasks = Object.create(null);
|
||||||
return Promise.all<TaskTerminateResponse>(promises);
|
return Promise.all<ITaskTerminateResponse>(promises);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -571,7 +571,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getDependencyPromise(task: ActiveTerminalData): Promise<ITaskSummary> {
|
private async getDependencyPromise(task: IActiveTerminalData): Promise<ITaskSummary> {
|
||||||
if (!task.task.configurationProperties.isBackground) {
|
if (!task.task.configurationProperties.isBackground) {
|
||||||
return task.promise;
|
return task.promise;
|
||||||
}
|
}
|
||||||
|
@ -595,7 +595,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
return Promise.race([inactivePromise, this.executeTask(task, resolver, trigger, encounteredDependencies, alreadyResolved)]);
|
return Promise.race([inactivePromise, this.executeTask(task, resolver, trigger, encounteredDependencies, alreadyResolved)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async resolveAndFindExecutable(systemInfo: TaskSystemInfo | undefined, workspaceFolder: IWorkspaceFolder | undefined, task: CustomTask | ContributedTask, cwd: string | undefined, envPath: string | undefined): Promise<string> {
|
private async resolveAndFindExecutable(systemInfo: ITaskSystemInfo | undefined, workspaceFolder: IWorkspaceFolder | undefined, task: CustomTask | ContributedTask, cwd: string | undefined, envPath: string | undefined): Promise<string> {
|
||||||
const command = await this.configurationResolverService.resolveAsync(workspaceFolder, CommandString.value(task.command.name!));
|
const command = await this.configurationResolverService.resolveAsync(workspaceFolder, CommandString.value(task.command.name!));
|
||||||
cwd = cwd ? await this.configurationResolverService.resolveAsync(workspaceFolder, cwd) : undefined;
|
cwd = cwd ? await this.configurationResolverService.resolveAsync(workspaceFolder, cwd) : undefined;
|
||||||
const paths = envPath ? await Promise.all(envPath.split(path.delimiter).map(p => this.configurationResolverService.resolveAsync(workspaceFolder, p))) : undefined;
|
const paths = envPath ? await Promise.all(envPath.split(path.delimiter).map(p => this.configurationResolverService.resolveAsync(workspaceFolder, p))) : undefined;
|
||||||
|
@ -627,13 +627,13 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async acquireInput(taskSystemInfo: TaskSystemInfo | undefined, workspaceFolder: IWorkspaceFolder | undefined, task: CustomTask | ContributedTask, variables: Set<string>, alreadyResolved: Map<string, string>): Promise<ResolvedVariables | undefined> {
|
private async acquireInput(taskSystemInfo: ITaskSystemInfo | undefined, workspaceFolder: IWorkspaceFolder | undefined, task: CustomTask | ContributedTask, variables: Set<string>, alreadyResolved: Map<string, string>): Promise<IResolvedVariables | undefined> {
|
||||||
const resolved = await this.resolveVariablesFromSet(taskSystemInfo, workspaceFolder, task, variables, alreadyResolved);
|
const resolved = await this.resolveVariablesFromSet(taskSystemInfo, workspaceFolder, task, variables, alreadyResolved);
|
||||||
this.fireTaskEvent(TaskEvent.create(TaskEventKind.AcquiredInput, task));
|
this.fireTaskEvent(TaskEvent.create(TaskEventKind.AcquiredInput, task));
|
||||||
return resolved;
|
return resolved;
|
||||||
}
|
}
|
||||||
|
|
||||||
private resolveVariablesFromSet(taskSystemInfo: TaskSystemInfo | undefined, workspaceFolder: IWorkspaceFolder | undefined, task: CustomTask | ContributedTask, variables: Set<string>, alreadyResolved: Map<string, string>): Promise<ResolvedVariables | undefined> {
|
private resolveVariablesFromSet(taskSystemInfo: ITaskSystemInfo | undefined, workspaceFolder: IWorkspaceFolder | undefined, task: CustomTask | ContributedTask, variables: Set<string>, alreadyResolved: Map<string, string>): Promise<IResolvedVariables | undefined> {
|
||||||
let isProcess = task.command && task.command.runtime === RuntimeType.Process;
|
let isProcess = task.command && task.command.runtime === RuntimeType.Process;
|
||||||
let options = task.command && task.command.options ? task.command.options : undefined;
|
let options = task.command && task.command.options ? task.command.options : undefined;
|
||||||
let cwd = options ? options.cwd : undefined;
|
let cwd = options ? options.cwd : undefined;
|
||||||
|
@ -649,9 +649,9 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const unresolved = this.findUnresolvedVariables(variables, alreadyResolved);
|
const unresolved = this.findUnresolvedVariables(variables, alreadyResolved);
|
||||||
let resolvedVariables: Promise<ResolvedVariables | undefined>;
|
let resolvedVariables: Promise<IResolvedVariables | undefined>;
|
||||||
if (taskSystemInfo && workspaceFolder) {
|
if (taskSystemInfo && workspaceFolder) {
|
||||||
let resolveSet: ResolveSet = {
|
let resolveSet: IResolveSet = {
|
||||||
variables: unresolved
|
variables: unresolved
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -685,7 +685,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
let variablesArray = new Array<string>();
|
let variablesArray = new Array<string>();
|
||||||
unresolved.forEach(variable => variablesArray.push(variable));
|
unresolved.forEach(variable => variablesArray.push(variable));
|
||||||
|
|
||||||
return new Promise<ResolvedVariables | undefined>((resolve, reject) => {
|
return new Promise<IResolvedVariables | undefined>((resolve, reject) => {
|
||||||
this.configurationResolverService.resolveWithInteraction(workspaceFolder, variablesArray, 'tasks', undefined, TaskSourceKind.toConfigurationTarget(task._source.kind)).then(async (resolvedVariablesMap: Map<string, string> | undefined) => {
|
this.configurationResolverService.resolveWithInteraction(workspaceFolder, variablesArray, 'tasks', undefined, TaskSourceKind.toConfigurationTarget(task._source.kind)).then(async (resolvedVariablesMap: Map<string, string> | undefined) => {
|
||||||
if (resolvedVariablesMap) {
|
if (resolvedVariablesMap) {
|
||||||
this.mergeMaps(alreadyResolved, resolvedVariablesMap);
|
this.mergeMaps(alreadyResolved, resolvedVariablesMap);
|
||||||
|
@ -699,7 +699,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
}
|
}
|
||||||
resolvedVariablesMap.set(TerminalTaskSystem.ProcessVarName, processVarValue);
|
resolvedVariablesMap.set(TerminalTaskSystem.ProcessVarName, processVarValue);
|
||||||
}
|
}
|
||||||
let resolvedVariablesResult: ResolvedVariables = {
|
let resolvedVariablesResult: IResolvedVariables = {
|
||||||
variables: resolvedVariablesMap,
|
variables: resolvedVariablesMap,
|
||||||
};
|
};
|
||||||
resolve(resolvedVariablesResult);
|
resolve(resolvedVariablesResult);
|
||||||
|
@ -722,7 +722,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
const folders = this.contextService.getWorkspace().folders;
|
const folders = this.contextService.getWorkspace().folders;
|
||||||
workspaceFolder = folders.length > 0 ? folders[0] : undefined;
|
workspaceFolder = folders.length > 0 ? folders[0] : undefined;
|
||||||
}
|
}
|
||||||
const systemInfo: TaskSystemInfo | undefined = this.currentTask.systemInfo = this.taskSystemInfoResolver(workspaceFolder);
|
const systemInfo: ITaskSystemInfo | undefined = this.currentTask.systemInfo = this.taskSystemInfoResolver(workspaceFolder);
|
||||||
|
|
||||||
let variables = new Set<string>();
|
let variables = new Set<string>();
|
||||||
this.collectTaskVariables(variables, task);
|
this.collectTaskVariables(variables, task);
|
||||||
|
@ -1037,7 +1037,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
waitOnExit
|
waitOnExit
|
||||||
};
|
};
|
||||||
let shellSpecified: boolean = false;
|
let shellSpecified: boolean = false;
|
||||||
let shellOptions: ShellConfiguration | undefined = task.command.options && task.command.options.shell;
|
let shellOptions: IShellConfiguration | undefined = task.command.options && task.command.options.shell;
|
||||||
if (shellOptions) {
|
if (shellOptions) {
|
||||||
if (shellOptions.executable) {
|
if (shellOptions.executable) {
|
||||||
// Clear out the args so that we don't end up with mismatched args.
|
// Clear out the args so that we don't end up with mismatched args.
|
||||||
|
@ -1260,7 +1260,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
let group = presentationOptions.group;
|
let group = presentationOptions.group;
|
||||||
|
|
||||||
let taskKey = task.getMapKey();
|
let taskKey = task.getMapKey();
|
||||||
let terminalToReuse: TerminalData | undefined;
|
let terminalToReuse: ITerminalData | undefined;
|
||||||
if (prefersSameTerminal) {
|
if (prefersSameTerminal) {
|
||||||
let terminalId = this.sameTaskTerminals[taskKey];
|
let terminalId = this.sameTaskTerminals[taskKey];
|
||||||
if (terminalId) {
|
if (terminalId) {
|
||||||
|
@ -1326,7 +1326,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
return [result, undefined];
|
return [result, undefined];
|
||||||
}
|
}
|
||||||
|
|
||||||
private buildShellCommandLine(platform: Platform.Platform, shellExecutable: string, shellOptions: ShellConfiguration | undefined, command: CommandString, originalCommand: CommandString | undefined, args: CommandString[]): string {
|
private buildShellCommandLine(platform: Platform.Platform, shellExecutable: string, shellOptions: IShellConfiguration | undefined, command: CommandString, originalCommand: CommandString | undefined, args: CommandString[]): string {
|
||||||
let basename = path.parse(shellExecutable).name.toLowerCase();
|
let basename = path.parse(shellExecutable).name.toLowerCase();
|
||||||
let shellQuoteOptions = this.getQuotingOptions(basename, shellOptions, platform);
|
let shellQuoteOptions = this.getQuotingOptions(basename, shellOptions, platform);
|
||||||
|
|
||||||
|
@ -1425,7 +1425,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
return commandLine;
|
return commandLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getQuotingOptions(shellBasename: string, shellOptions: ShellConfiguration | undefined, platform: Platform.Platform): ShellQuotingOptions {
|
private getQuotingOptions(shellBasename: string, shellOptions: IShellConfiguration | undefined, platform: Platform.Platform): IShellQuotingOptions {
|
||||||
if (shellOptions && shellOptions.quoting) {
|
if (shellOptions && shellOptions.quoting) {
|
||||||
return shellOptions.quoting;
|
return shellOptions.quoting;
|
||||||
}
|
}
|
||||||
|
@ -1463,7 +1463,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private collectCommandVariables(variables: Set<string>, command: CommandConfiguration, task: CustomTask | ContributedTask): void {
|
private collectCommandVariables(variables: Set<string>, command: ICommandConfiguration, task: CustomTask | ContributedTask): void {
|
||||||
// The custom execution should have everything it needs already as it provided
|
// The custom execution should have everything it needs already as it provided
|
||||||
// the callback.
|
// the callback.
|
||||||
if (command.runtime === RuntimeType.CustomExecution) {
|
if (command.runtime === RuntimeType.CustomExecution) {
|
||||||
|
@ -1478,7 +1478,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
command.args.forEach(arg => this.collectVariables(variables, arg));
|
command.args.forEach(arg => this.collectVariables(variables, arg));
|
||||||
}
|
}
|
||||||
// Try to get a scope.
|
// Try to get a scope.
|
||||||
const scope = (<ExtensionTaskSource>task._source).scope;
|
const scope = (<IExtensionTaskSource>task._source).scope;
|
||||||
if (scope !== TaskScope.Global) {
|
if (scope !== TaskScope.Global) {
|
||||||
variables.add('${workspaceFolder}');
|
variables.add('${workspaceFolder}');
|
||||||
}
|
}
|
||||||
|
@ -1540,7 +1540,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
} while (matches);
|
} while (matches);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async resolveCommandAndArgs(resolver: VariableResolver, commandConfig: CommandConfiguration): Promise<{ command: CommandString; args: CommandString[] }> {
|
private async resolveCommandAndArgs(resolver: VariableResolver, commandConfig: ICommandConfiguration): Promise<{ command: CommandString; args: CommandString[] }> {
|
||||||
// First we need to use the command args:
|
// First we need to use the command args:
|
||||||
let args: CommandString[] = commandConfig.args ? commandConfig.args.slice() : [];
|
let args: CommandString[] = commandConfig.args ? commandConfig.args.slice() : [];
|
||||||
args = await this.resolveVariables(resolver, args);
|
args = await this.resolveVariables(resolver, args);
|
||||||
|
@ -1574,7 +1574,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||||
this.appendOutput(nls.localize('unknownProblemMatcher', 'Problem matcher {0} can\'t be resolved. The matcher will be ignored'));
|
this.appendOutput(nls.localize('unknownProblemMatcher', 'Problem matcher {0} can\'t be resolved. The matcher will be ignored'));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let taskSystemInfo: TaskSystemInfo | undefined = resolver.taskSystemInfo;
|
let taskSystemInfo: ITaskSystemInfo | undefined = resolver.taskSystemInfo;
|
||||||
let hasFilePrefix = matcher.filePrefix !== undefined;
|
let hasFilePrefix = matcher.filePrefix !== undefined;
|
||||||
let hasUriProvider = taskSystemInfo !== undefined && taskSystemInfo.uriProvider !== undefined;
|
let hasUriProvider = taskSystemInfo !== undefined && taskSystemInfo.uriProvider !== undefined;
|
||||||
if (!hasFilePrefix && !hasUriProvider) {
|
if (!hasFilePrefix && !hasUriProvider) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { IDisposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||||
|
|
||||||
import { IModelService } from 'vs/editor/common/services/model';
|
import { IModelService } from 'vs/editor/common/services/model';
|
||||||
|
|
||||||
import { ILineMatcher, createLineMatcher, ProblemMatcher, ProblemMatch, ApplyToKind, WatchingPattern, getResource } from 'vs/workbench/contrib/tasks/common/problemMatcher';
|
import { ILineMatcher, createLineMatcher, ProblemMatcher, IProblemMatch, ApplyToKind, IWatchingPattern, getResource } from 'vs/workbench/contrib/tasks/common/problemMatcher';
|
||||||
import { IMarkerService, IMarkerData, MarkerSeverity } from 'vs/platform/markers/common/markers';
|
import { IMarkerService, IMarkerData, MarkerSeverity } from 'vs/platform/markers/common/markers';
|
||||||
import { generateUuid } from 'vs/base/common/uuid';
|
import { generateUuid } from 'vs/base/common/uuid';
|
||||||
import { IFileService } from 'vs/platform/files/common/files';
|
import { IFileService } from 'vs/platform/files/common/files';
|
||||||
|
@ -21,11 +21,11 @@ export const enum ProblemCollectorEventKind {
|
||||||
BackgroundProcessingEnds = 'backgroundProcessingEnds'
|
BackgroundProcessingEnds = 'backgroundProcessingEnds'
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProblemCollectorEvent {
|
export interface IProblemCollectorEvent {
|
||||||
kind: ProblemCollectorEventKind;
|
kind: ProblemCollectorEventKind;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ProblemCollectorEvent {
|
namespace IProblemCollectorEvent {
|
||||||
export function create(kind: ProblemCollectorEventKind) {
|
export function create(kind: ProblemCollectorEventKind) {
|
||||||
return Object.freeze({ kind });
|
return Object.freeze({ kind });
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ export abstract class AbstractProblemCollector implements IDisposable {
|
||||||
// [owner] -> [resource] -> number;
|
// [owner] -> [resource] -> number;
|
||||||
private deliveredMarkers: Map<string, Map<string, number>>;
|
private deliveredMarkers: Map<string, Map<string, number>>;
|
||||||
|
|
||||||
protected _onDidStateChange: Emitter<ProblemCollectorEvent>;
|
protected _onDidStateChange: Emitter<IProblemCollectorEvent>;
|
||||||
|
|
||||||
constructor(public readonly problemMatchers: ProblemMatcher[], protected markerService: IMarkerService, protected modelService: IModelService, fileService?: IFileService) {
|
constructor(public readonly problemMatchers: ProblemMatcher[], protected markerService: IMarkerService, protected modelService: IModelService, fileService?: IFileService) {
|
||||||
this.matchers = Object.create(null);
|
this.matchers = Object.create(null);
|
||||||
|
@ -101,7 +101,7 @@ export abstract class AbstractProblemCollector implements IDisposable {
|
||||||
this._onDidStateChange = new Emitter();
|
this._onDidStateChange = new Emitter();
|
||||||
}
|
}
|
||||||
|
|
||||||
public get onDidStateChange(): Event<ProblemCollectorEvent> {
|
public get onDidStateChange(): Event<IProblemCollectorEvent> {
|
||||||
return this._onDidStateChange.event;
|
return this._onDidStateChange.event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,8 +130,8 @@ export abstract class AbstractProblemCollector implements IDisposable {
|
||||||
return this._maxMarkerSeverity;
|
return this._maxMarkerSeverity;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected tryFindMarker(line: string): ProblemMatch | null {
|
protected tryFindMarker(line: string): IProblemMatch | null {
|
||||||
let result: ProblemMatch | null = null;
|
let result: IProblemMatch | null = null;
|
||||||
if (this.activeMatcher) {
|
if (this.activeMatcher) {
|
||||||
result = this.activeMatcher.next(line);
|
result = this.activeMatcher.next(line);
|
||||||
if (result) {
|
if (result) {
|
||||||
|
@ -158,7 +158,7 @@ export abstract class AbstractProblemCollector implements IDisposable {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async shouldApplyMatch(result: ProblemMatch): Promise<boolean> {
|
protected async shouldApplyMatch(result: IProblemMatch): Promise<boolean> {
|
||||||
switch (result.description.applyTo) {
|
switch (result.description.applyTo) {
|
||||||
case ApplyToKind.allDocuments:
|
case ApplyToKind.allDocuments:
|
||||||
return true;
|
return true;
|
||||||
|
@ -178,7 +178,7 @@ export abstract class AbstractProblemCollector implements IDisposable {
|
||||||
return ApplyToKind.allDocuments;
|
return ApplyToKind.allDocuments;
|
||||||
}
|
}
|
||||||
|
|
||||||
private tryMatchers(): ProblemMatch | null {
|
private tryMatchers(): IProblemMatch | null {
|
||||||
this.activeMatcher = null;
|
this.activeMatcher = null;
|
||||||
let length = this.buffer.length;
|
let length = this.buffer.length;
|
||||||
for (let startIndex = 0; startIndex < length; startIndex++) {
|
for (let startIndex = 0; startIndex < length; startIndex++) {
|
||||||
|
@ -200,7 +200,7 @@ export abstract class AbstractProblemCollector implements IDisposable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private captureMatch(match: ProblemMatch): void {
|
private captureMatch(match: IProblemMatch): void {
|
||||||
this._numberOfMatches++;
|
this._numberOfMatches++;
|
||||||
if (this._maxMarkerSeverity === undefined || match.marker.severity > this._maxMarkerSeverity) {
|
if (this._maxMarkerSeverity === undefined || match.marker.severity > this._maxMarkerSeverity) {
|
||||||
this._maxMarkerSeverity = match.marker.severity;
|
this._maxMarkerSeverity = match.marker.severity;
|
||||||
|
@ -387,16 +387,16 @@ export class StartStopProblemCollector extends AbstractProblemCollector implemen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface BackgroundPatterns {
|
interface IBackgroundPatterns {
|
||||||
key: string;
|
key: string;
|
||||||
matcher: ProblemMatcher;
|
matcher: ProblemMatcher;
|
||||||
begin: WatchingPattern;
|
begin: IWatchingPattern;
|
||||||
end: WatchingPattern;
|
end: IWatchingPattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class WatchingProblemCollector extends AbstractProblemCollector implements IProblemMatcher {
|
export class WatchingProblemCollector extends AbstractProblemCollector implements IProblemMatcher {
|
||||||
|
|
||||||
private backgroundPatterns: BackgroundPatterns[];
|
private backgroundPatterns: IBackgroundPatterns[];
|
||||||
|
|
||||||
// workaround for https://github.com/microsoft/vscode/issues/44018
|
// workaround for https://github.com/microsoft/vscode/issues/44018
|
||||||
private _activeBackgroundMatchers: Set<string>;
|
private _activeBackgroundMatchers: Set<string>;
|
||||||
|
@ -450,7 +450,7 @@ export class WatchingProblemCollector extends AbstractProblemCollector implement
|
||||||
for (let background of this.backgroundPatterns) {
|
for (let background of this.backgroundPatterns) {
|
||||||
if (background.matcher.watching && background.matcher.watching.activeOnStart) {
|
if (background.matcher.watching && background.matcher.watching.activeOnStart) {
|
||||||
this._activeBackgroundMatchers.add(background.key);
|
this._activeBackgroundMatchers.add(background.key);
|
||||||
this._onDidStateChange.fire(ProblemCollectorEvent.create(ProblemCollectorEventKind.BackgroundProcessingBegins));
|
this._onDidStateChange.fire(IProblemCollectorEvent.create(ProblemCollectorEventKind.BackgroundProcessingBegins));
|
||||||
this.recordResourcesToClean(background.matcher.owner);
|
this.recordResourcesToClean(background.matcher.owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -496,7 +496,7 @@ export class WatchingProblemCollector extends AbstractProblemCollector implement
|
||||||
result = true;
|
result = true;
|
||||||
this.lines = [];
|
this.lines = [];
|
||||||
this.lines.push(line);
|
this.lines.push(line);
|
||||||
this._onDidStateChange.fire(ProblemCollectorEvent.create(ProblemCollectorEventKind.BackgroundProcessingBegins));
|
this._onDidStateChange.fire(IProblemCollectorEvent.create(ProblemCollectorEventKind.BackgroundProcessingBegins));
|
||||||
this.cleanMarkerCaches();
|
this.cleanMarkerCaches();
|
||||||
this.resetCurrentResource();
|
this.resetCurrentResource();
|
||||||
let owner = background.matcher.owner;
|
let owner = background.matcher.owner;
|
||||||
|
@ -520,7 +520,7 @@ export class WatchingProblemCollector extends AbstractProblemCollector implement
|
||||||
if (this._activeBackgroundMatchers.has(background.key)) {
|
if (this._activeBackgroundMatchers.has(background.key)) {
|
||||||
this._activeBackgroundMatchers.delete(background.key);
|
this._activeBackgroundMatchers.delete(background.key);
|
||||||
this.resetCurrentResource();
|
this.resetCurrentResource();
|
||||||
this._onDidStateChange.fire(ProblemCollectorEvent.create(ProblemCollectorEventKind.BackgroundProcessingEnds));
|
this._onDidStateChange.fire(IProblemCollectorEvent.create(ProblemCollectorEventKind.BackgroundProcessingEnds));
|
||||||
result = true;
|
result = true;
|
||||||
this.lines.push(line);
|
this.lines.push(line);
|
||||||
let owner = background.matcher.owner;
|
let owner = background.matcher.owner;
|
||||||
|
|
|
@ -63,7 +63,7 @@ export module ProblemLocationKind {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProblemPattern {
|
export interface IProblemPattern {
|
||||||
regexp: RegExp;
|
regexp: RegExp;
|
||||||
|
|
||||||
kind?: ProblemLocationKind;
|
kind?: ProblemLocationKind;
|
||||||
|
@ -89,21 +89,21 @@ export interface ProblemPattern {
|
||||||
loop?: boolean;
|
loop?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NamedProblemPattern extends ProblemPattern {
|
export interface INamedProblemPattern extends IProblemPattern {
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MultiLineProblemPattern = ProblemPattern[];
|
export type MultiLineProblemPattern = IProblemPattern[];
|
||||||
|
|
||||||
export interface WatchingPattern {
|
export interface IWatchingPattern {
|
||||||
regexp: RegExp;
|
regexp: RegExp;
|
||||||
file?: number;
|
file?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WatchingMatcher {
|
export interface IWatchingMatcher {
|
||||||
activeOnStart: boolean;
|
activeOnStart: boolean;
|
||||||
beginsPattern: WatchingPattern;
|
beginsPattern: IWatchingPattern;
|
||||||
endsPattern: WatchingPattern;
|
endsPattern: IWatchingPattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum ApplyToKind {
|
export enum ApplyToKind {
|
||||||
|
@ -133,36 +133,36 @@ export interface ProblemMatcher {
|
||||||
applyTo: ApplyToKind;
|
applyTo: ApplyToKind;
|
||||||
fileLocation: FileLocationKind;
|
fileLocation: FileLocationKind;
|
||||||
filePrefix?: string;
|
filePrefix?: string;
|
||||||
pattern: ProblemPattern | ProblemPattern[];
|
pattern: IProblemPattern | IProblemPattern[];
|
||||||
severity?: Severity;
|
severity?: Severity;
|
||||||
watching?: WatchingMatcher;
|
watching?: IWatchingMatcher;
|
||||||
uriProvider?: (path: string) => URI;
|
uriProvider?: (path: string) => URI;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NamedProblemMatcher extends ProblemMatcher {
|
export interface INamedProblemMatcher extends ProblemMatcher {
|
||||||
name: string;
|
name: string;
|
||||||
label: string;
|
label: string;
|
||||||
deprecated?: boolean;
|
deprecated?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NamedMultiLineProblemPattern {
|
export interface INamedMultiLineProblemPattern {
|
||||||
name: string;
|
name: string;
|
||||||
label: string;
|
label: string;
|
||||||
patterns: MultiLineProblemPattern;
|
patterns: MultiLineProblemPattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isNamedProblemMatcher(value: ProblemMatcher | undefined): value is NamedProblemMatcher {
|
export function isNamedProblemMatcher(value: ProblemMatcher | undefined): value is INamedProblemMatcher {
|
||||||
return value && Types.isString((<NamedProblemMatcher>value).name) ? true : false;
|
return value && Types.isString((<INamedProblemMatcher>value).name) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Location {
|
interface ILocation {
|
||||||
startLineNumber: number;
|
startLineNumber: number;
|
||||||
startCharacter: number;
|
startCharacter: number;
|
||||||
endLineNumber: number;
|
endLineNumber: number;
|
||||||
endCharacter: number;
|
endCharacter: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ProblemData {
|
interface IProblemData {
|
||||||
kind?: ProblemLocationKind;
|
kind?: ProblemLocationKind;
|
||||||
file?: string;
|
file?: string;
|
||||||
location?: string;
|
location?: string;
|
||||||
|
@ -175,14 +175,14 @@ interface ProblemData {
|
||||||
code?: string;
|
code?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProblemMatch {
|
export interface IProblemMatch {
|
||||||
resource: Promise<URI>;
|
resource: Promise<URI>;
|
||||||
marker: IMarkerData;
|
marker: IMarkerData;
|
||||||
description: ProblemMatcher;
|
description: ProblemMatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface HandleResult {
|
export interface IHandleResult {
|
||||||
match: ProblemMatch | null;
|
match: IProblemMatch | null;
|
||||||
continue: boolean;
|
continue: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,8 +230,8 @@ export async function getResource(filename: string, matcher: ProblemMatcher, fil
|
||||||
|
|
||||||
export interface ILineMatcher {
|
export interface ILineMatcher {
|
||||||
matchLength: number;
|
matchLength: number;
|
||||||
next(line: string): ProblemMatch | null;
|
next(line: string): IProblemMatch | null;
|
||||||
handle(lines: string[], start?: number): HandleResult;
|
handle(lines: string[], start?: number): IHandleResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createLineMatcher(matcher: ProblemMatcher, fileService?: IFileService): ILineMatcher {
|
export function createLineMatcher(matcher: ProblemMatcher, fileService?: IFileService): ILineMatcher {
|
||||||
|
@ -254,17 +254,17 @@ abstract class AbstractLineMatcher implements ILineMatcher {
|
||||||
this.fileService = fileService;
|
this.fileService = fileService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public handle(lines: string[], start: number = 0): HandleResult {
|
public handle(lines: string[], start: number = 0): IHandleResult {
|
||||||
return { match: null, continue: false };
|
return { match: null, continue: false };
|
||||||
}
|
}
|
||||||
|
|
||||||
public next(line: string): ProblemMatch | null {
|
public next(line: string): IProblemMatch | null {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract get matchLength(): number;
|
public abstract get matchLength(): number;
|
||||||
|
|
||||||
protected fillProblemData(data: ProblemData | undefined, pattern: ProblemPattern, matches: RegExpExecArray): data is ProblemData {
|
protected fillProblemData(data: IProblemData | undefined, pattern: IProblemPattern, matches: RegExpExecArray): data is IProblemData {
|
||||||
if (data) {
|
if (data) {
|
||||||
this.fillProperty(data, 'file', pattern, matches, true);
|
this.fillProperty(data, 'file', pattern, matches, true);
|
||||||
this.appendProperty(data, 'message', pattern, matches, true);
|
this.appendProperty(data, 'message', pattern, matches, true);
|
||||||
|
@ -281,7 +281,7 @@ abstract class AbstractLineMatcher implements ILineMatcher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private appendProperty(data: ProblemData, property: keyof ProblemData, pattern: ProblemPattern, matches: RegExpExecArray, trim: boolean = false): void {
|
private appendProperty(data: IProblemData, property: keyof IProblemData, pattern: IProblemPattern, matches: RegExpExecArray, trim: boolean = false): void {
|
||||||
const patternProperty = pattern[property];
|
const patternProperty = pattern[property];
|
||||||
if (Types.isUndefined(data[property])) {
|
if (Types.isUndefined(data[property])) {
|
||||||
this.fillProperty(data, property, pattern, matches, trim);
|
this.fillProperty(data, property, pattern, matches, trim);
|
||||||
|
@ -295,7 +295,7 @@ abstract class AbstractLineMatcher implements ILineMatcher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fillProperty(data: ProblemData, property: keyof ProblemData, pattern: ProblemPattern, matches: RegExpExecArray, trim: boolean = false): void {
|
private fillProperty(data: IProblemData, property: keyof IProblemData, pattern: IProblemPattern, matches: RegExpExecArray, trim: boolean = false): void {
|
||||||
const patternAtProperty = pattern[property];
|
const patternAtProperty = pattern[property];
|
||||||
if (Types.isUndefined(data[property]) && !Types.isUndefined(patternAtProperty) && patternAtProperty < matches.length) {
|
if (Types.isUndefined(data[property]) && !Types.isUndefined(patternAtProperty) && patternAtProperty < matches.length) {
|
||||||
let value = matches[patternAtProperty];
|
let value = matches[patternAtProperty];
|
||||||
|
@ -308,7 +308,7 @@ abstract class AbstractLineMatcher implements ILineMatcher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getMarkerMatch(data: ProblemData): ProblemMatch | undefined {
|
protected getMarkerMatch(data: IProblemData): IProblemMatch | undefined {
|
||||||
try {
|
try {
|
||||||
let location = this.getLocation(data);
|
let location = this.getLocation(data);
|
||||||
if (data.file && location && data.message) {
|
if (data.file && location && data.message) {
|
||||||
|
@ -342,7 +342,7 @@ abstract class AbstractLineMatcher implements ILineMatcher {
|
||||||
return getResource(filename, this.matcher, this.fileService);
|
return getResource(filename, this.matcher, this.fileService);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getLocation(data: ProblemData): Location | null {
|
private getLocation(data: IProblemData): ILocation | null {
|
||||||
if (data.kind === ProblemLocationKind.File) {
|
if (data.kind === ProblemLocationKind.File) {
|
||||||
return this.createLocation(0, 0, 0, 0);
|
return this.createLocation(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -359,7 +359,7 @@ abstract class AbstractLineMatcher implements ILineMatcher {
|
||||||
return this.createLocation(startLine, startColumn, endLine, endColumn);
|
return this.createLocation(startLine, startColumn, endLine, endColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
private parseLocationInfo(value: string): Location | null {
|
private parseLocationInfo(value: string): ILocation | null {
|
||||||
if (!value || !value.match(/(\d+|\d+,\d+|\d+,\d+,\d+,\d+)/)) {
|
if (!value || !value.match(/(\d+|\d+,\d+|\d+,\d+,\d+,\d+)/)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -373,7 +373,7 @@ abstract class AbstractLineMatcher implements ILineMatcher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private createLocation(startLine: number, startColumn: number | undefined, endLine: number | undefined, endColumn: number | undefined): Location {
|
private createLocation(startLine: number, startColumn: number | undefined, endLine: number | undefined, endColumn: number | undefined): ILocation {
|
||||||
if (startColumn !== undefined && endColumn !== undefined) {
|
if (startColumn !== undefined && endColumn !== undefined) {
|
||||||
return { startLineNumber: startLine, startCharacter: startColumn, endLineNumber: endLine || startLine, endCharacter: endColumn };
|
return { startLineNumber: startLine, startCharacter: startColumn, endLineNumber: endLine || startLine, endCharacter: endColumn };
|
||||||
}
|
}
|
||||||
|
@ -383,7 +383,7 @@ abstract class AbstractLineMatcher implements ILineMatcher {
|
||||||
return { startLineNumber: startLine, startCharacter: 1, endLineNumber: startLine, endCharacter: 2 ** 31 - 1 }; // See https://github.com/microsoft/vscode/issues/80288#issuecomment-650636442 for discussion
|
return { startLineNumber: startLine, startCharacter: 1, endLineNumber: startLine, endCharacter: 2 ** 31 - 1 }; // See https://github.com/microsoft/vscode/issues/80288#issuecomment-650636442 for discussion
|
||||||
}
|
}
|
||||||
|
|
||||||
private getSeverity(data: ProblemData): MarkerSeverity {
|
private getSeverity(data: IProblemData): MarkerSeverity {
|
||||||
let result: Severity | null = null;
|
let result: Severity | null = null;
|
||||||
if (data.severity) {
|
if (data.severity) {
|
||||||
let value = data.severity;
|
let value = data.severity;
|
||||||
|
@ -413,20 +413,20 @@ abstract class AbstractLineMatcher implements ILineMatcher {
|
||||||
|
|
||||||
class SingleLineMatcher extends AbstractLineMatcher {
|
class SingleLineMatcher extends AbstractLineMatcher {
|
||||||
|
|
||||||
private pattern: ProblemPattern;
|
private pattern: IProblemPattern;
|
||||||
|
|
||||||
constructor(matcher: ProblemMatcher, fileService?: IFileService) {
|
constructor(matcher: ProblemMatcher, fileService?: IFileService) {
|
||||||
super(matcher, fileService);
|
super(matcher, fileService);
|
||||||
this.pattern = <ProblemPattern>matcher.pattern;
|
this.pattern = <IProblemPattern>matcher.pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get matchLength(): number {
|
public get matchLength(): number {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override handle(lines: string[], start: number = 0): HandleResult {
|
public override handle(lines: string[], start: number = 0): IHandleResult {
|
||||||
Assert.ok(lines.length - start === 1);
|
Assert.ok(lines.length - start === 1);
|
||||||
let data: ProblemData = Object.create(null);
|
let data: IProblemData = Object.create(null);
|
||||||
if (this.pattern.kind !== undefined) {
|
if (this.pattern.kind !== undefined) {
|
||||||
data.kind = this.pattern.kind;
|
data.kind = this.pattern.kind;
|
||||||
}
|
}
|
||||||
|
@ -441,26 +441,26 @@ class SingleLineMatcher extends AbstractLineMatcher {
|
||||||
return { match: null, continue: false };
|
return { match: null, continue: false };
|
||||||
}
|
}
|
||||||
|
|
||||||
public override next(line: string): ProblemMatch | null {
|
public override next(line: string): IProblemMatch | null {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MultiLineMatcher extends AbstractLineMatcher {
|
class MultiLineMatcher extends AbstractLineMatcher {
|
||||||
|
|
||||||
private patterns: ProblemPattern[];
|
private patterns: IProblemPattern[];
|
||||||
private data: ProblemData | undefined;
|
private data: IProblemData | undefined;
|
||||||
|
|
||||||
constructor(matcher: ProblemMatcher, fileService?: IFileService) {
|
constructor(matcher: ProblemMatcher, fileService?: IFileService) {
|
||||||
super(matcher, fileService);
|
super(matcher, fileService);
|
||||||
this.patterns = <ProblemPattern[]>matcher.pattern;
|
this.patterns = <IProblemPattern[]>matcher.pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get matchLength(): number {
|
public get matchLength(): number {
|
||||||
return this.patterns.length;
|
return this.patterns.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override handle(lines: string[], start: number = 0): HandleResult {
|
public override handle(lines: string[], start: number = 0): IHandleResult {
|
||||||
Assert.ok(lines.length - start === this.patterns.length);
|
Assert.ok(lines.length - start === this.patterns.length);
|
||||||
this.data = Object.create(null);
|
this.data = Object.create(null);
|
||||||
let data = this.data!;
|
let data = this.data!;
|
||||||
|
@ -486,7 +486,7 @@ class MultiLineMatcher extends AbstractLineMatcher {
|
||||||
return { match: markerMatch ? markerMatch : null, continue: loop };
|
return { match: markerMatch ? markerMatch : null, continue: loop };
|
||||||
}
|
}
|
||||||
|
|
||||||
public override next(line: string): ProblemMatch | null {
|
public override next(line: string): IProblemMatch | null {
|
||||||
let pattern = this.patterns[this.patterns.length - 1];
|
let pattern = this.patterns[this.patterns.length - 1];
|
||||||
Assert.ok(pattern.loop === true && this.data !== null);
|
Assert.ok(pattern.loop === true && this.data !== null);
|
||||||
let matches = pattern.regexp.exec(line);
|
let matches = pattern.regexp.exec(line);
|
||||||
|
@ -495,7 +495,7 @@ class MultiLineMatcher extends AbstractLineMatcher {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
let data = Objects.deepClone(this.data);
|
let data = Objects.deepClone(this.data);
|
||||||
let problemMatch: ProblemMatch | undefined;
|
let problemMatch: IProblemMatch | undefined;
|
||||||
if (this.fillProblemData(data, pattern, matches)) {
|
if (this.fillProblemData(data, pattern, matches)) {
|
||||||
problemMatch = this.getMarkerMatch(data);
|
problemMatch = this.getMarkerMatch(data);
|
||||||
}
|
}
|
||||||
|
@ -505,7 +505,7 @@ class MultiLineMatcher extends AbstractLineMatcher {
|
||||||
|
|
||||||
export namespace Config {
|
export namespace Config {
|
||||||
|
|
||||||
export interface ProblemPattern {
|
export interface IProblemPattern {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The regular expression to find a problem in the console output of an
|
* The regular expression to find a problem in the console output of an
|
||||||
|
@ -591,7 +591,7 @@ export namespace Config {
|
||||||
loop?: boolean;
|
loop?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CheckedProblemPattern extends ProblemPattern {
|
export interface ICheckedProblemPattern extends IProblemPattern {
|
||||||
/**
|
/**
|
||||||
* The regular expression to find a problem in the console output of an
|
* The regular expression to find a problem in the console output of an
|
||||||
* executed task.
|
* executed task.
|
||||||
|
@ -600,13 +600,13 @@ export namespace Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace CheckedProblemPattern {
|
export namespace CheckedProblemPattern {
|
||||||
export function is(value: any): value is CheckedProblemPattern {
|
export function is(value: any): value is ICheckedProblemPattern {
|
||||||
let candidate: ProblemPattern = value as ProblemPattern;
|
let candidate: IProblemPattern = value as IProblemPattern;
|
||||||
return candidate && Types.isString(candidate.regexp);
|
return candidate && Types.isString(candidate.regexp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NamedProblemPattern extends ProblemPattern {
|
export interface INamedProblemPattern extends IProblemPattern {
|
||||||
/**
|
/**
|
||||||
* The name of the problem pattern.
|
* The name of the problem pattern.
|
||||||
*/
|
*/
|
||||||
|
@ -619,13 +619,13 @@ export namespace Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace NamedProblemPattern {
|
export namespace NamedProblemPattern {
|
||||||
export function is(value: any): value is NamedProblemPattern {
|
export function is(value: any): value is INamedProblemPattern {
|
||||||
let candidate: NamedProblemPattern = value as NamedProblemPattern;
|
let candidate: INamedProblemPattern = value as INamedProblemPattern;
|
||||||
return candidate && Types.isString(candidate.name);
|
return candidate && Types.isString(candidate.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NamedCheckedProblemPattern extends NamedProblemPattern {
|
export interface INamedCheckedProblemPattern extends INamedProblemPattern {
|
||||||
/**
|
/**
|
||||||
* The regular expression to find a problem in the console output of an
|
* The regular expression to find a problem in the console output of an
|
||||||
* executed task.
|
* executed task.
|
||||||
|
@ -634,13 +634,13 @@ export namespace Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace NamedCheckedProblemPattern {
|
export namespace NamedCheckedProblemPattern {
|
||||||
export function is(value: any): value is NamedCheckedProblemPattern {
|
export function is(value: any): value is INamedCheckedProblemPattern {
|
||||||
let candidate: NamedProblemPattern = value as NamedProblemPattern;
|
let candidate: INamedProblemPattern = value as INamedProblemPattern;
|
||||||
return candidate && NamedProblemPattern.is(candidate) && Types.isString(candidate.regexp);
|
return candidate && NamedProblemPattern.is(candidate) && Types.isString(candidate.regexp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MultiLineProblemPattern = ProblemPattern[];
|
export type MultiLineProblemPattern = IProblemPattern[];
|
||||||
|
|
||||||
export namespace MultiLineProblemPattern {
|
export namespace MultiLineProblemPattern {
|
||||||
export function is(value: any): value is MultiLineProblemPattern {
|
export function is(value: any): value is MultiLineProblemPattern {
|
||||||
|
@ -648,7 +648,7 @@ export namespace Config {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MultiLineCheckedProblemPattern = CheckedProblemPattern[];
|
export type MultiLineCheckedProblemPattern = ICheckedProblemPattern[];
|
||||||
|
|
||||||
export namespace MultiLineCheckedProblemPattern {
|
export namespace MultiLineCheckedProblemPattern {
|
||||||
export function is(value: any): value is MultiLineCheckedProblemPattern {
|
export function is(value: any): value is MultiLineCheckedProblemPattern {
|
||||||
|
@ -664,7 +664,7 @@ export namespace Config {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NamedMultiLineCheckedProblemPattern {
|
export interface INamedMultiLineCheckedProblemPattern {
|
||||||
/**
|
/**
|
||||||
* The name of the problem pattern.
|
* The name of the problem pattern.
|
||||||
*/
|
*/
|
||||||
|
@ -682,18 +682,18 @@ export namespace Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace NamedMultiLineCheckedProblemPattern {
|
export namespace NamedMultiLineCheckedProblemPattern {
|
||||||
export function is(value: any): value is NamedMultiLineCheckedProblemPattern {
|
export function is(value: any): value is INamedMultiLineCheckedProblemPattern {
|
||||||
let candidate = value as NamedMultiLineCheckedProblemPattern;
|
let candidate = value as INamedMultiLineCheckedProblemPattern;
|
||||||
return candidate && Types.isString(candidate.name) && Types.isArray(candidate.patterns) && MultiLineCheckedProblemPattern.is(candidate.patterns);
|
return candidate && Types.isString(candidate.name) && Types.isArray(candidate.patterns) && MultiLineCheckedProblemPattern.is(candidate.patterns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type NamedProblemPatterns = (Config.NamedProblemPattern | Config.NamedMultiLineCheckedProblemPattern)[];
|
export type NamedProblemPatterns = (Config.INamedProblemPattern | Config.INamedMultiLineCheckedProblemPattern)[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A watching pattern
|
* A watching pattern
|
||||||
*/
|
*/
|
||||||
export interface WatchingPattern {
|
export interface IWatchingPattern {
|
||||||
/**
|
/**
|
||||||
* The actual regular expression
|
* The actual regular expression
|
||||||
*/
|
*/
|
||||||
|
@ -709,7 +709,7 @@ export namespace Config {
|
||||||
/**
|
/**
|
||||||
* A description to track the start and end of a watching task.
|
* A description to track the start and end of a watching task.
|
||||||
*/
|
*/
|
||||||
export interface BackgroundMonitor {
|
export interface IBackgroundMonitor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If set to true the watcher is in active mode when the task
|
* If set to true the watcher is in active mode when the task
|
||||||
|
@ -721,12 +721,12 @@ export namespace Config {
|
||||||
/**
|
/**
|
||||||
* If matched in the output the start of a watching task is signaled.
|
* If matched in the output the start of a watching task is signaled.
|
||||||
*/
|
*/
|
||||||
beginsPattern?: string | WatchingPattern;
|
beginsPattern?: string | IWatchingPattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If matched in the output the end of a watching task is signaled.
|
* If matched in the output the end of a watching task is signaled.
|
||||||
*/
|
*/
|
||||||
endsPattern?: string | WatchingPattern;
|
endsPattern?: string | IWatchingPattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -804,7 +804,7 @@ export namespace Config {
|
||||||
* of a problem pattern or an array of problem patterns to match
|
* of a problem pattern or an array of problem patterns to match
|
||||||
* problems spread over multiple lines.
|
* problems spread over multiple lines.
|
||||||
*/
|
*/
|
||||||
pattern?: string | ProblemPattern | ProblemPattern[];
|
pattern?: string | IProblemPattern | IProblemPattern[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A regular expression signaling that a watched tasks begins executing
|
* A regular expression signaling that a watched tasks begins executing
|
||||||
|
@ -820,13 +820,13 @@ export namespace Config {
|
||||||
/**
|
/**
|
||||||
* @deprecated Use background instead.
|
* @deprecated Use background instead.
|
||||||
*/
|
*/
|
||||||
watching?: BackgroundMonitor;
|
watching?: IBackgroundMonitor;
|
||||||
background?: BackgroundMonitor;
|
background?: IBackgroundMonitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ProblemMatcherType = string | ProblemMatcher | Array<string | ProblemMatcher>;
|
export type ProblemMatcherType = string | ProblemMatcher | Array<string | ProblemMatcher>;
|
||||||
|
|
||||||
export interface NamedProblemMatcher extends ProblemMatcher {
|
export interface INamedProblemMatcher extends ProblemMatcher {
|
||||||
/**
|
/**
|
||||||
* This name can be used to refer to the
|
* This name can be used to refer to the
|
||||||
* problem matcher from within a task.
|
* problem matcher from within a task.
|
||||||
|
@ -839,8 +839,8 @@ export namespace Config {
|
||||||
label?: string;
|
label?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isNamedProblemMatcher(value: ProblemMatcher): value is NamedProblemMatcher {
|
export function isNamedProblemMatcher(value: ProblemMatcher): value is INamedProblemMatcher {
|
||||||
return Types.isString((<NamedProblemMatcher>value).name);
|
return Types.isString((<INamedProblemMatcher>value).name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -850,17 +850,17 @@ export class ProblemPatternParser extends Parser {
|
||||||
super(logger);
|
super(logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
public parse(value: Config.ProblemPattern): ProblemPattern;
|
public parse(value: Config.IProblemPattern): IProblemPattern;
|
||||||
public parse(value: Config.MultiLineProblemPattern): MultiLineProblemPattern;
|
public parse(value: Config.MultiLineProblemPattern): MultiLineProblemPattern;
|
||||||
public parse(value: Config.NamedProblemPattern): NamedProblemPattern;
|
public parse(value: Config.INamedProblemPattern): INamedProblemPattern;
|
||||||
public parse(value: Config.NamedMultiLineCheckedProblemPattern): NamedMultiLineProblemPattern;
|
public parse(value: Config.INamedMultiLineCheckedProblemPattern): INamedMultiLineProblemPattern;
|
||||||
public parse(value: Config.ProblemPattern | Config.MultiLineProblemPattern | Config.NamedProblemPattern | Config.NamedMultiLineCheckedProblemPattern): any {
|
public parse(value: Config.IProblemPattern | Config.MultiLineProblemPattern | Config.INamedProblemPattern | Config.INamedMultiLineCheckedProblemPattern): any {
|
||||||
if (Config.NamedMultiLineCheckedProblemPattern.is(value)) {
|
if (Config.NamedMultiLineCheckedProblemPattern.is(value)) {
|
||||||
return this.createNamedMultiLineProblemPattern(value);
|
return this.createNamedMultiLineProblemPattern(value);
|
||||||
} else if (Config.MultiLineCheckedProblemPattern.is(value)) {
|
} else if (Config.MultiLineCheckedProblemPattern.is(value)) {
|
||||||
return this.createMultiLineProblemPattern(value);
|
return this.createMultiLineProblemPattern(value);
|
||||||
} else if (Config.NamedCheckedProblemPattern.is(value)) {
|
} else if (Config.NamedCheckedProblemPattern.is(value)) {
|
||||||
let result = this.createSingleProblemPattern(value) as NamedProblemPattern;
|
let result = this.createSingleProblemPattern(value) as INamedProblemPattern;
|
||||||
result.name = value.name;
|
result.name = value.name;
|
||||||
return result;
|
return result;
|
||||||
} else if (Config.CheckedProblemPattern.is(value)) {
|
} else if (Config.CheckedProblemPattern.is(value)) {
|
||||||
|
@ -871,7 +871,7 @@ export class ProblemPatternParser extends Parser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private createSingleProblemPattern(value: Config.CheckedProblemPattern): ProblemPattern | null {
|
private createSingleProblemPattern(value: Config.ICheckedProblemPattern): IProblemPattern | null {
|
||||||
let result = this.doCreateSingleProblemPattern(value, true);
|
let result = this.doCreateSingleProblemPattern(value, true);
|
||||||
if (result === undefined) {
|
if (result === undefined) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -881,7 +881,7 @@ export class ProblemPatternParser extends Parser {
|
||||||
return this.validateProblemPattern([result]) ? result : null;
|
return this.validateProblemPattern([result]) ? result : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private createNamedMultiLineProblemPattern(value: Config.NamedMultiLineCheckedProblemPattern): NamedMultiLineProblemPattern | null {
|
private createNamedMultiLineProblemPattern(value: Config.INamedMultiLineCheckedProblemPattern): INamedMultiLineProblemPattern | null {
|
||||||
const validPatterns = this.createMultiLineProblemPattern(value.patterns);
|
const validPatterns = this.createMultiLineProblemPattern(value.patterns);
|
||||||
if (!validPatterns) {
|
if (!validPatterns) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -915,17 +915,17 @@ export class ProblemPatternParser extends Parser {
|
||||||
return this.validateProblemPattern(result) ? result : null;
|
return this.validateProblemPattern(result) ? result : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private doCreateSingleProblemPattern(value: Config.CheckedProblemPattern, setDefaults: boolean): ProblemPattern | undefined {
|
private doCreateSingleProblemPattern(value: Config.ICheckedProblemPattern, setDefaults: boolean): IProblemPattern | undefined {
|
||||||
const regexp = this.createRegularExpression(value.regexp);
|
const regexp = this.createRegularExpression(value.regexp);
|
||||||
if (regexp === undefined) {
|
if (regexp === undefined) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
let result: ProblemPattern = { regexp };
|
let result: IProblemPattern = { regexp };
|
||||||
if (value.kind) {
|
if (value.kind) {
|
||||||
result.kind = ProblemLocationKind.fromString(value.kind);
|
result.kind = ProblemLocationKind.fromString(value.kind);
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyProperty(result: ProblemPattern, source: Config.ProblemPattern, resultKey: keyof ProblemPattern, sourceKey: keyof Config.ProblemPattern) {
|
function copyProperty(result: IProblemPattern, source: Config.IProblemPattern, resultKey: keyof IProblemPattern, sourceKey: keyof Config.IProblemPattern) {
|
||||||
const value = source[sourceKey];
|
const value = source[sourceKey];
|
||||||
if (typeof value === 'number') {
|
if (typeof value === 'number') {
|
||||||
(result as any)[resultKey] = value;
|
(result as any)[resultKey] = value;
|
||||||
|
@ -945,13 +945,13 @@ export class ProblemPatternParser extends Parser {
|
||||||
}
|
}
|
||||||
if (setDefaults) {
|
if (setDefaults) {
|
||||||
if (result.location || result.kind === ProblemLocationKind.File) {
|
if (result.location || result.kind === ProblemLocationKind.File) {
|
||||||
let defaultValue: Partial<ProblemPattern> = {
|
let defaultValue: Partial<IProblemPattern> = {
|
||||||
file: 1,
|
file: 1,
|
||||||
message: 0
|
message: 0
|
||||||
};
|
};
|
||||||
result = Objects.mixin(result, defaultValue, false);
|
result = Objects.mixin(result, defaultValue, false);
|
||||||
} else {
|
} else {
|
||||||
let defaultValue: Partial<ProblemPattern> = {
|
let defaultValue: Partial<IProblemPattern> = {
|
||||||
file: 1,
|
file: 1,
|
||||||
line: 2,
|
line: 2,
|
||||||
character: 3,
|
character: 3,
|
||||||
|
@ -963,7 +963,7 @@ export class ProblemPatternParser extends Parser {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private validateProblemPattern(values: ProblemPattern[]): boolean {
|
private validateProblemPattern(values: IProblemPattern[]): boolean {
|
||||||
let file: boolean = false, message: boolean = false, location: boolean = false, line: boolean = false;
|
let file: boolean = false, message: boolean = false, location: boolean = false, line: boolean = false;
|
||||||
let locationKind = (values[0].kind === undefined) ? ProblemLocationKind.Location : values[0].kind;
|
let locationKind = (values[0].kind === undefined) ? ProblemLocationKind.Location : values[0].kind;
|
||||||
|
|
||||||
|
@ -1136,12 +1136,12 @@ const problemPatternExtPoint = ExtensionsRegistry.registerExtensionPoint<Config.
|
||||||
export interface IProblemPatternRegistry {
|
export interface IProblemPatternRegistry {
|
||||||
onReady(): Promise<void>;
|
onReady(): Promise<void>;
|
||||||
|
|
||||||
get(key: string): ProblemPattern | MultiLineProblemPattern;
|
get(key: string): IProblemPattern | MultiLineProblemPattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ProblemPatternRegistryImpl implements IProblemPatternRegistry {
|
class ProblemPatternRegistryImpl implements IProblemPatternRegistry {
|
||||||
|
|
||||||
private patterns: IStringDictionary<ProblemPattern | ProblemPattern[]>;
|
private patterns: IStringDictionary<IProblemPattern | IProblemPattern[]>;
|
||||||
private readyPromise: Promise<void>;
|
private readyPromise: Promise<void>;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -1196,11 +1196,11 @@ class ProblemPatternRegistryImpl implements IProblemPatternRegistry {
|
||||||
return this.readyPromise;
|
return this.readyPromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
public add(key: string, value: ProblemPattern | ProblemPattern[]): void {
|
public add(key: string, value: IProblemPattern | IProblemPattern[]): void {
|
||||||
this.patterns[key] = value;
|
this.patterns[key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get(key: string): ProblemPattern | ProblemPattern[] {
|
public get(key: string): IProblemPattern | IProblemPattern[] {
|
||||||
return this.patterns[key];
|
return this.patterns[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1447,13 +1447,13 @@ export class ProblemMatcherParser extends Parser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Config.isNamedProblemMatcher(description)) {
|
if (Config.isNamedProblemMatcher(description)) {
|
||||||
(result as NamedProblemMatcher).name = description.name;
|
(result as INamedProblemMatcher).name = description.name;
|
||||||
(result as NamedProblemMatcher).label = Types.isString(description.label) ? description.label : description.name;
|
(result as INamedProblemMatcher).label = Types.isString(description.label) ? description.label : description.name;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private createProblemPattern(value: string | Config.ProblemPattern | Config.MultiLineProblemPattern): ProblemPattern | ProblemPattern[] | null {
|
private createProblemPattern(value: string | Config.IProblemPattern | Config.MultiLineProblemPattern): IProblemPattern | IProblemPattern[] | null {
|
||||||
if (Types.isString(value)) {
|
if (Types.isString(value)) {
|
||||||
let variableName: string = <string>value;
|
let variableName: string = <string>value;
|
||||||
if (variableName.length > 1 && variableName[0] === '$') {
|
if (variableName.length > 1 && variableName[0] === '$') {
|
||||||
|
@ -1495,8 +1495,8 @@ export class ProblemMatcherParser extends Parser {
|
||||||
if (Types.isUndefinedOrNull(backgroundMonitor)) {
|
if (Types.isUndefinedOrNull(backgroundMonitor)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let begins: WatchingPattern | null = this.createWatchingPattern(backgroundMonitor.beginsPattern);
|
let begins: IWatchingPattern | null = this.createWatchingPattern(backgroundMonitor.beginsPattern);
|
||||||
let ends: WatchingPattern | null = this.createWatchingPattern(backgroundMonitor.endsPattern);
|
let ends: IWatchingPattern | null = this.createWatchingPattern(backgroundMonitor.endsPattern);
|
||||||
if (begins && ends) {
|
if (begins && ends) {
|
||||||
internal.watching = {
|
internal.watching = {
|
||||||
activeOnStart: Types.isBoolean(backgroundMonitor.activeOnStart) ? backgroundMonitor.activeOnStart : false,
|
activeOnStart: Types.isBoolean(backgroundMonitor.activeOnStart) ? backgroundMonitor.activeOnStart : false,
|
||||||
|
@ -1510,7 +1510,7 @@ export class ProblemMatcherParser extends Parser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private createWatchingPattern(external: string | Config.WatchingPattern | undefined): WatchingPattern | null {
|
private createWatchingPattern(external: string | Config.IWatchingPattern | undefined): IWatchingPattern | null {
|
||||||
if (Types.isUndefinedOrNull(external)) {
|
if (Types.isUndefinedOrNull(external)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1703,7 +1703,7 @@ export namespace Schemas {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const problemMatchersExtPoint = ExtensionsRegistry.registerExtensionPoint<Config.NamedProblemMatcher[]>({
|
const problemMatchersExtPoint = ExtensionsRegistry.registerExtensionPoint<Config.INamedProblemMatcher[]>({
|
||||||
extensionPoint: 'problemMatchers',
|
extensionPoint: 'problemMatchers',
|
||||||
deps: [problemPatternExtPoint],
|
deps: [problemPatternExtPoint],
|
||||||
jsonSchema: {
|
jsonSchema: {
|
||||||
|
@ -1715,14 +1715,14 @@ const problemMatchersExtPoint = ExtensionsRegistry.registerExtensionPoint<Config
|
||||||
|
|
||||||
export interface IProblemMatcherRegistry {
|
export interface IProblemMatcherRegistry {
|
||||||
onReady(): Promise<void>;
|
onReady(): Promise<void>;
|
||||||
get(name: string): NamedProblemMatcher;
|
get(name: string): INamedProblemMatcher;
|
||||||
keys(): string[];
|
keys(): string[];
|
||||||
readonly onMatcherChanged: Event<void>;
|
readonly onMatcherChanged: Event<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ProblemMatcherRegistryImpl implements IProblemMatcherRegistry {
|
class ProblemMatcherRegistryImpl implements IProblemMatcherRegistry {
|
||||||
|
|
||||||
private matchers: IStringDictionary<NamedProblemMatcher>;
|
private matchers: IStringDictionary<INamedProblemMatcher>;
|
||||||
private readyPromise: Promise<void>;
|
private readyPromise: Promise<void>;
|
||||||
private readonly _onMatchersChanged: Emitter<void> = new Emitter<void>();
|
private readonly _onMatchersChanged: Emitter<void> = new Emitter<void>();
|
||||||
public readonly onMatcherChanged: Event<void> = this._onMatchersChanged.event;
|
public readonly onMatcherChanged: Event<void> = this._onMatchersChanged.event;
|
||||||
|
@ -1771,11 +1771,11 @@ class ProblemMatcherRegistryImpl implements IProblemMatcherRegistry {
|
||||||
return this.readyPromise;
|
return this.readyPromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
public add(matcher: NamedProblemMatcher): void {
|
public add(matcher: INamedProblemMatcher): void {
|
||||||
this.matchers[matcher.name] = matcher;
|
this.matchers[matcher.name] = matcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get(name: string): NamedProblemMatcher {
|
public get(name: string): INamedProblemMatcher {
|
||||||
return this.matchers[name];
|
return this.matchers[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -47,14 +47,14 @@ const taskDefinitionSchema: IJSONSchema = {
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Configuration {
|
namespace Configuration {
|
||||||
export interface TaskDefinition {
|
export interface ITaskDefinition {
|
||||||
type?: string;
|
type?: string;
|
||||||
required?: string[];
|
required?: string[];
|
||||||
properties?: IJSONSchemaMap;
|
properties?: IJSONSchemaMap;
|
||||||
when?: string;
|
when?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function from(value: TaskDefinition, extensionId: ExtensionIdentifier, messageCollector: ExtensionMessageCollector): Tasks.TaskDefinition | undefined {
|
export function from(value: ITaskDefinition, extensionId: ExtensionIdentifier, messageCollector: ExtensionMessageCollector): Tasks.ITaskDefinition | undefined {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ namespace Configuration {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const taskDefinitionsExtPoint = ExtensionsRegistry.registerExtensionPoint<Configuration.TaskDefinition[]>({
|
const taskDefinitionsExtPoint = ExtensionsRegistry.registerExtensionPoint<Configuration.ITaskDefinition[]>({
|
||||||
extensionPoint: 'taskDefinitions',
|
extensionPoint: 'taskDefinitions',
|
||||||
jsonSchema: {
|
jsonSchema: {
|
||||||
description: nls.localize('TaskDefinitionExtPoint', 'Contributes task kinds'),
|
description: nls.localize('TaskDefinitionExtPoint', 'Contributes task kinds'),
|
||||||
|
@ -93,15 +93,15 @@ const taskDefinitionsExtPoint = ExtensionsRegistry.registerExtensionPoint<Config
|
||||||
export interface ITaskDefinitionRegistry {
|
export interface ITaskDefinitionRegistry {
|
||||||
onReady(): Promise<void>;
|
onReady(): Promise<void>;
|
||||||
|
|
||||||
get(key: string): Tasks.TaskDefinition;
|
get(key: string): Tasks.ITaskDefinition;
|
||||||
all(): Tasks.TaskDefinition[];
|
all(): Tasks.ITaskDefinition[];
|
||||||
getJsonSchema(): IJSONSchema;
|
getJsonSchema(): IJSONSchema;
|
||||||
onDefinitionsChanged: Event<void>;
|
onDefinitionsChanged: Event<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TaskDefinitionRegistryImpl implements ITaskDefinitionRegistry {
|
export class TaskDefinitionRegistryImpl implements ITaskDefinitionRegistry {
|
||||||
|
|
||||||
private taskTypes: IStringDictionary<Tasks.TaskDefinition>;
|
private taskTypes: IStringDictionary<Tasks.ITaskDefinition>;
|
||||||
private readyPromise: Promise<void>;
|
private readyPromise: Promise<void>;
|
||||||
private _schema: IJSONSchema | undefined;
|
private _schema: IJSONSchema | undefined;
|
||||||
private _onDefinitionsChanged: Emitter<void> = new Emitter();
|
private _onDefinitionsChanged: Emitter<void> = new Emitter();
|
||||||
|
@ -144,11 +144,11 @@ export class TaskDefinitionRegistryImpl implements ITaskDefinitionRegistry {
|
||||||
return this.readyPromise;
|
return this.readyPromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get(key: string): Tasks.TaskDefinition {
|
public get(key: string): Tasks.ITaskDefinition {
|
||||||
return this.taskTypes[key];
|
return this.taskTypes[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
public all(): Tasks.TaskDefinition[] {
|
public all(): Tasks.ITaskDefinition[] {
|
||||||
return Object.keys(this.taskTypes).map(key => this.taskTypes[key]);
|
return Object.keys(this.taskTypes).map(key => this.taskTypes[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,12 +10,12 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
|
||||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||||
|
|
||||||
import { IWorkspaceFolder, IWorkspace } from 'vs/platform/workspace/common/workspace';
|
import { IWorkspaceFolder, IWorkspace } from 'vs/platform/workspace/common/workspace';
|
||||||
import { Task, ContributedTask, CustomTask, TaskSet, TaskSorter, TaskEvent, TaskIdentifier, ConfiguringTask, TaskRunSource } from 'vs/workbench/contrib/tasks/common/tasks';
|
import { Task, ContributedTask, CustomTask, ITaskSet, TaskSorter, ITaskEvent, ITaskIdentifier, ConfiguringTask, TaskRunSource } from 'vs/workbench/contrib/tasks/common/tasks';
|
||||||
import { ITaskSummary, TaskTerminateResponse, TaskSystemInfo } from 'vs/workbench/contrib/tasks/common/taskSystem';
|
import { ITaskSummary, ITaskTerminateResponse, ITaskSystemInfo } from 'vs/workbench/contrib/tasks/common/taskSystem';
|
||||||
import { IStringDictionary } from 'vs/base/common/collections';
|
import { IStringDictionary } from 'vs/base/common/collections';
|
||||||
import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
|
import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||||
|
|
||||||
export { ITaskSummary, Task, TaskTerminateResponse };
|
export { ITaskSummary, Task, ITaskTerminateResponse as TaskTerminateResponse };
|
||||||
|
|
||||||
export const CustomExecutionSupportedContext = new RawContextKey<boolean>('customExecutionSupported', true, nls.localize('tasks.customExecutionSupported', "Whether CustomExecution tasks are supported. Consider using in the when clause of a \'taskDefinition\' contribution."));
|
export const CustomExecutionSupportedContext = new RawContextKey<boolean>('customExecutionSupported', true, nls.localize('tasks.customExecutionSupported', "Whether CustomExecution tasks are supported. Consider using in the when clause of a \'taskDefinition\' contribution."));
|
||||||
export const ShellExecutionSupportedContext = new RawContextKey<boolean>('shellExecutionSupported', false, nls.localize('tasks.shellExecutionSupported', "Whether ShellExecution tasks are supported. Consider using in the when clause of a \'taskDefinition\' contribution."));
|
export const ShellExecutionSupportedContext = new RawContextKey<boolean>('shellExecutionSupported', false, nls.localize('tasks.shellExecutionSupported', "Whether ShellExecution tasks are supported. Consider using in the when clause of a \'taskDefinition\' contribution."));
|
||||||
|
@ -24,57 +24,57 @@ export const ProcessExecutionSupportedContext = new RawContextKey<boolean>('proc
|
||||||
export const ITaskService = createDecorator<ITaskService>('taskService');
|
export const ITaskService = createDecorator<ITaskService>('taskService');
|
||||||
|
|
||||||
export interface ITaskProvider {
|
export interface ITaskProvider {
|
||||||
provideTasks(validTypes: IStringDictionary<boolean>): Promise<TaskSet>;
|
provideTasks(validTypes: IStringDictionary<boolean>): Promise<ITaskSet>;
|
||||||
resolveTask(task: ConfiguringTask): Promise<ContributedTask | undefined>;
|
resolveTask(task: ConfiguringTask): Promise<ContributedTask | undefined>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProblemMatcherRunOptions {
|
export interface IProblemMatcherRunOptions {
|
||||||
attachProblemMatcher?: boolean;
|
attachProblemMatcher?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CustomizationProperties {
|
export interface ICustomizationProperties {
|
||||||
group?: string | { kind?: string; isDefault?: boolean };
|
group?: string | { kind?: string; isDefault?: boolean };
|
||||||
problemMatcher?: string | string[];
|
problemMatcher?: string | string[];
|
||||||
isBackground?: boolean;
|
isBackground?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskFilter {
|
export interface ITaskFilter {
|
||||||
version?: string;
|
version?: string;
|
||||||
type?: string;
|
type?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface WorkspaceTaskResult {
|
interface IWorkspaceTaskResult {
|
||||||
set: TaskSet | undefined;
|
set: ITaskSet | undefined;
|
||||||
configurations: {
|
configurations: {
|
||||||
byIdentifier: IStringDictionary<ConfiguringTask>;
|
byIdentifier: IStringDictionary<ConfiguringTask>;
|
||||||
} | undefined;
|
} | undefined;
|
||||||
hasErrors: boolean;
|
hasErrors: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WorkspaceFolderTaskResult extends WorkspaceTaskResult {
|
export interface IWorkspaceFolderTaskResult extends IWorkspaceTaskResult {
|
||||||
workspaceFolder: IWorkspaceFolder;
|
workspaceFolder: IWorkspaceFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITaskService {
|
export interface ITaskService {
|
||||||
readonly _serviceBrand: undefined;
|
readonly _serviceBrand: undefined;
|
||||||
onDidStateChange: Event<TaskEvent>;
|
onDidStateChange: Event<ITaskEvent>;
|
||||||
supportsMultipleTaskExecutions: boolean;
|
supportsMultipleTaskExecutions: boolean;
|
||||||
|
|
||||||
configureAction(): Action;
|
configureAction(): Action;
|
||||||
run(task: Task | undefined, options?: ProblemMatcherRunOptions): Promise<ITaskSummary | undefined>;
|
run(task: Task | undefined, options?: IProblemMatcherRunOptions): Promise<ITaskSummary | undefined>;
|
||||||
inTerminal(): boolean;
|
inTerminal(): boolean;
|
||||||
getActiveTasks(): Promise<Task[]>;
|
getActiveTasks(): Promise<Task[]>;
|
||||||
getBusyTasks(): Promise<Task[]>;
|
getBusyTasks(): Promise<Task[]>;
|
||||||
terminate(task: Task): Promise<TaskTerminateResponse>;
|
terminate(task: Task): Promise<ITaskTerminateResponse>;
|
||||||
tasks(filter?: TaskFilter): Promise<Task[]>;
|
tasks(filter?: ITaskFilter): Promise<Task[]>;
|
||||||
taskTypes(): string[];
|
taskTypes(): string[];
|
||||||
getWorkspaceTasks(runSource?: TaskRunSource): Promise<Map<string, WorkspaceFolderTaskResult>>;
|
getWorkspaceTasks(runSource?: TaskRunSource): Promise<Map<string, IWorkspaceFolderTaskResult>>;
|
||||||
readRecentTasks(): Promise<(Task | ConfiguringTask)[]>;
|
readRecentTasks(): Promise<(Task | ConfiguringTask)[]>;
|
||||||
removeRecentlyUsedTask(taskRecentlyUsedKey: string): void;
|
removeRecentlyUsedTask(taskRecentlyUsedKey: string): void;
|
||||||
/**
|
/**
|
||||||
* @param alias The task's name, label or defined identifier.
|
* @param alias The task's name, label or defined identifier.
|
||||||
*/
|
*/
|
||||||
getTask(workspaceFolder: IWorkspace | IWorkspaceFolder | string, alias: string | TaskIdentifier, compareId?: boolean): Promise<Task | undefined>;
|
getTask(workspaceFolder: IWorkspace | IWorkspaceFolder | string, alias: string | ITaskIdentifier, compareId?: boolean): Promise<Task | undefined>;
|
||||||
tryResolveTask(configuringTask: ConfiguringTask): Promise<Task | undefined>;
|
tryResolveTask(configuringTask: ConfiguringTask): Promise<Task | undefined>;
|
||||||
createSorter(): TaskSorter;
|
createSorter(): TaskSorter;
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ export interface ITaskService {
|
||||||
|
|
||||||
registerTaskProvider(taskProvider: ITaskProvider, type: string): IDisposable;
|
registerTaskProvider(taskProvider: ITaskProvider, type: string): IDisposable;
|
||||||
|
|
||||||
registerTaskSystem(scheme: string, taskSystemInfo: TaskSystemInfo): void;
|
registerTaskSystem(scheme: string, taskSystemInfo: ITaskSystemInfo): void;
|
||||||
onDidChangeTaskSystemInfo: Event<void>;
|
onDidChangeTaskSystemInfo: Event<void>;
|
||||||
readonly hasTaskSystemInfo: boolean;
|
readonly hasTaskSystemInfo: boolean;
|
||||||
registerSupportedExecutions(custom?: boolean, shell?: boolean, process?: boolean): void;
|
registerSupportedExecutions(custom?: boolean, shell?: boolean, process?: boolean): void;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { TerminateResponse } from 'vs/base/common/processes';
|
||||||
import { Event } from 'vs/base/common/event';
|
import { Event } from 'vs/base/common/event';
|
||||||
import { Platform } from 'vs/base/common/platform';
|
import { Platform } from 'vs/base/common/platform';
|
||||||
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||||
import { Task, TaskEvent, KeyedTaskIdentifier } from './tasks';
|
import { Task, ITaskEvent, KeyedTaskIdentifier } from './tasks';
|
||||||
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||||
|
|
||||||
export const enum TaskErrors {
|
export const enum TaskErrors {
|
||||||
|
@ -69,11 +69,11 @@ export interface ITaskResolver {
|
||||||
resolve(uri: URI | string, identifier: string | KeyedTaskIdentifier | undefined): Promise<Task | undefined>;
|
resolve(uri: URI | string, identifier: string | KeyedTaskIdentifier | undefined): Promise<Task | undefined>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskTerminateResponse extends TerminateResponse {
|
export interface ITaskTerminateResponse extends TerminateResponse {
|
||||||
task: Task | undefined;
|
task: Task | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ResolveSet {
|
export interface IResolveSet {
|
||||||
process?: {
|
process?: {
|
||||||
name: string;
|
name: string;
|
||||||
cwd?: string;
|
cwd?: string;
|
||||||
|
@ -82,25 +82,25 @@ export interface ResolveSet {
|
||||||
variables: Set<string>;
|
variables: Set<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ResolvedVariables {
|
export interface IResolvedVariables {
|
||||||
process?: string;
|
process?: string;
|
||||||
variables: Map<string, string>;
|
variables: Map<string, string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskSystemInfo {
|
export interface ITaskSystemInfo {
|
||||||
platform: Platform;
|
platform: Platform;
|
||||||
context: any;
|
context: any;
|
||||||
uriProvider: (this: void, path: string) => URI;
|
uriProvider: (this: void, path: string) => URI;
|
||||||
resolveVariables(workspaceFolder: IWorkspaceFolder, toResolve: ResolveSet, target: ConfigurationTarget): Promise<ResolvedVariables | undefined>;
|
resolveVariables(workspaceFolder: IWorkspaceFolder, toResolve: IResolveSet, target: ConfigurationTarget): Promise<IResolvedVariables | undefined>;
|
||||||
findExecutable(command: string, cwd?: string, paths?: string[]): Promise<string | undefined>;
|
findExecutable(command: string, cwd?: string, paths?: string[]): Promise<string | undefined>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskSystemInfoResolver {
|
export interface ITaskSystemInfoResolver {
|
||||||
(workspaceFolder: IWorkspaceFolder | undefined): TaskSystemInfo | undefined;
|
(workspaceFolder: IWorkspaceFolder | undefined): ITaskSystemInfo | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITaskSystem {
|
export interface ITaskSystem {
|
||||||
onDidStateChange: Event<TaskEvent>;
|
onDidStateChange: Event<ITaskEvent>;
|
||||||
run(task: Task, resolver: ITaskResolver): ITaskExecuteResult;
|
run(task: Task, resolver: ITaskResolver): ITaskExecuteResult;
|
||||||
rerun(): ITaskExecuteResult | undefined;
|
rerun(): ITaskExecuteResult | undefined;
|
||||||
isActive(): Promise<boolean>;
|
isActive(): Promise<boolean>;
|
||||||
|
@ -109,8 +109,8 @@ export interface ITaskSystem {
|
||||||
getLastInstance(task: Task): Task | undefined;
|
getLastInstance(task: Task): Task | undefined;
|
||||||
getBusyTasks(): Task[];
|
getBusyTasks(): Task[];
|
||||||
canAutoTerminate(): boolean;
|
canAutoTerminate(): boolean;
|
||||||
terminate(task: Task): Promise<TaskTerminateResponse>;
|
terminate(task: Task): Promise<ITaskTerminateResponse>;
|
||||||
terminateAll(): Promise<TaskTerminateResponse[]>;
|
terminateAll(): Promise<ITaskTerminateResponse[]>;
|
||||||
revealTask(task: Task): boolean;
|
revealTask(task: Task): boolean;
|
||||||
customExecutionComplete(task: Task, result: number): Promise<void>;
|
customExecutionComplete(task: Task, result: number): Promise<void>;
|
||||||
isTaskVisible(task: Task): boolean;
|
isTaskVisible(task: Task): boolean;
|
||||||
|
|
|
@ -7,13 +7,13 @@ import * as nls from 'vs/nls';
|
||||||
|
|
||||||
import { IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
|
import { IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
|
||||||
|
|
||||||
export interface TaskEntry extends IQuickPickItem {
|
export interface ITaskEntry extends IQuickPickItem {
|
||||||
sort?: string;
|
sort?: string;
|
||||||
autoDetect: boolean;
|
autoDetect: boolean;
|
||||||
content: string;
|
content: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const dotnetBuild: TaskEntry = {
|
const dotnetBuild: ITaskEntry = {
|
||||||
id: 'dotnetCore',
|
id: 'dotnetCore',
|
||||||
label: '.NET Core',
|
label: '.NET Core',
|
||||||
sort: 'NET Core',
|
sort: 'NET Core',
|
||||||
|
@ -47,7 +47,7 @@ const dotnetBuild: TaskEntry = {
|
||||||
].join('\n')
|
].join('\n')
|
||||||
};
|
};
|
||||||
|
|
||||||
const msbuild: TaskEntry = {
|
const msbuild: ITaskEntry = {
|
||||||
id: 'msbuild',
|
id: 'msbuild',
|
||||||
label: 'MSBuild',
|
label: 'MSBuild',
|
||||||
autoDetect: false,
|
autoDetect: false,
|
||||||
|
@ -82,7 +82,7 @@ const msbuild: TaskEntry = {
|
||||||
].join('\n')
|
].join('\n')
|
||||||
};
|
};
|
||||||
|
|
||||||
const command: TaskEntry = {
|
const command: ITaskEntry = {
|
||||||
id: 'externalCommand',
|
id: 'externalCommand',
|
||||||
label: 'Others',
|
label: 'Others',
|
||||||
autoDetect: false,
|
autoDetect: false,
|
||||||
|
@ -103,7 +103,7 @@ const command: TaskEntry = {
|
||||||
].join('\n')
|
].join('\n')
|
||||||
};
|
};
|
||||||
|
|
||||||
const maven: TaskEntry = {
|
const maven: ITaskEntry = {
|
||||||
id: 'maven',
|
id: 'maven',
|
||||||
label: 'maven',
|
label: 'maven',
|
||||||
sort: 'MVN',
|
sort: 'MVN',
|
||||||
|
@ -132,8 +132,8 @@ const maven: TaskEntry = {
|
||||||
].join('\n')
|
].join('\n')
|
||||||
};
|
};
|
||||||
|
|
||||||
let _templates: TaskEntry[] | null = null;
|
let _templates: ITaskEntry[] | null = null;
|
||||||
export function getTemplates(): TaskEntry[] {
|
export function getTemplates(): ITaskEntry[] {
|
||||||
if (!_templates) {
|
if (!_templates) {
|
||||||
_templates = [dotnetBuild, msbuild, maven].sort((a, b) => {
|
_templates = [dotnetBuild, msbuild, maven].sort((a, b) => {
|
||||||
return (a.sort || a.label).localeCompare(b.sort || b.label);
|
return (a.sort || a.label).localeCompare(b.sort || b.label);
|
||||||
|
|
|
@ -60,7 +60,7 @@ export namespace ShellQuoting {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ShellQuotingOptions {
|
export interface IShellQuotingOptions {
|
||||||
/**
|
/**
|
||||||
* The character used to do character escaping.
|
* The character used to do character escaping.
|
||||||
*/
|
*/
|
||||||
|
@ -80,7 +80,7 @@ export interface ShellQuotingOptions {
|
||||||
weak?: string;
|
weak?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ShellConfiguration {
|
export interface IShellConfiguration {
|
||||||
/**
|
/**
|
||||||
* The shell executable.
|
* The shell executable.
|
||||||
*/
|
*/
|
||||||
|
@ -94,7 +94,7 @@ export interface ShellConfiguration {
|
||||||
/**
|
/**
|
||||||
* Which kind of quotes the shell supports.
|
* Which kind of quotes the shell supports.
|
||||||
*/
|
*/
|
||||||
quoting?: ShellQuotingOptions;
|
quoting?: IShellQuotingOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CommandOptions {
|
export interface CommandOptions {
|
||||||
|
@ -102,7 +102,7 @@ export interface CommandOptions {
|
||||||
/**
|
/**
|
||||||
* The shell to use if the task is a shell command.
|
* The shell to use if the task is a shell command.
|
||||||
*/
|
*/
|
||||||
shell?: ShellConfiguration;
|
shell?: IShellConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current working directory of the executed program or shell.
|
* The current working directory of the executed program or shell.
|
||||||
|
@ -223,7 +223,7 @@ export namespace PanelKind {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PresentationOptions {
|
export interface IPresentationOptions {
|
||||||
/**
|
/**
|
||||||
* Controls whether the task output is reveal in the user interface.
|
* Controls whether the task output is reveal in the user interface.
|
||||||
* Defaults to `RevealKind.Always`.
|
* Defaults to `RevealKind.Always`.
|
||||||
|
@ -276,7 +276,7 @@ export interface PresentationOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace PresentationOptions {
|
export namespace PresentationOptions {
|
||||||
export const defaults: PresentationOptions = {
|
export const defaults: IPresentationOptions = {
|
||||||
echo: true, reveal: RevealKind.Always, revealProblems: RevealProblemKind.Never, focus: false, panel: PanelKind.Shared, showReuseMessage: true, clear: false
|
echo: true, reveal: RevealKind.Always, revealProblems: RevealProblemKind.Never, focus: false, panel: PanelKind.Shared, showReuseMessage: true, clear: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -310,12 +310,12 @@ export namespace RuntimeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface QuotedString {
|
export interface IQuotedString {
|
||||||
value: string;
|
value: string;
|
||||||
quoting: ShellQuoting;
|
quoting: ShellQuoting;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CommandString = string | QuotedString;
|
export type CommandString = string | IQuotedString;
|
||||||
|
|
||||||
export namespace CommandString {
|
export namespace CommandString {
|
||||||
export function value(value: CommandString): string {
|
export function value(value: CommandString): string {
|
||||||
|
@ -327,7 +327,7 @@ export namespace CommandString {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CommandConfiguration {
|
export interface ICommandConfiguration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The task type
|
* The task type
|
||||||
|
@ -363,7 +363,7 @@ export interface CommandConfiguration {
|
||||||
/**
|
/**
|
||||||
* Describes how the task is presented in the UI.
|
* Describes how the task is presented in the UI.
|
||||||
*/
|
*/
|
||||||
presentation?: PresentationOptions;
|
presentation?: IPresentationOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace TaskGroup {
|
export namespace TaskGroup {
|
||||||
|
@ -420,7 +420,7 @@ export namespace TaskSourceKind {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskSourceConfigElement {
|
export interface ITaskSourceConfigElement {
|
||||||
workspaceFolder?: IWorkspaceFolder;
|
workspaceFolder?: IWorkspaceFolder;
|
||||||
workspace?: IWorkspace;
|
workspace?: IWorkspace;
|
||||||
file: string;
|
file: string;
|
||||||
|
@ -428,57 +428,57 @@ export interface TaskSourceConfigElement {
|
||||||
element: any;
|
element: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface BaseTaskSource {
|
interface IBaseTaskSource {
|
||||||
readonly kind: string;
|
readonly kind: string;
|
||||||
readonly label: string;
|
readonly label: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WorkspaceTaskSource extends BaseTaskSource {
|
export interface IWorkspaceTaskSource extends IBaseTaskSource {
|
||||||
readonly kind: 'workspace';
|
readonly kind: 'workspace';
|
||||||
readonly config: TaskSourceConfigElement;
|
readonly config: ITaskSourceConfigElement;
|
||||||
readonly customizes?: KeyedTaskIdentifier;
|
readonly customizes?: KeyedTaskIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ExtensionTaskSource extends BaseTaskSource {
|
export interface IExtensionTaskSource extends IBaseTaskSource {
|
||||||
readonly kind: 'extension';
|
readonly kind: 'extension';
|
||||||
readonly extension?: string;
|
readonly extension?: string;
|
||||||
readonly scope: TaskScope;
|
readonly scope: TaskScope;
|
||||||
readonly workspaceFolder: IWorkspaceFolder | undefined;
|
readonly workspaceFolder: IWorkspaceFolder | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ExtensionTaskSourceTransfer {
|
export interface IExtensionTaskSourceTransfer {
|
||||||
__workspaceFolder: UriComponents;
|
__workspaceFolder: UriComponents;
|
||||||
__definition: { type: string;[name: string]: any };
|
__definition: { type: string;[name: string]: any };
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface InMemoryTaskSource extends BaseTaskSource {
|
export interface IInMemoryTaskSource extends IBaseTaskSource {
|
||||||
readonly kind: 'inMemory';
|
readonly kind: 'inMemory';
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UserTaskSource extends BaseTaskSource {
|
export interface IUserTaskSource extends IBaseTaskSource {
|
||||||
readonly kind: 'user';
|
readonly kind: 'user';
|
||||||
readonly config: TaskSourceConfigElement;
|
readonly config: ITaskSourceConfigElement;
|
||||||
readonly customizes?: KeyedTaskIdentifier;
|
readonly customizes?: KeyedTaskIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WorkspaceFileTaskSource extends BaseTaskSource {
|
export interface WorkspaceFileTaskSource extends IBaseTaskSource {
|
||||||
readonly kind: 'workspaceFile';
|
readonly kind: 'workspaceFile';
|
||||||
readonly config: TaskSourceConfigElement;
|
readonly config: ITaskSourceConfigElement;
|
||||||
readonly customizes?: KeyedTaskIdentifier;
|
readonly customizes?: KeyedTaskIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TaskSource = WorkspaceTaskSource | ExtensionTaskSource | InMemoryTaskSource | UserTaskSource | WorkspaceFileTaskSource;
|
export type TaskSource = IWorkspaceTaskSource | IExtensionTaskSource | IInMemoryTaskSource | IUserTaskSource | WorkspaceFileTaskSource;
|
||||||
export type FileBasedTaskSource = WorkspaceTaskSource | UserTaskSource | WorkspaceFileTaskSource;
|
export type FileBasedTaskSource = IWorkspaceTaskSource | IUserTaskSource | WorkspaceFileTaskSource;
|
||||||
export interface TaskIdentifier {
|
export interface ITaskIdentifier {
|
||||||
type: string;
|
type: string;
|
||||||
[name: string]: any;
|
[name: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface KeyedTaskIdentifier extends TaskIdentifier {
|
export interface KeyedTaskIdentifier extends ITaskIdentifier {
|
||||||
_key: string;
|
_key: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskDependency {
|
export interface ITaskDependency {
|
||||||
uri: URI | string;
|
uri: URI | string;
|
||||||
task: string | KeyedTaskIdentifier | undefined;
|
task: string | KeyedTaskIdentifier | undefined;
|
||||||
}
|
}
|
||||||
|
@ -488,7 +488,7 @@ export const enum DependsOrder {
|
||||||
sequence = 'sequence'
|
sequence = 'sequence'
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ConfigurationProperties {
|
export interface IConfigurationProperties {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The task's name
|
* The task's name
|
||||||
|
@ -508,7 +508,7 @@ export interface ConfigurationProperties {
|
||||||
/**
|
/**
|
||||||
* The presentation options
|
* The presentation options
|
||||||
*/
|
*/
|
||||||
presentation?: PresentationOptions;
|
presentation?: IPresentationOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The command options;
|
* The command options;
|
||||||
|
@ -528,7 +528,7 @@ export interface ConfigurationProperties {
|
||||||
/**
|
/**
|
||||||
* The other tasks this task depends on.
|
* The other tasks this task depends on.
|
||||||
*/
|
*/
|
||||||
dependsOn?: TaskDependency[];
|
dependsOn?: ITaskDependency[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The order the dependsOn tasks should be executed in.
|
* The order the dependsOn tasks should be executed in.
|
||||||
|
@ -551,14 +551,14 @@ export enum RunOnOptions {
|
||||||
folderOpen = 2
|
folderOpen = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RunOptions {
|
export interface IRunOptions {
|
||||||
reevaluateOnRerun?: boolean;
|
reevaluateOnRerun?: boolean;
|
||||||
runOn?: RunOnOptions;
|
runOn?: RunOnOptions;
|
||||||
instanceLimit?: number;
|
instanceLimit?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace RunOptions {
|
export namespace RunOptions {
|
||||||
export const defaults: RunOptions = { reevaluateOnRerun: true, runOn: RunOnOptions.default, instanceLimit: 1 };
|
export const defaults: IRunOptions = { reevaluateOnRerun: true, runOn: RunOnOptions.default, instanceLimit: 1 };
|
||||||
}
|
}
|
||||||
|
|
||||||
export abstract class CommonTask {
|
export abstract class CommonTask {
|
||||||
|
@ -575,16 +575,16 @@ export abstract class CommonTask {
|
||||||
|
|
||||||
type?: string;
|
type?: string;
|
||||||
|
|
||||||
runOptions: RunOptions;
|
runOptions: IRunOptions;
|
||||||
|
|
||||||
configurationProperties: ConfigurationProperties;
|
configurationProperties: IConfigurationProperties;
|
||||||
|
|
||||||
_source: BaseTaskSource;
|
_source: IBaseTaskSource;
|
||||||
|
|
||||||
private _taskLoadMessages: string[] | undefined;
|
private _taskLoadMessages: string[] | undefined;
|
||||||
|
|
||||||
protected constructor(id: string, label: string | undefined, type: string | undefined, runOptions: RunOptions,
|
protected constructor(id: string, label: string | undefined, type: string | undefined, runOptions: IRunOptions,
|
||||||
configurationProperties: ConfigurationProperties, source: BaseTaskSource) {
|
configurationProperties: IConfigurationProperties, source: IBaseTaskSource) {
|
||||||
this._id = id;
|
this._id = id;
|
||||||
if (label) {
|
if (label) {
|
||||||
this._label = label;
|
this._label = label;
|
||||||
|
@ -612,12 +612,12 @@ export abstract class CommonTask {
|
||||||
protected abstract getFolderId(): string | undefined;
|
protected abstract getFolderId(): string | undefined;
|
||||||
|
|
||||||
public getCommonTaskId(): string {
|
public getCommonTaskId(): string {
|
||||||
interface RecentTaskKey {
|
interface IRecentTaskKey {
|
||||||
folder: string | undefined;
|
folder: string | undefined;
|
||||||
id: string;
|
id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const key: RecentTaskKey = { folder: this.getFolderId(), id: this._id };
|
const key: IRecentTaskKey = { folder: this.getFolderId(), id: this._id };
|
||||||
return JSON.stringify(key);
|
return JSON.stringify(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -659,8 +659,8 @@ export abstract class CommonTask {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public getTaskExecution(): TaskExecution {
|
public getTaskExecution(): ITaskExecution {
|
||||||
let result: TaskExecution = {
|
let result: ITaskExecution = {
|
||||||
id: this._id,
|
id: this._id,
|
||||||
task: <any>this
|
task: <any>this
|
||||||
};
|
};
|
||||||
|
@ -697,10 +697,10 @@ export class CustomTask extends CommonTask {
|
||||||
/**
|
/**
|
||||||
* The command configuration
|
* The command configuration
|
||||||
*/
|
*/
|
||||||
command: CommandConfiguration = {};
|
command: ICommandConfiguration = {};
|
||||||
|
|
||||||
public constructor(id: string, source: FileBasedTaskSource, label: string, type: string, command: CommandConfiguration | undefined,
|
public constructor(id: string, source: FileBasedTaskSource, label: string, type: string, command: ICommandConfiguration | undefined,
|
||||||
hasDefinedMatchers: boolean, runOptions: RunOptions, configurationProperties: ConfigurationProperties) {
|
hasDefinedMatchers: boolean, runOptions: IRunOptions, configurationProperties: IConfigurationProperties) {
|
||||||
super(id, label, undefined, runOptions, configurationProperties, source);
|
super(id, label, undefined, runOptions, configurationProperties, source);
|
||||||
this._source = source;
|
this._source = source;
|
||||||
this.hasDefinedMatchers = hasDefinedMatchers;
|
this.hasDefinedMatchers = hasDefinedMatchers;
|
||||||
|
@ -774,7 +774,7 @@ export class CustomTask extends CommonTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override getRecentlyUsedKey(): string | undefined {
|
public override getRecentlyUsedKey(): string | undefined {
|
||||||
interface CustomKey {
|
interface ICustomKey {
|
||||||
type: string;
|
type: string;
|
||||||
folder: string;
|
folder: string;
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -787,7 +787,7 @@ export class CustomTask extends CommonTask {
|
||||||
if (this._source.kind !== TaskSourceKind.Workspace) {
|
if (this._source.kind !== TaskSourceKind.Workspace) {
|
||||||
id += this._source.kind;
|
id += this._source.kind;
|
||||||
}
|
}
|
||||||
let key: CustomKey = { type: CUSTOMIZED_TASK_TYPE, folder: workspaceFolder, id };
|
let key: ICustomKey = { type: CUSTOMIZED_TASK_TYPE, folder: workspaceFolder, id };
|
||||||
return JSON.stringify(key);
|
return JSON.stringify(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -822,7 +822,7 @@ export class ConfiguringTask extends CommonTask {
|
||||||
configures: KeyedTaskIdentifier;
|
configures: KeyedTaskIdentifier;
|
||||||
|
|
||||||
public constructor(id: string, source: FileBasedTaskSource, label: string | undefined, type: string | undefined,
|
public constructor(id: string, source: FileBasedTaskSource, label: string | undefined, type: string | undefined,
|
||||||
configures: KeyedTaskIdentifier, runOptions: RunOptions, configurationProperties: ConfigurationProperties) {
|
configures: KeyedTaskIdentifier, runOptions: IRunOptions, configurationProperties: IConfigurationProperties) {
|
||||||
super(id, label, type, runOptions, configurationProperties, source);
|
super(id, label, type, runOptions, configurationProperties, source);
|
||||||
this._source = source;
|
this._source = source;
|
||||||
this.configures = configures;
|
this.configures = configures;
|
||||||
|
@ -853,7 +853,7 @@ export class ConfiguringTask extends CommonTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override getRecentlyUsedKey(): string | undefined {
|
public override getRecentlyUsedKey(): string | undefined {
|
||||||
interface CustomKey {
|
interface ICustomKey {
|
||||||
type: string;
|
type: string;
|
||||||
folder: string;
|
folder: string;
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -866,7 +866,7 @@ export class ConfiguringTask extends CommonTask {
|
||||||
if (this._source.kind !== TaskSourceKind.Workspace) {
|
if (this._source.kind !== TaskSourceKind.Workspace) {
|
||||||
id += this._source.kind;
|
id += this._source.kind;
|
||||||
}
|
}
|
||||||
let key: CustomKey = { type: CUSTOMIZED_TASK_TYPE, folder: workspaceFolder, id };
|
let key: ICustomKey = { type: CUSTOMIZED_TASK_TYPE, folder: workspaceFolder, id };
|
||||||
return JSON.stringify(key);
|
return JSON.stringify(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -877,7 +877,7 @@ export class ContributedTask extends CommonTask {
|
||||||
* Indicated the source of the task (e.g. tasks.json or extension)
|
* Indicated the source of the task (e.g. tasks.json or extension)
|
||||||
* Set in the super constructor
|
* Set in the super constructor
|
||||||
*/
|
*/
|
||||||
override _source!: ExtensionTaskSource;
|
override _source!: IExtensionTaskSource;
|
||||||
|
|
||||||
instance: number | undefined;
|
instance: number | undefined;
|
||||||
|
|
||||||
|
@ -888,11 +888,11 @@ export class ContributedTask extends CommonTask {
|
||||||
/**
|
/**
|
||||||
* The command configuration
|
* The command configuration
|
||||||
*/
|
*/
|
||||||
command: CommandConfiguration;
|
command: ICommandConfiguration;
|
||||||
|
|
||||||
public constructor(id: string, source: ExtensionTaskSource, label: string, type: string | undefined, defines: KeyedTaskIdentifier,
|
public constructor(id: string, source: IExtensionTaskSource, label: string, type: string | undefined, defines: KeyedTaskIdentifier,
|
||||||
command: CommandConfiguration, hasDefinedMatchers: boolean, runOptions: RunOptions,
|
command: ICommandConfiguration, hasDefinedMatchers: boolean, runOptions: IRunOptions,
|
||||||
configurationProperties: ConfigurationProperties) {
|
configurationProperties: IConfigurationProperties) {
|
||||||
super(id, label, type, runOptions, configurationProperties, source);
|
super(id, label, type, runOptions, configurationProperties, source);
|
||||||
this.defines = defines;
|
this.defines = defines;
|
||||||
this.hasDefinedMatchers = hasDefinedMatchers;
|
this.hasDefinedMatchers = hasDefinedMatchers;
|
||||||
|
@ -926,14 +926,14 @@ export class ContributedTask extends CommonTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override getRecentlyUsedKey(): string | undefined {
|
public override getRecentlyUsedKey(): string | undefined {
|
||||||
interface ContributedKey {
|
interface IContributedKey {
|
||||||
type: string;
|
type: string;
|
||||||
scope: number;
|
scope: number;
|
||||||
folder?: string;
|
folder?: string;
|
||||||
id: string;
|
id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
let key: ContributedKey = { type: 'contributed', scope: this._source.scope, id: this._id };
|
let key: IContributedKey = { type: 'contributed', scope: this._source.scope, id: this._id };
|
||||||
key.folder = this.getFolderId();
|
key.folder = this.getFolderId();
|
||||||
return JSON.stringify(key);
|
return JSON.stringify(key);
|
||||||
}
|
}
|
||||||
|
@ -955,14 +955,14 @@ export class InMemoryTask extends CommonTask {
|
||||||
/**
|
/**
|
||||||
* Indicated the source of the task (e.g. tasks.json or extension)
|
* Indicated the source of the task (e.g. tasks.json or extension)
|
||||||
*/
|
*/
|
||||||
override _source: InMemoryTaskSource;
|
override _source: IInMemoryTaskSource;
|
||||||
|
|
||||||
instance: number | undefined;
|
instance: number | undefined;
|
||||||
|
|
||||||
override type!: 'inMemory';
|
override type!: 'inMemory';
|
||||||
|
|
||||||
public constructor(id: string, source: InMemoryTaskSource, label: string, type: string,
|
public constructor(id: string, source: IInMemoryTaskSource, label: string, type: string,
|
||||||
runOptions: RunOptions, configurationProperties: ConfigurationProperties) {
|
runOptions: IRunOptions, configurationProperties: IConfigurationProperties) {
|
||||||
super(id, label, type, runOptions, configurationProperties, source);
|
super(id, label, type, runOptions, configurationProperties, source);
|
||||||
this._source = source;
|
this._source = source;
|
||||||
}
|
}
|
||||||
|
@ -994,7 +994,7 @@ export class InMemoryTask extends CommonTask {
|
||||||
|
|
||||||
export type Task = CustomTask | ContributedTask | InMemoryTask;
|
export type Task = CustomTask | ContributedTask | InMemoryTask;
|
||||||
|
|
||||||
export interface TaskExecution {
|
export interface ITaskExecution {
|
||||||
id: string;
|
id: string;
|
||||||
task: Task;
|
task: Task;
|
||||||
}
|
}
|
||||||
|
@ -1013,12 +1013,12 @@ export const enum JsonSchemaVersion {
|
||||||
V2_0_0 = 2
|
V2_0_0 = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskSet {
|
export interface ITaskSet {
|
||||||
tasks: Task[];
|
tasks: Task[];
|
||||||
extension?: IExtensionDescription;
|
extension?: IExtensionDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskDefinition {
|
export interface ITaskDefinition {
|
||||||
extensionId: string;
|
extensionId: string;
|
||||||
taskType: string;
|
taskType: string;
|
||||||
required: string[];
|
required: string[];
|
||||||
|
@ -1078,7 +1078,7 @@ export const enum TaskRunType {
|
||||||
Background = 'background'
|
Background = 'background'
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskEvent {
|
export interface ITaskEvent {
|
||||||
kind: TaskEventKind;
|
kind: TaskEventKind;
|
||||||
taskId?: string;
|
taskId?: string;
|
||||||
taskName?: string;
|
taskName?: string;
|
||||||
|
@ -1099,13 +1099,13 @@ export const enum TaskRunSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace TaskEvent {
|
export namespace TaskEvent {
|
||||||
export function create(kind: TaskEventKind.ProcessStarted | TaskEventKind.ProcessEnded, task: Task, processIdOrExitCode?: number): TaskEvent;
|
export function create(kind: TaskEventKind.ProcessStarted | TaskEventKind.ProcessEnded, task: Task, processIdOrExitCode?: number): ITaskEvent;
|
||||||
export function create(kind: TaskEventKind.Start, task: Task, terminalId?: number, resolvedVariables?: Map<string, string>): TaskEvent;
|
export function create(kind: TaskEventKind.Start, task: Task, terminalId?: number, resolvedVariables?: Map<string, string>): ITaskEvent;
|
||||||
export function create(kind: TaskEventKind.AcquiredInput | TaskEventKind.DependsOnStarted | TaskEventKind.Start | TaskEventKind.Active | TaskEventKind.Inactive | TaskEventKind.Terminated | TaskEventKind.End, task: Task): TaskEvent;
|
export function create(kind: TaskEventKind.AcquiredInput | TaskEventKind.DependsOnStarted | TaskEventKind.Start | TaskEventKind.Active | TaskEventKind.Inactive | TaskEventKind.Terminated | TaskEventKind.End, task: Task): ITaskEvent;
|
||||||
export function create(kind: TaskEventKind.Changed): TaskEvent;
|
export function create(kind: TaskEventKind.Changed): ITaskEvent;
|
||||||
export function create(kind: TaskEventKind, task?: Task, processIdOrExitCodeOrTerminalId?: number, resolvedVariables?: Map<string, string>): TaskEvent {
|
export function create(kind: TaskEventKind, task?: Task, processIdOrExitCodeOrTerminalId?: number, resolvedVariables?: Map<string, string>): ITaskEvent {
|
||||||
if (task) {
|
if (task) {
|
||||||
let result: TaskEvent = {
|
let result: ITaskEvent = {
|
||||||
kind: kind,
|
kind: kind,
|
||||||
taskId: task._id,
|
taskId: task._id,
|
||||||
taskName: task.configurationProperties.name,
|
taskName: task.configurationProperties.name,
|
||||||
|
@ -1146,7 +1146,7 @@ export namespace KeyedTaskIdentifier {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
export function create(value: TaskIdentifier): KeyedTaskIdentifier {
|
export function create(value: ITaskIdentifier): KeyedTaskIdentifier {
|
||||||
const resultKey = sortedStringify(value);
|
const resultKey = sortedStringify(value);
|
||||||
let result = { _key: resultKey, type: value.taskType };
|
let result = { _key: resultKey, type: value.taskType };
|
||||||
Object.assign(result, value);
|
Object.assign(result, value);
|
||||||
|
@ -1155,7 +1155,7 @@ export namespace KeyedTaskIdentifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace TaskDefinition {
|
export namespace TaskDefinition {
|
||||||
export function createTaskIdentifier(external: TaskIdentifier, reporter: { error(message: string): void }): KeyedTaskIdentifier | undefined {
|
export function createTaskIdentifier(external: ITaskIdentifier, reporter: { error(message: string): void }): KeyedTaskIdentifier | undefined {
|
||||||
let definition = TaskDefinitionRegistry.get(external.type);
|
let definition = TaskDefinitionRegistry.get(external.type);
|
||||||
if (definition === undefined) {
|
if (definition === undefined) {
|
||||||
// We have no task definition so we can't sanitize the literal. Take it as is
|
// We have no task definition so we can't sanitize the literal. Take it as is
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { ITaskSystem } from 'vs/workbench/contrib/tasks/common/taskSystem';
|
||||||
import { ExecutionEngine } from 'vs/workbench/contrib/tasks/common/tasks';
|
import { ExecutionEngine } from 'vs/workbench/contrib/tasks/common/tasks';
|
||||||
import * as TaskConfig from '../common/taskConfiguration';
|
import * as TaskConfig from '../common/taskConfiguration';
|
||||||
import { AbstractTaskService } from 'vs/workbench/contrib/tasks/browser/abstractTaskService';
|
import { AbstractTaskService } from 'vs/workbench/contrib/tasks/browser/abstractTaskService';
|
||||||
import { TaskFilter, ITaskService } from 'vs/workbench/contrib/tasks/common/taskService';
|
import { ITaskFilter, ITaskService } from 'vs/workbench/contrib/tasks/common/taskService';
|
||||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||||
import { TerminalTaskSystem } from 'vs/workbench/contrib/tasks/browser/terminalTaskSystem';
|
import { TerminalTaskSystem } from 'vs/workbench/contrib/tasks/browser/terminalTaskSystem';
|
||||||
import { IConfirmationResult, IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
import { IConfirmationResult, IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||||
|
@ -44,9 +44,9 @@ import { IWorkspaceTrustManagementService, IWorkspaceTrustRequestService } from
|
||||||
import { ITerminalProfileResolverService } from 'vs/workbench/contrib/terminal/common/terminal';
|
import { ITerminalProfileResolverService } from 'vs/workbench/contrib/terminal/common/terminal';
|
||||||
import { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/browser/panecomposite';
|
import { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/browser/panecomposite';
|
||||||
|
|
||||||
interface WorkspaceFolderConfigurationResult {
|
interface IWorkspaceFolderConfigurationResult {
|
||||||
workspaceFolder: IWorkspaceFolder;
|
workspaceFolder: IWorkspaceFolder;
|
||||||
config: TaskConfig.ExternalTaskRunnerConfiguration | undefined;
|
config: TaskConfig.IExternalTaskRunnerConfiguration | undefined;
|
||||||
hasErrors: boolean;
|
hasErrors: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ export class TaskService extends AbstractTaskService {
|
||||||
return this._taskSystem;
|
return this._taskSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected computeLegacyConfiguration(workspaceFolder: IWorkspaceFolder): Promise<WorkspaceFolderConfigurationResult> {
|
protected computeLegacyConfiguration(workspaceFolder: IWorkspaceFolder): Promise<IWorkspaceFolderConfigurationResult> {
|
||||||
let { config, hasParseErrors } = this.getConfiguration(workspaceFolder);
|
let { config, hasParseErrors } = this.getConfiguration(workspaceFolder);
|
||||||
if (hasParseErrors) {
|
if (hasParseErrors) {
|
||||||
return Promise.resolve({ workspaceFolder: workspaceFolder, hasErrors: true, config: undefined });
|
return Promise.resolve({ workspaceFolder: workspaceFolder, hasErrors: true, config: undefined });
|
||||||
|
@ -145,7 +145,7 @@ export class TaskService extends AbstractTaskService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected versionAndEngineCompatible(filter?: TaskFilter): boolean {
|
protected versionAndEngineCompatible(filter?: ITaskFilter): boolean {
|
||||||
let range = filter && filter.version ? filter.version : undefined;
|
let range = filter && filter.version ? filter.version : undefined;
|
||||||
let engine = this.executionEngine;
|
let engine = this.executionEngine;
|
||||||
|
|
||||||
|
|
|
@ -9,17 +9,17 @@ import { TestConfigurationService } from 'vs/platform/configuration/test/common/
|
||||||
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
|
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
|
||||||
import { ACTIVE_TASK_STATUS, FAILED_TASK_STATUS, SUCCEEDED_TASK_STATUS, TaskTerminalStatus } from 'vs/workbench/contrib/tasks/browser/taskTerminalStatus';
|
import { ACTIVE_TASK_STATUS, FAILED_TASK_STATUS, SUCCEEDED_TASK_STATUS, TaskTerminalStatus } from 'vs/workbench/contrib/tasks/browser/taskTerminalStatus';
|
||||||
import { AbstractProblemCollector } from 'vs/workbench/contrib/tasks/common/problemCollectors';
|
import { AbstractProblemCollector } from 'vs/workbench/contrib/tasks/common/problemCollectors';
|
||||||
import { CommonTask, TaskEvent, TaskEventKind, TaskRunType } from 'vs/workbench/contrib/tasks/common/tasks';
|
import { CommonTask, ITaskEvent, TaskEventKind, TaskRunType } from 'vs/workbench/contrib/tasks/common/tasks';
|
||||||
import { ITaskService, Task } from 'vs/workbench/contrib/tasks/common/taskService';
|
import { ITaskService, Task } from 'vs/workbench/contrib/tasks/common/taskService';
|
||||||
import { ITerminalInstance } from 'vs/workbench/contrib/terminal/browser/terminal';
|
import { ITerminalInstance } from 'vs/workbench/contrib/terminal/browser/terminal';
|
||||||
import { ITerminalStatus, ITerminalStatusList, TerminalStatusList } from 'vs/workbench/contrib/terminal/browser/terminalStatusList';
|
import { ITerminalStatus, ITerminalStatusList, TerminalStatusList } from 'vs/workbench/contrib/terminal/browser/terminalStatusList';
|
||||||
|
|
||||||
class TestTaskService implements Partial<ITaskService> {
|
class TestTaskService implements Partial<ITaskService> {
|
||||||
private readonly _onDidStateChange: Emitter<TaskEvent> = new Emitter();
|
private readonly _onDidStateChange: Emitter<ITaskEvent> = new Emitter();
|
||||||
public get onDidStateChange(): Event<TaskEvent> {
|
public get onDidStateChange(): Event<ITaskEvent> {
|
||||||
return this._onDidStateChange.event;
|
return this._onDidStateChange.event;
|
||||||
}
|
}
|
||||||
public triggerStateChange(event: TaskEvent): void {
|
public triggerStateChange(event: ITaskEvent): void {
|
||||||
this._onDidStateChange.fire(event);
|
this._onDidStateChange.fire(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ suite('ProblemPatternParser', () => {
|
||||||
|
|
||||||
suite('single-pattern definitions', () => {
|
suite('single-pattern definitions', () => {
|
||||||
test('parses a pattern defined by only a regexp', () => {
|
test('parses a pattern defined by only a regexp', () => {
|
||||||
let problemPattern: matchers.Config.ProblemPattern = {
|
let problemPattern: matchers.Config.IProblemPattern = {
|
||||||
regexp: 'test'
|
regexp: 'test'
|
||||||
};
|
};
|
||||||
let parsed = parser.parse(problemPattern);
|
let parsed = parser.parse(problemPattern);
|
||||||
|
@ -82,7 +82,7 @@ suite('ProblemPatternParser', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
test('does not sets defaults for line and character if kind is File', () => {
|
test('does not sets defaults for line and character if kind is File', () => {
|
||||||
let problemPattern: matchers.Config.ProblemPattern = {
|
let problemPattern: matchers.Config.IProblemPattern = {
|
||||||
regexp: 'test',
|
regexp: 'test',
|
||||||
kind: 'file'
|
kind: 'file'
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,11 +10,11 @@ import * as UUID from 'vs/base/common/uuid';
|
||||||
import * as Types from 'vs/base/common/types';
|
import * as Types from 'vs/base/common/types';
|
||||||
import * as Platform from 'vs/base/common/platform';
|
import * as Platform from 'vs/base/common/platform';
|
||||||
import { ValidationStatus } from 'vs/base/common/parsers';
|
import { ValidationStatus } from 'vs/base/common/parsers';
|
||||||
import { ProblemMatcher, FileLocationKind, ProblemPattern, ApplyToKind, NamedProblemMatcher } from 'vs/workbench/contrib/tasks/common/problemMatcher';
|
import { ProblemMatcher, FileLocationKind, IProblemPattern, ApplyToKind, INamedProblemMatcher } from 'vs/workbench/contrib/tasks/common/problemMatcher';
|
||||||
import { WorkspaceFolder, IWorkspace } from 'vs/platform/workspace/common/workspace';
|
import { WorkspaceFolder, IWorkspace } from 'vs/platform/workspace/common/workspace';
|
||||||
|
|
||||||
import * as Tasks from 'vs/workbench/contrib/tasks/common/tasks';
|
import * as Tasks from 'vs/workbench/contrib/tasks/common/tasks';
|
||||||
import { parse, ParseResult, IProblemReporter, ExternalTaskRunnerConfiguration, CustomTask, TaskConfigSource, ParseContext, ProblemMatcherConverter, Globals, TaskParseResult, UUIDMap, TaskParser } from 'vs/workbench/contrib/tasks/common/taskConfiguration';
|
import { parse, IParseResult, IProblemReporter, IExternalTaskRunnerConfiguration, ICustomTask, TaskConfigSource, IParseContext, ProblemMatcherConverter, IGlobals, ITaskParseResult, UUIDMap, TaskParser } from 'vs/workbench/contrib/tasks/common/taskConfiguration';
|
||||||
import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService';
|
import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService';
|
||||||
import { IContext } from 'vs/platform/contextkey/common/contextkey';
|
import { IContext } from 'vs/platform/contextkey/common/contextkey';
|
||||||
import { Workspace } from 'vs/platform/workspace/test/common/testWorkspace';
|
import { Workspace } from 'vs/platform/workspace/test/common/testWorkspace';
|
||||||
|
@ -92,7 +92,7 @@ class ConfiguationBuilder {
|
||||||
|
|
||||||
class PresentationBuilder {
|
class PresentationBuilder {
|
||||||
|
|
||||||
public result: Tasks.PresentationOptions;
|
public result: Tasks.IPresentationOptions;
|
||||||
|
|
||||||
constructor(public parent: CommandConfigurationBuilder) {
|
constructor(public parent: CommandConfigurationBuilder) {
|
||||||
this.result = { echo: false, reveal: Tasks.RevealKind.Always, revealProblems: Tasks.RevealProblemKind.Never, focus: false, panel: Tasks.PanelKind.Shared, showReuseMessage: true, clear: false, close: false };
|
this.result = { echo: false, reveal: Tasks.RevealKind.Always, revealProblems: Tasks.RevealProblemKind.Never, focus: false, panel: Tasks.PanelKind.Shared, showReuseMessage: true, clear: false, close: false };
|
||||||
|
@ -133,7 +133,7 @@ class PresentationBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
class CommandConfigurationBuilder {
|
class CommandConfigurationBuilder {
|
||||||
public result: Tasks.CommandConfiguration;
|
public result: Tasks.ICommandConfiguration;
|
||||||
|
|
||||||
private presentationBuilder: PresentationBuilder;
|
private presentationBuilder: PresentationBuilder;
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ class ProblemMatcherBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
class PatternBuilder {
|
class PatternBuilder {
|
||||||
public result: ProblemPattern;
|
public result: IProblemPattern;
|
||||||
|
|
||||||
constructor(public parent: ProblemMatcherBuilder, regExp: RegExp) {
|
constructor(public parent: ProblemMatcherBuilder, regExp: RegExp) {
|
||||||
this.result = {
|
this.result = {
|
||||||
|
@ -376,7 +376,7 @@ class TasksMockContextKeyService extends MockContextKeyService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDefaultProblemMatcher(external: ExternalTaskRunnerConfiguration, resolved: number) {
|
function testDefaultProblemMatcher(external: IExternalTaskRunnerConfiguration, resolved: number) {
|
||||||
let reporter = new ProblemReporter();
|
let reporter = new ProblemReporter();
|
||||||
let result = parse(workspaceFolder, workspace, Platform.platform, external, reporter, TaskConfigSource.TasksJson, new TasksMockContextKeyService());
|
let result = parse(workspaceFolder, workspace, Platform.platform, external, reporter, TaskConfigSource.TasksJson, new TasksMockContextKeyService());
|
||||||
assert.ok(!reporter.receivedMessage);
|
assert.ok(!reporter.receivedMessage);
|
||||||
|
@ -386,7 +386,7 @@ function testDefaultProblemMatcher(external: ExternalTaskRunnerConfiguration, re
|
||||||
assert.strictEqual(task.configurationProperties.problemMatchers!.length, resolved);
|
assert.strictEqual(task.configurationProperties.problemMatchers!.length, resolved);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testConfiguration(external: ExternalTaskRunnerConfiguration, builder: ConfiguationBuilder): void {
|
function testConfiguration(external: IExternalTaskRunnerConfiguration, builder: ConfiguationBuilder): void {
|
||||||
builder.done();
|
builder.done();
|
||||||
let reporter = new ProblemReporter();
|
let reporter = new ProblemReporter();
|
||||||
let result = parse(workspaceFolder, workspace, Platform.platform, external, reporter, TaskConfigSource.TasksJson, new TasksMockContextKeyService());
|
let result = parse(workspaceFolder, workspace, Platform.platform, external, reporter, TaskConfigSource.TasksJson, new TasksMockContextKeyService());
|
||||||
|
@ -437,7 +437,7 @@ class TaskGroupMap {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function assertConfiguration(result: ParseResult, expected: Tasks.Task[]): void {
|
function assertConfiguration(result: IParseResult, expected: Tasks.Task[]): void {
|
||||||
assert.ok(result.validationStatus.isOK());
|
assert.ok(result.validationStatus.isOK());
|
||||||
let actual = result.custom;
|
let actual = result.custom;
|
||||||
assert.strictEqual(typeof actual, typeof expected);
|
assert.strictEqual(typeof actual, typeof expected);
|
||||||
|
@ -508,7 +508,7 @@ function assertTask(actual: Tasks.Task, expected: Tasks.Task) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function assertCommandConfiguration(actual: Tasks.CommandConfiguration, expected: Tasks.CommandConfiguration) {
|
function assertCommandConfiguration(actual: Tasks.ICommandConfiguration, expected: Tasks.ICommandConfiguration) {
|
||||||
assert.strictEqual(typeof actual, typeof expected);
|
assert.strictEqual(typeof actual, typeof expected);
|
||||||
if (actual && expected) {
|
if (actual && expected) {
|
||||||
assertPresentation(actual.presentation!, expected.presentation!);
|
assertPresentation(actual.presentation!, expected.presentation!);
|
||||||
|
@ -536,7 +536,7 @@ function assertGroup(actual: Tasks.TaskGroup, expected: Tasks.TaskGroup) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function assertPresentation(actual: Tasks.PresentationOptions, expected: Tasks.PresentationOptions) {
|
function assertPresentation(actual: Tasks.IPresentationOptions, expected: Tasks.IPresentationOptions) {
|
||||||
assert.strictEqual(typeof actual, typeof expected);
|
assert.strictEqual(typeof actual, typeof expected);
|
||||||
if (actual && expected) {
|
if (actual && expected) {
|
||||||
assert.strictEqual(actual.echo, expected.echo);
|
assert.strictEqual(actual.echo, expected.echo);
|
||||||
|
@ -566,21 +566,21 @@ function assertProblemMatcher(actual: string | ProblemMatcher, expected: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function assertProblemPatterns(actual: ProblemPattern | ProblemPattern[], expected: ProblemPattern | ProblemPattern[]) {
|
function assertProblemPatterns(actual: IProblemPattern | IProblemPattern[], expected: IProblemPattern | IProblemPattern[]) {
|
||||||
assert.strictEqual(typeof actual, typeof expected);
|
assert.strictEqual(typeof actual, typeof expected);
|
||||||
if (Array.isArray(actual)) {
|
if (Array.isArray(actual)) {
|
||||||
let actuals = <ProblemPattern[]>actual;
|
let actuals = <IProblemPattern[]>actual;
|
||||||
let expecteds = <ProblemPattern[]>expected;
|
let expecteds = <IProblemPattern[]>expected;
|
||||||
assert.strictEqual(actuals.length, expecteds.length);
|
assert.strictEqual(actuals.length, expecteds.length);
|
||||||
for (let i = 0; i < actuals.length; i++) {
|
for (let i = 0; i < actuals.length; i++) {
|
||||||
assertProblemPattern(actuals[i], expecteds[i]);
|
assertProblemPattern(actuals[i], expecteds[i]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
assertProblemPattern(<ProblemPattern>actual, <ProblemPattern>expected);
|
assertProblemPattern(<IProblemPattern>actual, <IProblemPattern>expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function assertProblemPattern(actual: ProblemPattern, expected: ProblemPattern) {
|
function assertProblemPattern(actual: IProblemPattern, expected: IProblemPattern) {
|
||||||
assert.strictEqual(actual.regexp.toString(), expected.regexp.toString());
|
assert.strictEqual(actual.regexp.toString(), expected.regexp.toString());
|
||||||
assert.strictEqual(actual.file, expected.file);
|
assert.strictEqual(actual.file, expected.file);
|
||||||
assert.strictEqual(actual.message, expected.message);
|
assert.strictEqual(actual.message, expected.message);
|
||||||
|
@ -793,7 +793,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
task(name, name).
|
task(name, name).
|
||||||
group(Tasks.TaskGroup.Build).
|
group(Tasks.TaskGroup.Build).
|
||||||
command().suppressTaskName(true);
|
command().suppressTaskName(true);
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
windows: {
|
windows: {
|
||||||
|
@ -811,7 +811,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
group(Tasks.TaskGroup.Build).
|
group(Tasks.TaskGroup.Build).
|
||||||
command().suppressTaskName(true).
|
command().suppressTaskName(true).
|
||||||
runtime(Tasks.RuntimeType.Shell);
|
runtime(Tasks.RuntimeType.Shell);
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
isShellCommand: true,
|
isShellCommand: true,
|
||||||
|
@ -829,7 +829,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
task(name, name).
|
task(name, name).
|
||||||
group(Tasks.TaskGroup.Build).
|
group(Tasks.TaskGroup.Build).
|
||||||
command().suppressTaskName(true);
|
command().suppressTaskName(true);
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
osx: {
|
osx: {
|
||||||
|
@ -846,7 +846,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
task(name, name).
|
task(name, name).
|
||||||
group(Tasks.TaskGroup.Build).
|
group(Tasks.TaskGroup.Build).
|
||||||
command().suppressTaskName(true);
|
command().suppressTaskName(true);
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
linux: {
|
linux: {
|
||||||
|
@ -863,7 +863,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
group(Tasks.TaskGroup.Build).
|
group(Tasks.TaskGroup.Build).
|
||||||
command().suppressTaskName(true).
|
command().suppressTaskName(true).
|
||||||
presentation().reveal(Platform.isWindows ? Tasks.RevealKind.Always : Tasks.RevealKind.Never);
|
presentation().reveal(Platform.isWindows ? Tasks.RevealKind.Always : Tasks.RevealKind.Never);
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
showOutput: 'never',
|
showOutput: 'never',
|
||||||
|
@ -882,7 +882,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
command().suppressTaskName(true).
|
command().suppressTaskName(true).
|
||||||
presentation().
|
presentation().
|
||||||
echo(Platform.isWindows ? false : true);
|
echo(Platform.isWindows ? false : true);
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
echoCommand: true,
|
echoCommand: true,
|
||||||
|
@ -894,7 +894,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: global problemMatcher one', () => {
|
test('tasks: global problemMatcher one', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
problemMatcher: '$msCompile'
|
problemMatcher: '$msCompile'
|
||||||
|
@ -903,7 +903,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: global problemMatcher two', () => {
|
test('tasks: global problemMatcher two', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
problemMatcher: ['$eslint-compact', '$msCompile']
|
problemMatcher: ['$eslint-compact', '$msCompile']
|
||||||
|
@ -912,7 +912,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: task definition', () => {
|
test('tasks: task definition', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
tasks: [
|
tasks: [
|
||||||
|
@ -927,14 +927,14 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: build task', () => {
|
test('tasks: build task', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
tasks: [
|
tasks: [
|
||||||
{
|
{
|
||||||
taskName: 'taskName',
|
taskName: 'taskName',
|
||||||
isBuildCommand: true
|
isBuildCommand: true
|
||||||
} as CustomTask
|
} as ICustomTask
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
let builder = new ConfiguationBuilder();
|
let builder = new ConfiguationBuilder();
|
||||||
|
@ -943,7 +943,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: default build task', () => {
|
test('tasks: default build task', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
tasks: [
|
tasks: [
|
||||||
|
@ -958,14 +958,14 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: test task', () => {
|
test('tasks: test task', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
tasks: [
|
tasks: [
|
||||||
{
|
{
|
||||||
taskName: 'taskName',
|
taskName: 'taskName',
|
||||||
isTestCommand: true
|
isTestCommand: true
|
||||||
} as CustomTask
|
} as ICustomTask
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
let builder = new ConfiguationBuilder();
|
let builder = new ConfiguationBuilder();
|
||||||
|
@ -974,7 +974,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: default test task', () => {
|
test('tasks: default test task', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
tasks: [
|
tasks: [
|
||||||
|
@ -989,7 +989,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: task with values', () => {
|
test('tasks: task with values', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
tasks: [
|
tasks: [
|
||||||
|
@ -999,7 +999,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
echoCommand: true,
|
echoCommand: true,
|
||||||
args: ['--p'],
|
args: ['--p'],
|
||||||
isWatching: true
|
isWatching: true
|
||||||
} as CustomTask
|
} as ICustomTask
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
let builder = new ConfiguationBuilder();
|
let builder = new ConfiguationBuilder();
|
||||||
|
@ -1015,7 +1015,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: task inherits global values', () => {
|
test('tasks: task inherits global values', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
showOutput: 'never',
|
showOutput: 'never',
|
||||||
|
@ -1036,7 +1036,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: problem matcher default', () => {
|
test('tasks: problem matcher default', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
tasks: [
|
tasks: [
|
||||||
|
@ -1058,7 +1058,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: problem matcher .* regular expression', () => {
|
test('tasks: problem matcher .* regular expression', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
tasks: [
|
tasks: [
|
||||||
|
@ -1080,7 +1080,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: problem matcher owner, applyTo, severity and fileLocation', () => {
|
test('tasks: problem matcher owner, applyTo, severity and fileLocation', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
tasks: [
|
tasks: [
|
||||||
|
@ -1112,7 +1112,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: problem matcher fileLocation and filePrefix', () => {
|
test('tasks: problem matcher fileLocation and filePrefix', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
tasks: [
|
tasks: [
|
||||||
|
@ -1138,7 +1138,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: problem pattern location', () => {
|
test('tasks: problem pattern location', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
tasks: [
|
tasks: [
|
||||||
|
@ -1166,7 +1166,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: problem pattern line & column', () => {
|
test('tasks: problem pattern line & column', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
tasks: [
|
tasks: [
|
||||||
|
@ -1199,7 +1199,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: prompt on close default', () => {
|
test('tasks: prompt on close default', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
tasks: [
|
tasks: [
|
||||||
|
@ -1216,14 +1216,14 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: prompt on close watching', () => {
|
test('tasks: prompt on close watching', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
tasks: [
|
tasks: [
|
||||||
{
|
{
|
||||||
taskName: 'taskName',
|
taskName: 'taskName',
|
||||||
isWatching: true
|
isWatching: true
|
||||||
} as CustomTask
|
} as ICustomTask
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
let builder = new ConfiguationBuilder();
|
let builder = new ConfiguationBuilder();
|
||||||
|
@ -1234,7 +1234,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: prompt on close set', () => {
|
test('tasks: prompt on close set', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
tasks: [
|
tasks: [
|
||||||
|
@ -1252,7 +1252,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: task selector set', () => {
|
test('tasks: task selector set', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
taskSelector: '/t:',
|
taskSelector: '/t:',
|
||||||
|
@ -1271,7 +1271,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: suppress task name set', () => {
|
test('tasks: suppress task name set', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
suppressTaskName: false,
|
suppressTaskName: false,
|
||||||
|
@ -1279,7 +1279,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
{
|
{
|
||||||
taskName: 'taskName',
|
taskName: 'taskName',
|
||||||
suppressTaskName: true
|
suppressTaskName: true
|
||||||
} as CustomTask
|
} as ICustomTask
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
let builder = new ConfiguationBuilder();
|
let builder = new ConfiguationBuilder();
|
||||||
|
@ -1289,7 +1289,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: suppress task name inherit', () => {
|
test('tasks: suppress task name inherit', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
suppressTaskName: true,
|
suppressTaskName: true,
|
||||||
|
@ -1306,7 +1306,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: two tasks', () => {
|
test('tasks: two tasks', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
tasks: [
|
tasks: [
|
||||||
|
@ -1327,7 +1327,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: with command', () => {
|
test('tasks: with command', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
tasks: [
|
tasks: [
|
||||||
{
|
{
|
||||||
|
@ -1342,7 +1342,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: two tasks with command', () => {
|
test('tasks: two tasks with command', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
tasks: [
|
tasks: [
|
||||||
{
|
{
|
||||||
|
@ -1362,7 +1362,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: with command and args', () => {
|
test('tasks: with command and args', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
tasks: [
|
tasks: [
|
||||||
{
|
{
|
||||||
|
@ -1376,7 +1376,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
env: 'env'
|
env: 'env'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} as CustomTask
|
} as ICustomTask
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
let builder = new ConfiguationBuilder();
|
let builder = new ConfiguationBuilder();
|
||||||
|
@ -1387,7 +1387,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
|
|
||||||
test('tasks: with command os specific', () => {
|
test('tasks: with command os specific', () => {
|
||||||
let name: string = Platform.isWindows ? 'tsc.win' : 'tsc';
|
let name: string = Platform.isWindows ? 'tsc.win' : 'tsc';
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
tasks: [
|
tasks: [
|
||||||
{
|
{
|
||||||
|
@ -1406,7 +1406,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
|
|
||||||
test('tasks: with Windows specific args', () => {
|
test('tasks: with Windows specific args', () => {
|
||||||
let args: string[] = Platform.isWindows ? ['arg1', 'arg2'] : ['arg1'];
|
let args: string[] = Platform.isWindows ? ['arg1', 'arg2'] : ['arg1'];
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
tasks: [
|
tasks: [
|
||||||
{
|
{
|
||||||
|
@ -1426,7 +1426,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
|
|
||||||
test('tasks: with Linux specific args', () => {
|
test('tasks: with Linux specific args', () => {
|
||||||
let args: string[] = Platform.isLinux ? ['arg1', 'arg2'] : ['arg1'];
|
let args: string[] = Platform.isLinux ? ['arg1', 'arg2'] : ['arg1'];
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
tasks: [
|
tasks: [
|
||||||
{
|
{
|
||||||
|
@ -1445,14 +1445,14 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: global command and task command properties', () => {
|
test('tasks: global command and task command properties', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
tasks: [
|
tasks: [
|
||||||
{
|
{
|
||||||
taskName: 'taskNameOne',
|
taskName: 'taskNameOne',
|
||||||
isShellCommand: true,
|
isShellCommand: true,
|
||||||
} as CustomTask
|
} as ICustomTask
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
let builder = new ConfiguationBuilder();
|
let builder = new ConfiguationBuilder();
|
||||||
|
@ -1461,7 +1461,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: global and tasks args', () => {
|
test('tasks: global and tasks args', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
args: ['global'],
|
args: ['global'],
|
||||||
|
@ -1478,7 +1478,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tasks: global and tasks args with task selector', () => {
|
test('tasks: global and tasks args with task selector', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
command: 'tsc',
|
command: 'tsc',
|
||||||
args: ['global'],
|
args: ['global'],
|
||||||
|
@ -1498,7 +1498,7 @@ suite('Tasks version 0.1.0', () => {
|
||||||
|
|
||||||
suite('Tasks version 2.0.0', () => {
|
suite('Tasks version 2.0.0', () => {
|
||||||
test.skip('Build workspace task', () => {
|
test.skip('Build workspace task', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '2.0.0',
|
version: '2.0.0',
|
||||||
tasks: [
|
tasks: [
|
||||||
{
|
{
|
||||||
|
@ -1518,7 +1518,7 @@ suite('Tasks version 2.0.0', () => {
|
||||||
testConfiguration(external, builder);
|
testConfiguration(external, builder);
|
||||||
});
|
});
|
||||||
test('Global group none', () => {
|
test('Global group none', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '2.0.0',
|
version: '2.0.0',
|
||||||
command: 'dir',
|
command: 'dir',
|
||||||
type: 'shell',
|
type: 'shell',
|
||||||
|
@ -1532,7 +1532,7 @@ suite('Tasks version 2.0.0', () => {
|
||||||
testConfiguration(external, builder);
|
testConfiguration(external, builder);
|
||||||
});
|
});
|
||||||
test.skip('Global group build', () => {
|
test.skip('Global group build', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '2.0.0',
|
version: '2.0.0',
|
||||||
command: 'dir',
|
command: 'dir',
|
||||||
type: 'shell',
|
type: 'shell',
|
||||||
|
@ -1547,7 +1547,7 @@ suite('Tasks version 2.0.0', () => {
|
||||||
testConfiguration(external, builder);
|
testConfiguration(external, builder);
|
||||||
});
|
});
|
||||||
test.skip('Global group default build', () => {
|
test.skip('Global group default build', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '2.0.0',
|
version: '2.0.0',
|
||||||
command: 'dir',
|
command: 'dir',
|
||||||
type: 'shell',
|
type: 'shell',
|
||||||
|
@ -1564,7 +1564,7 @@ suite('Tasks version 2.0.0', () => {
|
||||||
testConfiguration(external, builder);
|
testConfiguration(external, builder);
|
||||||
});
|
});
|
||||||
test('Local group none', () => {
|
test('Local group none', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '2.0.0',
|
version: '2.0.0',
|
||||||
tasks: [
|
tasks: [
|
||||||
{
|
{
|
||||||
|
@ -1583,7 +1583,7 @@ suite('Tasks version 2.0.0', () => {
|
||||||
testConfiguration(external, builder);
|
testConfiguration(external, builder);
|
||||||
});
|
});
|
||||||
test.skip('Local group build', () => {
|
test.skip('Local group build', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '2.0.0',
|
version: '2.0.0',
|
||||||
tasks: [
|
tasks: [
|
||||||
{
|
{
|
||||||
|
@ -1603,7 +1603,7 @@ suite('Tasks version 2.0.0', () => {
|
||||||
testConfiguration(external, builder);
|
testConfiguration(external, builder);
|
||||||
});
|
});
|
||||||
test.skip('Local group default build', () => {
|
test.skip('Local group default build', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '2.0.0',
|
version: '2.0.0',
|
||||||
tasks: [
|
tasks: [
|
||||||
{
|
{
|
||||||
|
@ -1625,7 +1625,7 @@ suite('Tasks version 2.0.0', () => {
|
||||||
testConfiguration(external, builder);
|
testConfiguration(external, builder);
|
||||||
});
|
});
|
||||||
test('Arg overwrite', () => {
|
test('Arg overwrite', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '2.0.0',
|
version: '2.0.0',
|
||||||
tasks: [
|
tasks: [
|
||||||
{
|
{
|
||||||
|
@ -1678,7 +1678,7 @@ suite('Tasks version 2.0.0', () => {
|
||||||
|
|
||||||
suite('Bugs / regression tests', () => {
|
suite('Bugs / regression tests', () => {
|
||||||
(Platform.isLinux ? test.skip : test)('Bug 19548', () => {
|
(Platform.isLinux ? test.skip : test)('Bug 19548', () => {
|
||||||
let external: ExternalTaskRunnerConfiguration = {
|
let external: IExternalTaskRunnerConfiguration = {
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
windows: {
|
windows: {
|
||||||
command: 'powershell',
|
command: 'powershell',
|
||||||
|
@ -1700,7 +1700,7 @@ suite('Bugs / regression tests', () => {
|
||||||
isBuildCommand: false,
|
isBuildCommand: false,
|
||||||
showOutput: 'always',
|
showOutput: 'always',
|
||||||
echoCommand: true
|
echoCommand: true
|
||||||
} as CustomTask
|
} as ICustomTask
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
osx: {
|
osx: {
|
||||||
|
@ -1718,7 +1718,7 @@ suite('Bugs / regression tests', () => {
|
||||||
],
|
],
|
||||||
isBuildCommand: false,
|
isBuildCommand: false,
|
||||||
showOutput: 'always'
|
showOutput: 'always'
|
||||||
} as CustomTask
|
} as ICustomTask
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1770,26 +1770,26 @@ suite('Bugs / regression tests', () => {
|
||||||
class TestNamedProblemMatcher implements Partial<ProblemMatcher> {
|
class TestNamedProblemMatcher implements Partial<ProblemMatcher> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestParseContext implements Partial<ParseContext> {
|
class TestParseContext implements Partial<IParseContext> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestTaskDefinitionRegistry implements Partial<ITaskDefinitionRegistry> {
|
class TestTaskDefinitionRegistry implements Partial<ITaskDefinitionRegistry> {
|
||||||
private _task: Tasks.TaskDefinition | undefined;
|
private _task: Tasks.ITaskDefinition | undefined;
|
||||||
public get(key: string): Tasks.TaskDefinition {
|
public get(key: string): Tasks.ITaskDefinition {
|
||||||
return this._task!;
|
return this._task!;
|
||||||
}
|
}
|
||||||
public set(task: Tasks.TaskDefinition) {
|
public set(task: Tasks.ITaskDefinition) {
|
||||||
this._task = task;
|
this._task = task;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suite('Task configuration conversions', () => {
|
suite('Task configuration conversions', () => {
|
||||||
const globals = {} as Globals;
|
const globals = {} as IGlobals;
|
||||||
const taskConfigSource = {} as TaskConfigSource;
|
const taskConfigSource = {} as TaskConfigSource;
|
||||||
const TaskDefinitionRegistry = new TestTaskDefinitionRegistry();
|
const TaskDefinitionRegistry = new TestTaskDefinitionRegistry();
|
||||||
let instantiationService: TestInstantiationService;
|
let instantiationService: TestInstantiationService;
|
||||||
let parseContext: ParseContext;
|
let parseContext: IParseContext;
|
||||||
let namedProblemMatcher: NamedProblemMatcher;
|
let namedProblemMatcher: INamedProblemMatcher;
|
||||||
let problemReporter: ProblemReporter;
|
let problemReporter: ProblemReporter;
|
||||||
setup(() => {
|
setup(() => {
|
||||||
instantiationService = new TestInstantiationService();
|
instantiationService = new TestInstantiationService();
|
||||||
|
@ -1824,18 +1824,18 @@ suite('Task configuration conversions', () => {
|
||||||
suite('CustomTask', () => {
|
suite('CustomTask', () => {
|
||||||
suite('incomplete config reports an appropriate error for missing', () => {
|
suite('incomplete config reports an appropriate error for missing', () => {
|
||||||
test('name', () => {
|
test('name', () => {
|
||||||
const result = TaskParser.from([{} as CustomTask], globals, parseContext, taskConfigSource);
|
const result = TaskParser.from([{} as ICustomTask], globals, parseContext, taskConfigSource);
|
||||||
assertTaskParseResult(result, undefined, problemReporter, 'Error: a task must provide a label property');
|
assertTaskParseResult(result, undefined, problemReporter, 'Error: a task must provide a label property');
|
||||||
});
|
});
|
||||||
test('command', () => {
|
test('command', () => {
|
||||||
const result = TaskParser.from([{ taskName: 'task' } as CustomTask], globals, parseContext, taskConfigSource);
|
const result = TaskParser.from([{ taskName: 'task' } as ICustomTask], globals, parseContext, taskConfigSource);
|
||||||
assertTaskParseResult(result, undefined, problemReporter, "Error: the task 'task' doesn't define a command");
|
assertTaskParseResult(result, undefined, problemReporter, "Error: the task 'task' doesn't define a command");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
test('returns expected result', () => {
|
test('returns expected result', () => {
|
||||||
const expected = [
|
const expected = [
|
||||||
{ taskName: 'task', command: 'echo test' } as CustomTask,
|
{ taskName: 'task', command: 'echo test' } as ICustomTask,
|
||||||
{ taskName: 'task 2', command: 'echo test' } as CustomTask
|
{ taskName: 'task 2', command: 'echo test' } as ICustomTask
|
||||||
];
|
];
|
||||||
const result = TaskParser.from(expected, globals, parseContext, taskConfigSource);
|
const result = TaskParser.from(expected, globals, parseContext, taskConfigSource);
|
||||||
assertTaskParseResult(result, { custom: expected }, problemReporter, undefined);
|
assertTaskParseResult(result, { custom: expected }, problemReporter, undefined);
|
||||||
|
@ -1844,7 +1844,7 @@ suite('Task configuration conversions', () => {
|
||||||
suite('ConfiguredTask', () => {
|
suite('ConfiguredTask', () => {
|
||||||
test('returns expected result', () => {
|
test('returns expected result', () => {
|
||||||
const expected = [{ taskName: 'task', command: 'echo test', type: 'any', label: 'task' }, { taskName: 'task 2', command: 'echo test', type: 'any', label: 'task 2' }];
|
const expected = [{ taskName: 'task', command: 'echo test', type: 'any', label: 'task' }, { taskName: 'task 2', command: 'echo test', type: 'any', label: 'task 2' }];
|
||||||
TaskDefinitionRegistry.set({ extensionId: 'registered', taskType: 'any', properties: {} } as Tasks.TaskDefinition);
|
TaskDefinitionRegistry.set({ extensionId: 'registered', taskType: 'any', properties: {} } as Tasks.ITaskDefinition);
|
||||||
const result = TaskParser.from(expected, globals, parseContext, taskConfigSource, TaskDefinitionRegistry);
|
const result = TaskParser.from(expected, globals, parseContext, taskConfigSource, TaskDefinitionRegistry);
|
||||||
assertTaskParseResult(result, { configured: expected }, problemReporter, undefined);
|
assertTaskParseResult(result, { configured: expected }, problemReporter, undefined);
|
||||||
});
|
});
|
||||||
|
@ -1852,7 +1852,7 @@ suite('Task configuration conversions', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function assertTaskParseResult(actual: TaskParseResult, expected: ITestTaskParseResult | undefined, problemReporter: ProblemReporter, expectedMessage?: string): void {
|
function assertTaskParseResult(actual: ITaskParseResult, expected: ITestTaskParseResult | undefined, problemReporter: ProblemReporter, expectedMessage?: string): void {
|
||||||
if (expectedMessage === undefined) {
|
if (expectedMessage === undefined) {
|
||||||
assert.strictEqual(problemReporter.lastMessage, undefined);
|
assert.strictEqual(problemReporter.lastMessage, undefined);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1880,10 +1880,10 @@ function assertTaskParseResult(actual: TaskParseResult, expected: ITestTaskParse
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ITestTaskParseResult {
|
interface ITestTaskParseResult {
|
||||||
custom?: Partial<CustomTask>[];
|
custom?: Partial<ICustomTask>[];
|
||||||
configured?: Partial<TestConfiguringTask>[];
|
configured?: Partial<ITestConfiguringTask>[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface TestConfiguringTask extends Partial<Tasks.ConfiguringTask> {
|
interface ITestConfiguringTask extends Partial<Tasks.ConfiguringTask> {
|
||||||
label: string;
|
label: string;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue