diff --git a/extensions/npm/src/commands.ts b/extensions/npm/src/commands.ts index 6847f322631..295ae306c3f 100644 --- a/extensions/npm/src/commands.ts +++ b/extensions/npm/src/commands.ts @@ -10,7 +10,7 @@ import { detectNpmScriptsForFolder, findScriptAtPosition, runScript, - FolderTaskItem + IFolderTaskItem } from './tasks'; const localize = nls.loadMessageBundle(); @@ -37,17 +37,17 @@ export async function selectAndRunScriptFromFolder(context: vscode.ExtensionCont } const selectedFolder = selectedFolders[0]; - let taskList: FolderTaskItem[] = await detectNpmScriptsForFolder(context, selectedFolder); + let taskList: IFolderTaskItem[] = await detectNpmScriptsForFolder(context, selectedFolder); if (taskList && taskList.length > 0) { - const quickPick = vscode.window.createQuickPick(); + const quickPick = vscode.window.createQuickPick(); quickPick.title = 'Run NPM script in Folder'; quickPick.placeholder = 'Select an npm script'; quickPick.items = taskList; const toDispose: vscode.Disposable[] = []; - let pickPromise = new Promise((c) => { + let pickPromise = new Promise((c) => { toDispose.push(quickPick.onDidAccept(() => { toDispose.forEach(d => d.dispose()); c(quickPick.selectedItems[0]); diff --git a/extensions/npm/src/npmView.ts b/extensions/npm/src/npmView.ts index 41e28e9bdf5..e7bfd08bd7c 100644 --- a/extensions/npm/src/npmView.ts +++ b/extensions/npm/src/npmView.ts @@ -14,10 +14,10 @@ import { import * as nls from 'vscode-nls'; import { readScripts } from './readScripts'; import { - createTask, getPackageManager, getTaskName, isAutoDetectionEnabled, isWorkspaceFolder, NpmTaskDefinition, + createTask, getPackageManager, getTaskName, isAutoDetectionEnabled, isWorkspaceFolder, INpmTaskDefinition, NpmTaskProvider, startDebugging, - TaskWithLocation + ITaskWithLocation } from './tasks'; const localize = nls.loadMessageBundle(); @@ -78,7 +78,7 @@ class NpmScript extends TreeItem { package: PackageJSON; taskLocation?: Location; - constructor(_context: ExtensionContext, packageJson: PackageJSON, task: TaskWithLocation) { + constructor(_context: ExtensionContext, packageJson: PackageJSON, task: ITaskWithLocation) { const name = packageJson.path.length > 0 ? task.task.name.substring(0, task.task.name.length - packageJson.path.length - 2) : task.task.name; @@ -284,7 +284,7 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider { }); } - private buildTaskTree(tasks: TaskWithLocation[]): TaskTree { + private buildTaskTree(tasks: ITaskWithLocation[]): TaskTree { let folders: Map = new Map(); let packages: Map = new Map(); @@ -301,7 +301,7 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider { } const regularExpressions = (location && excludeConfig.has(location.uri.toString())) ? excludeConfig.get(location.uri.toString()) : undefined; - if (regularExpressions && regularExpressions.some((regularExpression) => (each.task.definition).script.match(regularExpression))) { + if (regularExpressions && regularExpressions.some((regularExpression) => (each.task.definition).script.match(regularExpression))) { return; } @@ -311,7 +311,7 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider { folder = new Folder(each.task.scope); folders.set(each.task.scope.name, folder); } - let definition: NpmTaskDefinition = each.task.definition; + let definition: INpmTaskDefinition = each.task.definition; let relativePath = definition.path ? definition.path : ''; let fullPath = path.join(each.task.scope.name, relativePath); packageJson = packages.get(fullPath); diff --git a/extensions/npm/src/tasks.ts b/extensions/npm/src/tasks.ts index d05b7bbc8bf..47237442d98 100644 --- a/extensions/npm/src/tasks.ts +++ b/extensions/npm/src/tasks.ts @@ -17,28 +17,28 @@ import { readScripts } from './readScripts'; const localize = nls.loadMessageBundle(); -export interface NpmTaskDefinition extends TaskDefinition { +export interface INpmTaskDefinition extends TaskDefinition { script: string; path?: string; } -export interface FolderTaskItem extends QuickPickItem { +export interface IFolderTaskItem extends QuickPickItem { label: string; task: Task; } type AutoDetect = 'on' | 'off'; -let cachedTasks: TaskWithLocation[] | undefined = undefined; +let cachedTasks: ITaskWithLocation[] | undefined = undefined; const INSTALL_SCRIPT = 'install'; -export interface TaskLocation { +export interface ITaskLocation { document: Uri; line: Position; } -export interface TaskWithLocation { +export interface ITaskWithLocation { task: Task; location?: Location; } @@ -48,7 +48,7 @@ export class NpmTaskProvider implements TaskProvider { constructor(private context: ExtensionContext) { } - get tasksWithLocation(): Promise { + get tasksWithLocation(): Promise { return provideNpmScripts(this.context, false); } @@ -60,7 +60,7 @@ export class NpmTaskProvider implements TaskProvider { public async resolveTask(_task: Task): Promise { const npmTask = (_task.definition).script; if (npmTask) { - const kind: NpmTaskDefinition = (_task.definition); + const kind: INpmTaskDefinition = (_task.definition); let packageJsonUri: Uri; if (_task.scope === undefined || _task.scope === TaskScope.Global || _task.scope === TaskScope.Workspace) { // scope is required to be a WorkspaceFolder for resolveTask @@ -170,10 +170,10 @@ export async function hasNpmScripts(): Promise { } } -async function detectNpmScripts(context: ExtensionContext, showWarning: boolean): Promise { +async function detectNpmScripts(context: ExtensionContext, showWarning: boolean): Promise { - let emptyTasks: TaskWithLocation[] = []; - let allTasks: TaskWithLocation[] = []; + let emptyTasks: ITaskWithLocation[] = []; + let allTasks: ITaskWithLocation[] = []; let visitedPackageJsonFiles: Set = new Set(); let folders = workspace.workspaceFolders; @@ -201,9 +201,9 @@ async function detectNpmScripts(context: ExtensionContext, showWarning: boolean) } -export async function detectNpmScriptsForFolder(context: ExtensionContext, folder: Uri): Promise { +export async function detectNpmScriptsForFolder(context: ExtensionContext, folder: Uri): Promise { - let folderTasks: FolderTaskItem[] = []; + let folderTasks: IFolderTaskItem[] = []; try { 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 { +export async function provideNpmScripts(context: ExtensionContext, showWarning: boolean): Promise { if (!cachedTasks) { cachedTasks = await detectNpmScripts(context, showWarning); } @@ -261,8 +261,8 @@ function isDebugScript(script: string): boolean { return match !== null; } -async function provideNpmScriptsForFolder(context: ExtensionContext, packageJsonUri: Uri, showWarning: boolean): Promise { - let emptyTasks: TaskWithLocation[] = []; +async function provideNpmScriptsForFolder(context: ExtensionContext, packageJsonUri: Uri, showWarning: boolean): Promise { + let emptyTasks: ITaskWithLocation[] = []; let folder = workspace.getWorkspaceFolder(packageJsonUri); if (!folder) { @@ -273,7 +273,7 @@ async function provideNpmScriptsForFolder(context: ExtensionContext, packageJson return emptyTasks; } - const result: TaskWithLocation[] = []; + const result: ITaskWithLocation[] = []; const packageManager = await getPackageManager(context, folder.uri, showWarning); @@ -294,8 +294,8 @@ export function getTaskName(script: string, relativePath: string | undefined) { return script; } -export async function createTask(packageManager: string, script: NpmTaskDefinition | string, cmd: string[], folder: WorkspaceFolder, packageJsonUri: Uri, scriptValue?: string, matcher?: any): Promise { - let kind: NpmTaskDefinition; +export async function createTask(packageManager: string, script: INpmTaskDefinition | string, cmd: string[], folder: WorkspaceFolder, packageJsonUri: Uri, scriptValue?: string, matcher?: any): Promise { + let kind: INpmTaskDefinition; if (typeof script === 'string') { kind = { type: 'npm', script: script }; } else { diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.tasks.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.tasks.test.ts index a7b497e5467..4167e15ce00 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.tasks.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.tasks.test.ts @@ -147,7 +147,7 @@ import { assertNoRpc } from '../utils'; suite('CustomExecution', () => { test('task should start and shutdown successfully', async () => { 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 */ @@ -179,7 +179,7 @@ import { assertNoRpc } from '../utils'; disposables.push(tasks.registerTaskProvider(taskType, { provideTasks: () => { const result: Task[] = []; - const kind: CustomTestingTaskDefinition = { + const kind: ICustomTestingTaskDefinition = { type: taskType, customProp1: 'testing task one' }; @@ -235,7 +235,7 @@ import { assertNoRpc } from '../utils'; }); 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 */ @@ -250,7 +250,7 @@ import { assertNoRpc } from '../utils'; disposables.push(tasks.registerTaskProvider(taskType, { provideTasks: () => { const result: Task[] = []; - const kind: CustomTestingTaskDefinition = { + const kind: ICustomTestingTaskDefinition = { type: taskType, customProp1: 'testing task one' }; diff --git a/src/vs/workbench/api/browser/mainThreadTask.ts b/src/vs/workbench/api/browser/mainThreadTask.ts index 9cd5c8235f9..d23e70f39d2 100644 --- a/src/vs/workbench/api/browser/mainThreadTask.ts +++ b/src/vs/workbench/api/browser/mainThreadTask.ts @@ -15,27 +15,27 @@ import { IDisposable } from 'vs/base/common/lifecycle'; import { IWorkspace, IWorkspaceContextService, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; import { - ContributedTask, ConfiguringTask, KeyedTaskIdentifier, TaskExecution, Task, TaskEvent, TaskEventKind, - PresentationOptions, CommandOptions, CommandConfiguration, RuntimeType, CustomTask, TaskScope, TaskSource, - TaskSourceKind, ExtensionTaskSource, RunOptions, TaskSet, TaskDefinition, TaskGroup + ContributedTask, ConfiguringTask, KeyedTaskIdentifier, ITaskExecution, Task, ITaskEvent, TaskEventKind, + IPresentationOptions, CommandOptions, ICommandConfiguration, RuntimeType, CustomTask, TaskScope, TaskSource, + TaskSourceKind, IExtensionTaskSource, IRunOptions, ITaskSet, TaskGroup, TaskDefinition, PresentationOptions, RunOptions } from 'vs/workbench/contrib/tasks/common/tasks'; -import { ResolveSet, ResolvedVariables } from 'vs/workbench/contrib/tasks/common/taskSystem'; -import { ITaskService, TaskFilter, ITaskProvider } from 'vs/workbench/contrib/tasks/common/taskService'; +import { IResolveSet, IResolvedVariables } from 'vs/workbench/contrib/tasks/common/taskSystem'; +import { ITaskService, ITaskFilter, ITaskProvider } from 'vs/workbench/contrib/tasks/common/taskService'; import { extHostNamedCustomer, IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers'; import { ExtHostContext, MainThreadTaskShape, ExtHostTaskShape, MainContext } from 'vs/workbench/api/common/extHost.protocol'; import { - TaskDefinitionDTO, TaskExecutionDTO, ProcessExecutionOptionsDTO, TaskPresentationOptionsDTO, - ProcessExecutionDTO, ShellExecutionDTO, ShellExecutionOptionsDTO, CustomExecutionDTO, TaskDTO, TaskSourceDTO, TaskHandleDTO, TaskFilterDTO, TaskProcessStartedDTO, TaskProcessEndedDTO, TaskSystemInfoDTO, - RunOptionsDTO, TaskGroupDTO + ITaskDefinitionDTO, ITaskExecutionDTO, IProcessExecutionOptionsDTO, ITaskPresentationOptionsDTO, + IProcessExecutionDTO, IShellExecutionDTO, IShellExecutionOptionsDTO, ICustomExecutionDTO, ITaskDTO, ITaskSourceDTO, ITaskHandleDTO, ITaskFilterDTO, ITaskProcessStartedDTO, ITaskProcessEndedDTO, ITaskSystemInfoDTO, + IRunOptionsDTO, ITaskGroupDTO } from 'vs/workbench/api/common/shared/tasks'; import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver'; import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; namespace TaskExecutionDTO { - export function from(value: TaskExecution): TaskExecutionDTO { + export function from(value: ITaskExecution): ITaskExecutionDTO { return { id: value.id, task: TaskDTO.from(value.task) @@ -44,7 +44,7 @@ namespace TaskExecutionDTO { } namespace TaskProcessStartedDTO { - export function from(value: TaskExecution, processId: number): TaskProcessStartedDTO { + export function from(value: ITaskExecution, processId: number): ITaskProcessStartedDTO { return { id: value.id, processId @@ -53,7 +53,7 @@ namespace TaskProcessStartedDTO { } namespace TaskProcessEndedDTO { - export function from(value: TaskExecution, exitCode: number | undefined): TaskProcessEndedDTO { + export function from(value: ITaskExecution, exitCode: number | undefined): ITaskProcessEndedDTO { return { id: value.id, exitCode @@ -62,12 +62,12 @@ namespace TaskProcessEndedDTO { } namespace TaskDefinitionDTO { - export function from(value: KeyedTaskIdentifier): TaskDefinitionDTO { + export function from(value: KeyedTaskIdentifier): ITaskDefinitionDTO { const result = Object.assign(Object.create(null), value); delete result._key; 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); if (result === undefined && executeOnly) { result = { @@ -80,13 +80,13 @@ namespace TaskDefinitionDTO { } namespace TaskPresentationOptionsDTO { - export function from(value: PresentationOptions | undefined): TaskPresentationOptionsDTO | undefined { + export function from(value: IPresentationOptions | undefined): ITaskPresentationOptionsDTO | undefined { if (value === undefined || value === null) { return undefined; } 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) { return PresentationOptions.defaults; } @@ -95,13 +95,13 @@ namespace TaskPresentationOptionsDTO { } namespace RunOptionsDTO { - export function from(value: RunOptions): RunOptionsDTO | undefined { + export function from(value: IRunOptions): IRunOptionsDTO | undefined { if (value === undefined || value === null) { return undefined; } 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) { return RunOptions.defaults; } @@ -110,7 +110,7 @@ namespace RunOptionsDTO { } namespace ProcessExecutionOptionsDTO { - export function from(value: CommandOptions): ProcessExecutionOptionsDTO | undefined { + export function from(value: CommandOptions): IProcessExecutionOptionsDTO | undefined { if (value === undefined || value === null) { return undefined; } @@ -119,7 +119,7 @@ namespace ProcessExecutionOptionsDTO { env: value.env }; } - export function to(value: ProcessExecutionOptionsDTO | undefined): CommandOptions { + export function to(value: IProcessExecutionOptionsDTO | undefined): CommandOptions { if (value === undefined || value === null) { return CommandOptions.defaults; } @@ -131,14 +131,14 @@ namespace ProcessExecutionOptionsDTO { } namespace ProcessExecutionDTO { - export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO): value is ProcessExecutionDTO { - const candidate = value as ProcessExecutionDTO; + export function is(value: IShellExecutionDTO | IProcessExecutionDTO | ICustomExecutionDTO): value is IProcessExecutionDTO { + const candidate = value as IProcessExecutionDTO; 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 args: string[] = value.args ? value.args.map(value => Types.isString(value) ? value : value.value) : []; - const result: ProcessExecutionDTO = { + const result: IProcessExecutionDTO = { process: process, args: args }; @@ -147,8 +147,8 @@ namespace ProcessExecutionDTO { } return result; } - export function to(value: ProcessExecutionDTO): CommandConfiguration { - const result: CommandConfiguration = { + export function to(value: IProcessExecutionDTO): ICommandConfiguration { + const result: ICommandConfiguration = { runtime: RuntimeType.Process, name: value.process, args: value.args, @@ -160,11 +160,11 @@ namespace ProcessExecutionDTO { } namespace ShellExecutionOptionsDTO { - export function from(value: CommandOptions): ShellExecutionOptionsDTO | undefined { + export function from(value: CommandOptions): IShellExecutionOptionsDTO | undefined { if (value === undefined || value === null) { return undefined; } - const result: ShellExecutionOptionsDTO = { + const result: IShellExecutionOptionsDTO = { cwd: value.cwd || CommandOptions.defaults.cwd, env: value.env }; @@ -175,7 +175,7 @@ namespace ShellExecutionOptionsDTO { } return result; } - export function to(value: ShellExecutionOptionsDTO): CommandOptions | undefined { + export function to(value: IShellExecutionOptionsDTO): CommandOptions | undefined { if (value === undefined || value === null) { return undefined; } @@ -199,12 +199,12 @@ namespace ShellExecutionOptionsDTO { } namespace ShellExecutionDTO { - export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO): value is ShellExecutionDTO { - const candidate = value as ShellExecutionDTO; + export function is(value: IShellExecutionDTO | IProcessExecutionDTO | ICustomExecutionDTO): value is IShellExecutionDTO { + const candidate = value as IShellExecutionDTO; return candidate && (!!candidate.commandLine || !!candidate.command); } - export function from(value: CommandConfiguration): ShellExecutionDTO { - const result: ShellExecutionDTO = {}; + export function from(value: ICommandConfiguration): IShellExecutionDTO { + const result: IShellExecutionDTO = {}; if (value.name && Types.isString(value.name) && (value.args === undefined || value.args === null || value.args.length === 0)) { result.commandLine = value.name; } else { @@ -216,8 +216,8 @@ namespace ShellExecutionDTO { } return result; } - export function to(value: ShellExecutionDTO): CommandConfiguration { - const result: CommandConfiguration = { + export function to(value: IShellExecutionDTO): ICommandConfiguration { + const result: ICommandConfiguration = { runtime: RuntimeType.Shell, name: value.commandLine ? value.commandLine : value.command, args: value.args, @@ -231,18 +231,18 @@ namespace ShellExecutionDTO { } namespace CustomExecutionDTO { - export function is(value: ShellExecutionDTO | ProcessExecutionDTO | CustomExecutionDTO): value is CustomExecutionDTO { - const candidate = value as CustomExecutionDTO; + export function is(value: IShellExecutionDTO | IProcessExecutionDTO | ICustomExecutionDTO): value is ICustomExecutionDTO { + const candidate = value as ICustomExecutionDTO; return candidate && candidate.customExecution === 'customExecution'; } - export function from(value: CommandConfiguration): CustomExecutionDTO { + export function from(value: ICommandConfiguration): ICustomExecutionDTO { return { customExecution: 'customExecution' }; } - export function to(value: CustomExecutionDTO): CommandConfiguration { + export function to(value: ICustomExecutionDTO): ICommandConfiguration { return { runtime: RuntimeType.CustomExecution, presentation: undefined @@ -251,8 +251,8 @@ namespace CustomExecutionDTO { } namespace TaskSourceDTO { - export function from(value: TaskSource): TaskSourceDTO { - const result: TaskSourceDTO = { + export function from(value: TaskSource): ITaskSourceDTO { + const result: ITaskSourceDTO = { label: value.label }; if (value.kind === TaskSourceKind.Extension) { @@ -268,7 +268,7 @@ namespace TaskSourceDTO { } return result; } - export function to(value: TaskSourceDTO, workspace: IWorkspaceContextService): ExtensionTaskSource { + export function to(value: ITaskSourceDTO, workspace: IWorkspaceContextService): IExtensionTaskSource { let scope: TaskScope; let workspaceFolder: IWorkspaceFolder | undefined; if ((value.scope === undefined) || ((typeof value.scope === 'number') && (value.scope !== TaskScope.Global))) { @@ -285,7 +285,7 @@ namespace TaskSourceDTO { scope = TaskScope.Folder; workspaceFolder = Types.withNullAsUndefined(workspace.getWorkspaceFolder(URI.revive(value.scope))); } - const result: ExtensionTaskSource = { + const result: IExtensionTaskSource = { kind: TaskSourceKind.Extension, label: value.label, extension: value.extensionId, @@ -297,18 +297,18 @@ namespace TaskSourceDTO { } namespace TaskHandleDTO { - export function is(value: any): value is TaskHandleDTO { - const candidate: TaskHandleDTO = value; + export function is(value: any): value is ITaskHandleDTO { + const candidate: ITaskHandleDTO = value; return candidate && Types.isString(candidate.id) && !!candidate.workspaceFolder; } } 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))) { return undefined; } - const result: TaskDTO = { + const result: ITaskDTO = { _id: task._id, name: task.configurationProperties.name, definition: TaskDefinitionDTO.from(task.getDefinition(true)), @@ -342,12 +342,12 @@ namespace TaskDTO { 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')) { return undefined; } - let command: CommandConfiguration | undefined; + let command: ICommandConfiguration | undefined; if (task.execution) { if (ShellExecutionDTO.is(task.execution)) { command = ShellExecutionDTO.to(task.execution); @@ -390,7 +390,7 @@ namespace TaskDTO { } namespace TaskGroupDTO { - export function from(value: string | TaskGroup | undefined): TaskGroupDTO | undefined { + export function from(value: string | TaskGroup | undefined): ITaskGroupDTO | undefined { if (value === undefined) { return undefined; } @@ -402,10 +402,10 @@ namespace TaskGroupDTO { } namespace TaskFilterDTO { - export function from(value: TaskFilter): TaskFilterDTO { + export function from(value: ITaskFilter): ITaskFilterDTO { return value; } - export function to(value: TaskFilterDTO | undefined): TaskFilter | undefined { + export function to(value: ITaskFilterDTO | undefined): ITaskFilter | undefined { return value; } } @@ -425,11 +425,11 @@ export class MainThreadTask implements MainThreadTaskShape { ) { this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostTask); this._providers = new Map(); - this._taskService.onDidStateChange(async (event: TaskEvent) => { + this._taskService.onDidStateChange(async (event: ITaskEvent) => { const task = event.__task!; if (event.kind === TaskEventKind.Start) { 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) { const dictionary: IStringDictionary = {}; Array.from(event.resolvedVariables.entries()).forEach(entry => dictionary[entry[0]] = entry[1]); @@ -454,7 +454,7 @@ export class MainThreadTask implements MainThreadTaskShape { this._providers.clear(); } - $createTaskId(taskDTO: TaskDTO): Promise { + $createTaskId(taskDTO: ITaskDTO): Promise { return new Promise((resolve, reject) => { let task = TaskDTO.to(taskDTO, this._workspaceContextServer, true); if (task) { @@ -481,7 +481,7 @@ export class MainThreadTask implements MainThreadTaskShape { return { tasks, extension: value.extension - } as TaskSet; + } as ITaskSet; }); }, resolveTask: (task: ConfiguringTask) => { @@ -514,9 +514,9 @@ export class MainThreadTask implements MainThreadTaskShape { return Promise.resolve(undefined); } - public $fetchTasks(filter?: TaskFilterDTO): Promise { + public $fetchTasks(filter?: ITaskFilterDTO): Promise { return this._taskService.tasks(TaskFilterDTO.to(filter)).then((tasks) => { - const result: TaskDTO[] = []; + const result: ITaskDTO[] = []; for (let task of tasks) { const item = TaskDTO.from(task); if (item) { @@ -543,7 +543,7 @@ export class MainThreadTask implements MainThreadTaskShape { return workspace; } - public async $getTaskExecution(value: TaskHandleDTO | TaskDTO): Promise { + public async $getTaskExecution(value: ITaskHandleDTO | ITaskDTO): Promise { if (TaskHandleDTO.is(value)) { const workspace = this.getWorkspace(value.workspaceFolder); 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, // such as those gotten from a fetchTasks, since they can have missing configuration properties. - public $executeTask(value: TaskHandleDTO | TaskDTO): Promise { - return new Promise((resolve, reject) => { + public $executeTask(value: ITaskHandleDTO | ITaskDTO): Promise { + return new Promise((resolve, reject) => { if (TaskHandleDTO.is(value)) { const workspace = this.getWorkspace(value.workspaceFolder); if (workspace) { @@ -578,7 +578,7 @@ export class MainThreadTask implements MainThreadTaskShape { if (!task) { reject(new Error('Task not found')); } else { - const result: TaskExecutionDTO = { + const result: ITaskExecutionDTO = { id: value.id, task: TaskDTO.from(task) }; @@ -604,7 +604,7 @@ export class MainThreadTask implements MainThreadTaskShape { 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 }); - const result: TaskExecutionDTO = { + const result: ITaskExecutionDTO = { id: task._id, 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; switch (info.platform) { case 'Web': @@ -674,7 +674,7 @@ export class MainThreadTask implements MainThreadTaskShape { return URI.from({ scheme: info.scheme, authority: info.authority, path }); }, context: this._extHostContext, - resolveVariables: (workspaceFolder: IWorkspaceFolder, toResolve: ResolveSet, target: ConfigurationTarget): Promise => { + resolveVariables: (workspaceFolder: IWorkspaceFolder, toResolve: IResolveSet, target: ConfigurationTarget): Promise => { const vars: string[] = []; toResolve.variables.forEach(item => vars.push(item)); 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) => { partiallyResolvedVars.push(entry.value); }); - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { this._configurationResolverService.resolveWithInteraction(workspaceFolder, partiallyResolvedVars, 'tasks', undefined, target).then(resolvedVars => { if (!resolvedVars) { resolve(undefined); } - const result: ResolvedVariables = { + const result: IResolvedVariables = { process: undefined, variables: new Map() }; diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 3b29ae91432..865a0e5c4eb 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -1111,14 +1111,14 @@ export interface MainThreadSearchShape extends IDisposable { } export interface MainThreadTaskShape extends IDisposable { - $createTaskId(task: tasks.TaskDTO): Promise; + $createTaskId(task: tasks.ITaskDTO): Promise; $registerTaskProvider(handle: number, type: string): Promise; $unregisterTaskProvider(handle: number): Promise; - $fetchTasks(filter?: tasks.TaskFilterDTO): Promise; - $getTaskExecution(value: tasks.TaskHandleDTO | tasks.TaskDTO): Promise; - $executeTask(task: tasks.TaskHandleDTO | tasks.TaskDTO): Promise; + $fetchTasks(filter?: tasks.ITaskFilterDTO): Promise; + $getTaskExecution(value: tasks.ITaskHandleDTO | tasks.ITaskDTO): Promise; + $executeTask(task: tasks.ITaskHandleDTO | tasks.ITaskDTO): Promise; $terminateTask(id: string): Promise; - $registerTaskSystem(scheme: string, info: tasks.TaskSystemInfoDTO): void; + $registerTaskSystem(scheme: string, info: tasks.ITaskSystemInfoDTO): void; $customExecutionComplete(id: string, result?: number): Promise; $registerSupportedExecutions(custom?: boolean, shell?: boolean, process?: boolean): Promise; } @@ -1841,12 +1841,12 @@ export interface ExtHostSCMShape { } export interface ExtHostTaskShape { - $provideTasks(handle: number, validTypes: { [key: string]: boolean }): Promise; - $resolveTask(handle: number, taskDTO: tasks.TaskDTO): Promise; - $onDidStartTask(execution: tasks.TaskExecutionDTO, terminalId: number, resolvedDefinition: tasks.TaskDefinitionDTO): void; - $onDidStartTaskProcess(value: tasks.TaskProcessStartedDTO): void; - $onDidEndTaskProcess(value: tasks.TaskProcessEndedDTO): void; - $OnDidEndTask(execution: tasks.TaskExecutionDTO): void; + $provideTasks(handle: number, validTypes: { [key: string]: boolean }): Promise; + $resolveTask(handle: number, taskDTO: tasks.ITaskDTO): Promise; + $onDidStartTask(execution: tasks.ITaskExecutionDTO, terminalId: number, resolvedDefinition: tasks.ITaskDefinitionDTO): void; + $onDidStartTaskProcess(value: tasks.ITaskProcessStartedDTO): void; + $onDidEndTaskProcess(value: tasks.ITaskProcessEndedDTO): void; + $OnDidEndTask(execution: tasks.ITaskExecutionDTO): void; $resolveVariables(workspaceFolder: UriComponents, toResolve: { process?: { name: string; cwd?: string }; variables: string[] }): Promise<{ process?: string; variables: { [key: string]: string } }>; $jsonTasksSupported(): Promise; $findExecutable(command: string, cwd?: string, paths?: string[]): Promise; diff --git a/src/vs/workbench/api/common/extHostTask.ts b/src/vs/workbench/api/common/extHostTask.ts index c05d65eee9e..9c556708217 100644 --- a/src/vs/workbench/api/common/extHostTask.ts +++ b/src/vs/workbench/api/common/extHostTask.ts @@ -38,20 +38,20 @@ export interface IExtHostTask extends ExtHostTaskShape { onDidEndTaskProcess: Event; 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; executeTask(extension: IExtensionDescription, task: vscode.Task): Promise; terminateTask(execution: vscode.TaskExecution): Promise; } 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) { return undefined; } 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) { return undefined; } @@ -60,13 +60,13 @@ export namespace TaskDefinitionDTO { } 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) { return undefined; } 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) { return undefined; } @@ -75,13 +75,13 @@ export namespace TaskPresentationOptionsDTO { } 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) { return undefined; } 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) { return undefined; } @@ -90,19 +90,19 @@ export namespace ProcessExecutionOptionsDTO { } 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) { - const candidate = value as tasks.ProcessExecutionDTO; + const candidate = value as tasks.IProcessExecutionDTO; return candidate && !!candidate.process; } else { 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) { return undefined; } - const result: tasks.ProcessExecutionDTO = { + const result: tasks.IProcessExecutionDTO = { process: value.process, args: value.args }; @@ -111,7 +111,7 @@ export namespace ProcessExecutionDTO { } 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) { return undefined; } @@ -120,13 +120,13 @@ export namespace ProcessExecutionDTO { } 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) { return undefined; } 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) { return undefined; } @@ -135,19 +135,19 @@ export namespace ShellExecutionOptionsDTO { } 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) { - const candidate = value as tasks.ShellExecutionDTO; + const candidate = value as tasks.IShellExecutionDTO; return candidate && (!!candidate.commandLine || !!candidate.command); } else { 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) { return undefined; } - const result: tasks.ShellExecutionDTO = { + const result: tasks.IShellExecutionDTO = { }; if (value.commandLine !== undefined) { result.commandLine = value.commandLine; @@ -160,7 +160,7 @@ export namespace ShellExecutionDTO { } 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)) { return undefined; } @@ -173,16 +173,16 @@ export namespace ShellExecutionDTO { } 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) { - let candidate = value as tasks.CustomExecutionDTO; + let candidate = value as tasks.ICustomExecutionDTO; return candidate && candidate.customExecution === 'customExecution'; } else { return false; } } - export function from(value: vscode.CustomExecution): tasks.CustomExecutionDTO { + export function from(value: vscode.CustomExecution): tasks.ICustomExecutionDTO { return { customExecution: 'customExecution' }; @@ -195,7 +195,7 @@ export namespace CustomExecutionDTO { 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; if (value.scope !== undefined && typeof value.scope !== 'number') { folder = value.scope.uri; @@ -213,7 +213,7 @@ export namespace TaskHandleDTO { } } 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) { return undefined; } @@ -222,11 +222,11 @@ export namespace TaskGroupDTO { } 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) { return []; } - const result: tasks.TaskDTO[] = []; + const result: tasks.ITaskDTO[] = []; for (let task of tasks) { const converted = from(task, extension); if (converted) { @@ -236,11 +236,11 @@ export namespace TaskDTO { 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) { 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) { execution = ProcessExecutionDTO.from(value.execution); } else if (value.execution instanceof types.ShellExecution) { @@ -249,7 +249,7 @@ export namespace TaskDTO { execution = CustomExecutionDTO.from(value.execution); } - const definition: tasks.TaskDefinitionDTO | undefined = TaskDefinitionDTO.from(value.definition); + const definition: tasks.ITaskDefinitionDTO | undefined = TaskDefinitionDTO.from(value.definition); let scope: number | UriComponents; if (value.scope) { if (typeof value.scope === 'number') { @@ -264,7 +264,7 @@ export namespace TaskDTO { if (!definition || !scope) { return undefined; } - const result: tasks.TaskDTO = { + const result: tasks.ITaskDTO = { _id: (value as types.Task)._id!, definition, name: value.name, @@ -284,7 +284,7 @@ export namespace TaskDTO { }; return result; } - export async function to(value: tasks.TaskDTO | undefined, workspace: IExtHostWorkspaceProvider, providedCustomExeutions: Map): Promise { + export async function to(value: tasks.ITaskDTO | undefined, workspace: IExtHostWorkspaceProvider, providedCustomExeutions: Map): Promise { if (value === undefined || value === null) { return undefined; } @@ -339,11 +339,11 @@ export namespace TaskDTO { } 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; } - export function to(value: tasks.TaskFilterDTO): vscode.TaskFilter | undefined { + export function to(value: tasks.ITaskFilterDTO): vscode.TaskFilter | undefined { if (!value) { return undefined; } @@ -367,15 +367,15 @@ class TaskExecutionImpl implements vscode.TaskExecution { 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 function from(value: vscode.TaskExecution): tasks.TaskExecutionDTO { + export function from(value: vscode.TaskExecution): tasks.ITaskExecutionDTO { return { id: (value as TaskExecutionImpl)._id, 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); } @@ -489,7 +489,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask return this._onDidExecuteTask.event; } - public async $onDidStartTask(execution: tasks.TaskExecutionDTO, terminalId: number, resolvedDefinition: tasks.TaskDefinitionDTO): Promise { + public async $onDidStartTask(execution: tasks.ITaskExecutionDTO, terminalId: number, resolvedDefinition: tasks.ITaskDefinitionDTO): Promise { const customExecution: types.CustomExecution | undefined = this._providedCustomExecutions2.get(execution.id); if (customExecution) { // 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; } - public async $OnDidEndTask(execution: tasks.TaskExecutionDTO): Promise { + public async $OnDidEndTask(execution: tasks.ITaskExecutionDTO): Promise { const _execution = await this.getTaskExecution(execution); this._taskExecutionPromises.delete(execution.id); this._taskExecutions.delete(execution.id); @@ -521,7 +521,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask return this._onDidTaskProcessStarted.event; } - public async $onDidStartTaskProcess(value: tasks.TaskProcessStartedDTO): Promise { + public async $onDidStartTaskProcess(value: tasks.ITaskProcessStartedDTO): Promise { const execution = await this.getTaskExecution(value.id); this._onDidTaskProcessStarted.fire({ execution: execution, @@ -533,7 +533,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask return this._onDidTaskProcessEnded.event; } - public async $onDidEndTaskProcess(value: tasks.TaskProcessEndedDTO): Promise { + public async $onDidEndTaskProcess(value: tasks.ITaskProcessEndedDTO): Promise { const execution = await this.getTaskExecution(value.id); this._onDidTaskProcessEnded.fire({ execution: execution, @@ -541,9 +541,9 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask }); } - protected abstract provideTasksInternal(validTypes: { [key: string]: boolean }, taskIdPromises: Promise[], handler: HandlerData, value: vscode.Task[] | null | undefined): { tasks: tasks.TaskDTO[]; extension: IExtensionDescription }; + protected abstract provideTasksInternal(validTypes: { [key: string]: boolean }, taskIdPromises: Promise[], handler: HandlerData, value: vscode.Task[] | null | undefined): { tasks: tasks.ITaskDTO[]; extension: IExtensionDescription }; - public $provideTasks(handle: number, validTypes: { [key: string]: boolean }): Promise { + public $provideTasks(handle: number, validTypes: { [key: string]: boolean }): Promise { const handler = this._handlers.get(handle); if (!handler) { 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; + protected abstract resolveTaskInternal(resolvedTaskDTO: tasks.ITaskDTO): Promise; - public async $resolveTask(handle: number, taskDTO: tasks.TaskDTO): Promise { + public async $resolveTask(handle: number, taskDTO: tasks.ITaskDTO): Promise { const handler = this._handlers.get(handle); if (!handler) { return Promise.reject(new Error('no handler found')); @@ -595,7 +595,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask 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) { throw new Error('Unexpected: Task cannot be resolved.'); } @@ -617,7 +617,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask return this._handleCounter++; } - protected async addCustomExecution(taskDTO: tasks.TaskDTO, task: vscode.Task, isProvided: boolean): Promise { + protected async addCustomExecution(taskDTO: tasks.ITaskDTO, task: vscode.Task, isProvided: boolean): Promise { const taskId = await this._proxy.$createTaskId(taskDTO); if (!isProvided && !this._providedCustomExecutions2.has(taskId)) { this._notProvidedCustomExecutions.add(taskId); @@ -627,7 +627,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask this._providedCustomExecutions2.set(taskId, task.execution); } - protected async getTaskExecution(execution: tasks.TaskExecutionDTO | string, task?: vscode.Task): Promise { + protected async getTaskExecution(execution: tasks.ITaskExecutionDTO | string, task?: vscode.Task): Promise { if (typeof execution === 'string') { const taskExecution = this._taskExecutionPromises.get(execution); if (!taskExecution) { @@ -641,7 +641,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask return result; } const createdResult: Promise = 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) { reject('Unexpected: Task does not exist.'); } 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); if (extensionCallback2) { this._activeCustomExecutions2.delete(execution.id); @@ -747,8 +747,8 @@ export class WorkerExtHostTask extends ExtHostTaskBase { return execution; } - protected provideTasksInternal(validTypes: { [key: string]: boolean }, taskIdPromises: Promise[], handler: HandlerData, value: vscode.Task[] | null | undefined): { tasks: tasks.TaskDTO[]; extension: IExtensionDescription } { - const taskDTOs: tasks.TaskDTO[] = []; + protected provideTasksInternal(validTypes: { [key: string]: boolean }, taskIdPromises: Promise[], handler: HandlerData, value: vscode.Task[] | null | undefined): { tasks: tasks.ITaskDTO[]; extension: IExtensionDescription } { + const taskDTOs: tasks.ITaskDTO[] = []; if (value) { for (let task of value) { 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.`); } - 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)) { taskDTOs.push(taskDTO); // 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 { + protected async resolveTaskInternal(resolvedTaskDTO: tasks.ITaskDTO): Promise { if (CustomExecutionDTO.is(resolvedTaskDTO.execution)) { return resolvedTaskDTO; } else { diff --git a/src/vs/workbench/api/common/shared/tasks.ts b/src/vs/workbench/api/common/shared/tasks.ts index 61c0d091a59..0bfd54a28d2 100644 --- a/src/vs/workbench/api/common/shared/tasks.ts +++ b/src/vs/workbench/api/common/shared/tasks.ts @@ -7,12 +7,12 @@ import { UriComponents } from 'vs/base/common/uri'; import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; import type { Dto } from 'vs/workbench/services/extensions/common/proxyIdentifier'; -export interface TaskDefinitionDTO { +export interface ITaskDefinitionDTO { type: string; [name: string]: any; } -export interface TaskPresentationOptionsDTO { +export interface ITaskPresentationOptionsDTO { reveal?: number; echo?: boolean; focus?: boolean; @@ -23,25 +23,25 @@ export interface TaskPresentationOptionsDTO { close?: boolean; } -export interface RunOptionsDTO { +export interface IRunOptionsDTO { reevaluateOnRerun?: boolean; } -export interface ExecutionOptionsDTO { +export interface IExecutionOptionsDTO { cwd?: string; env?: { [key: string]: string }; } -export interface ProcessExecutionOptionsDTO extends ExecutionOptionsDTO { +export interface IProcessExecutionOptionsDTO extends IExecutionOptionsDTO { } -export interface ProcessExecutionDTO { +export interface IProcessExecutionDTO { process: string; args: string[]; - options?: ProcessExecutionOptionsDTO; + options?: IProcessExecutionOptionsDTO; } -export interface ShellQuotingOptionsDTO { +export interface IShellQuotingOptionsDTO { escape?: string | { escapeChar: string; charsToEscape: string; @@ -50,86 +50,86 @@ export interface ShellQuotingOptionsDTO { weak?: string; } -export interface ShellExecutionOptionsDTO extends ExecutionOptionsDTO { +export interface IShellExecutionOptionsDTO extends IExecutionOptionsDTO { executable?: string; shellArgs?: string[]; - shellQuoting?: ShellQuotingOptionsDTO; + shellQuoting?: IShellQuotingOptionsDTO; } -export interface ShellQuotedStringDTO { +export interface IShellQuotedStringDTO { value: string; quoting: number; } -export interface ShellExecutionDTO { +export interface IShellExecutionDTO { commandLine?: string; - command?: string | ShellQuotedStringDTO; - args?: Array; - options?: ShellExecutionOptionsDTO; + command?: string | IShellQuotedStringDTO; + args?: Array; + options?: IShellExecutionOptionsDTO; } -export interface CustomExecutionDTO { +export interface ICustomExecutionDTO { customExecution: 'customExecution'; } -export interface TaskSourceDTO { +export interface ITaskSourceDTO { label: string; extensionId?: string; scope?: number | UriComponents; } -export interface TaskHandleDTO { +export interface ITaskHandleDTO { id: string; workspaceFolder: UriComponents | string; } -export interface TaskGroupDTO { +export interface ITaskGroupDTO { isDefault?: boolean; _id: string; } -export interface TaskDTO { +export interface ITaskDTO { _id: string; name?: string; - execution: ProcessExecutionDTO | ShellExecutionDTO | CustomExecutionDTO | undefined; - definition: TaskDefinitionDTO; + execution: IProcessExecutionDTO | IShellExecutionDTO | ICustomExecutionDTO | undefined; + definition: ITaskDefinitionDTO; isBackground?: boolean; - source: TaskSourceDTO; - group?: TaskGroupDTO; + source: ITaskSourceDTO; + group?: ITaskGroupDTO; detail?: string; - presentationOptions?: TaskPresentationOptionsDTO; + presentationOptions?: ITaskPresentationOptionsDTO; problemMatchers: string[]; hasDefinedMatchers: boolean; - runOptions?: RunOptionsDTO; + runOptions?: IRunOptionsDTO; } -export interface TaskSetDTO { - tasks: TaskDTO[]; +export interface ITaskSetDTO { + tasks: ITaskDTO[]; extension: Dto; } -export interface TaskExecutionDTO { +export interface ITaskExecutionDTO { id: string; - task: TaskDTO | undefined; + task: ITaskDTO | undefined; } -export interface TaskProcessStartedDTO { +export interface ITaskProcessStartedDTO { id: string; processId: number; } -export interface TaskProcessEndedDTO { +export interface ITaskProcessEndedDTO { id: string; exitCode: number | undefined; } -export interface TaskFilterDTO { +export interface ITaskFilterDTO { version?: string; type?: string; } -export interface TaskSystemInfoDTO { +export interface ITaskSystemInfoDTO { scheme: string; authority: string; platform: string; diff --git a/src/vs/workbench/api/node/extHostTask.ts b/src/vs/workbench/api/node/extHostTask.ts index 7afdfc40ea0..25f5085b4e7 100644 --- a/src/vs/workbench/api/node/extHostTask.ts +++ b/src/vs/workbench/api/node/extHostTask.ts @@ -92,8 +92,8 @@ export class ExtHostTask extends ExtHostTaskBase { } } - protected provideTasksInternal(validTypes: { [key: string]: boolean }, taskIdPromises: Promise[], handler: HandlerData, value: vscode.Task[] | null | undefined): { tasks: tasks.TaskDTO[]; extension: IExtensionDescription } { - const taskDTOs: tasks.TaskDTO[] = []; + protected provideTasksInternal(validTypes: { [key: string]: boolean }, taskIdPromises: Promise[], handler: HandlerData, value: vscode.Task[] | null | undefined): { tasks: tasks.ITaskDTO[]; extension: IExtensionDescription } { + const taskDTOs: tasks.ITaskDTO[] = []; if (value) { for (let task of value) { 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.`); } - const taskDTO: tasks.TaskDTO | undefined = TaskDTO.from(task, handler.extension); + const taskDTO: tasks.ITaskDTO | undefined = TaskDTO.from(task, handler.extension); if (taskDTO) { taskDTOs.push(taskDTO); @@ -121,7 +121,7 @@ export class ExtHostTask extends ExtHostTaskBase { }; } - protected async resolveTaskInternal(resolvedTaskDTO: tasks.TaskDTO): Promise { + protected async resolveTaskInternal(resolvedTaskDTO: tasks.ITaskDTO): Promise { return resolvedTaskDTO; } diff --git a/src/vs/workbench/contrib/debug/browser/debugTaskRunner.ts b/src/vs/workbench/contrib/debug/browser/debugTaskRunner.ts index 8f4255fb1d2..d9ee132c153 100644 --- a/src/vs/workbench/contrib/debug/browser/debugTaskRunner.ts +++ b/src/vs/workbench/contrib/debug/browser/debugTaskRunner.ts @@ -10,7 +10,7 @@ import { Markers } from 'vs/workbench/contrib/markers/common/markers'; import { ITaskService, ITaskSummary } from 'vs/workbench/contrib/tasks/common/taskService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; 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 { withUndefinedAsNull } from 'vs/base/common/types'; 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 { ICommandService } from 'vs/platform/commands/common/commands'; -function once(match: (e: TaskEvent) => boolean, event: Event): Event { +function once(match: (e: ITaskEvent) => boolean, event: Event): Event { return (listener, thisArgs = null, disposables?) => { const result = event(e => { if (match(e)) { @@ -59,7 +59,7 @@ export class DebugTaskRunner { this.canceled = true; } - async runTaskAndCheckErrors(root: IWorkspaceFolder | IWorkspace | undefined, taskId: string | TaskIdentifier | undefined): Promise { + async runTaskAndCheckErrors(root: IWorkspaceFolder | IWorkspace | undefined, taskId: string | ITaskIdentifier | undefined): Promise { try { this.canceled = false; 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 { + async runTask(root: IWorkspace | IWorkspaceFolder | undefined, taskId: string | ITaskIdentifier | undefined): Promise { if (!taskId) { return Promise.resolve(null); } diff --git a/src/vs/workbench/contrib/debug/common/debug.ts b/src/vs/workbench/contrib/debug/common/debug.ts index 74160cd5166..5a19cdff64f 100644 --- a/src/vs/workbench/contrib/debug/common/debug.ts +++ b/src/vs/workbench/contrib/debug/common/debug.ts @@ -24,7 +24,7 @@ import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; import { IEditorPane } from 'vs/workbench/common/editor'; import { DebugCompoundRoot } from 'vs/workbench/contrib/debug/common/debugCompoundRoot'; 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'; export const VIEWLET_ID = 'workbench.view.debug'; @@ -650,10 +650,10 @@ export interface IGlobalConfig { export interface IEnvConfig { internalConsoleOptions?: 'neverOpen' | 'openOnSessionStart' | 'openOnFirstSessionStart'; - preRestartTask?: string | TaskIdentifier; - postRestartTask?: string | TaskIdentifier; - preLaunchTask?: string | TaskIdentifier; - postDebugTask?: string | TaskIdentifier; + preRestartTask?: string | ITaskIdentifier; + postRestartTask?: string | ITaskIdentifier; + preLaunchTask?: string | ITaskIdentifier; + postDebugTask?: string | ITaskIdentifier; debugServer?: number; noDebug?: boolean; } @@ -687,7 +687,7 @@ export interface IConfig extends IEnvConfig { export interface ICompound { name: string; stopAll?: boolean; - preLaunchTask?: string | TaskIdentifier; + preLaunchTask?: string | ITaskIdentifier; configurations: (string | { name: string; folder: string })[]; presentation?: IConfigPresentation; } diff --git a/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts b/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts index 42f69229199..64a03a0b4ef 100644 --- a/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts +++ b/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts @@ -26,7 +26,7 @@ import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configur import { IFileService, IFileStatWithPartialMetadata } from 'vs/platform/files/common/files'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; 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 { 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 { 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 { - Task, CustomTask, ConfiguringTask, ContributedTask, InMemoryTask, TaskEvent, - TaskSet, TaskGroup, ExecutionEngine, JsonSchemaVersion, TaskSourceKind, - TaskSorter, TaskIdentifier, KeyedTaskIdentifier, TASK_RUNNING_STATE, TaskRunSource, - KeyedTaskIdentifier as NKeyedTaskIdentifier, TaskDefinition, RuntimeType, + Task, CustomTask, ConfiguringTask, ContributedTask, InMemoryTask, ITaskEvent, + ITaskSet, TaskGroup, ExecutionEngine, JsonSchemaVersion, TaskSourceKind, + TaskSorter, ITaskIdentifier, TASK_RUNNING_STATE, TaskRunSource, + KeyedTaskIdentifier as KeyedTaskIdentifier, TaskDefinition, RuntimeType, USER_TASKS_GROUP_KEY } 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 * 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 { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation'; 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 { once } from 'vs/base/common/functional'; 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; - config: TaskConfig.ExternalTaskRunnerConfiguration | undefined; + config: TaskConfig.IExternalTaskRunnerConfiguration | undefined; hasErrors: boolean; } -interface CommandUpgrade { +interface ICommandUpgrade { command?: string; args?: string[]; } @@ -206,9 +206,9 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer private _showIgnoreMessage?: boolean; private _providers: Map; private _providerTypes: Map; - protected _taskSystemInfos: Map; + protected _taskSystemInfos: Map; - protected _workspaceTasksPromise?: Promise>; + protected _workspaceTasksPromise?: Promise>; protected _taskSystem?: ITaskSystem; protected _taskSystemListener?: IDisposable; @@ -218,7 +218,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer protected _taskRunningState: IContextKey; protected _outputChannel: IOutputChannel; - protected readonly _onDidStateChange: Emitter; + protected readonly _onDidStateChange: Emitter; private _waitForSupportedExecutions: Promise; private _onDidRegisterSupportedExecutions: Emitter = new Emitter(); private _onDidChangeTaskSystemInfo: Emitter = new Emitter(); @@ -266,7 +266,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer this._outputChannel = this.outputService.getChannel(AbstractTaskService.OutputChannelId)!; this._providers = new Map(); this._providerTypes = new Map(); - this._taskSystemInfos = new Map(); + this._taskSystemInfos = new Map(); this._register(this.contextService.onDidChangeWorkspaceFolders(() => { let folderSetup = this.computeWorkspaceFolderSetup(); 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) { 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(); } - public get onDidStateChange(): Event { + public get onDidStateChange(): Event { return this._onDidStateChange.event; } @@ -577,7 +577,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer 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. // 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) { @@ -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); 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 { + public async getTask(folder: IWorkspace | IWorkspaceFolder | string, identifier: string | ITaskIdentifier, compareId: boolean = false): Promise { if (!(await this.trust())) { return; } @@ -750,9 +750,9 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer return; } - protected abstract versionAndEngineCompatible(filter?: TaskFilter): boolean; + protected abstract versionAndEngineCompatible(filter?: ITaskFilter): boolean; - public async tasks(filter?: TaskFilter): Promise { + public async tasks(filter?: ITaskFilter): Promise { if (!(await this.trust())) { 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 { + public async run(task: Task | undefined, options?: IProblemMatcherRunOptions, runSource: TaskRunSource = TaskRunSource.System): Promise { if (!(await this.trust())) { return; } @@ -1111,7 +1111,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer private getTypeForTask(task: Task): string { let type: string; if (CustomTask.is(task)) { - let configProperties: TaskConfig.ConfigurationProperties = task._source.config.element; + let configProperties: TaskConfig.IConfigurationProperties = task._source.config.element; type = (configProperties).type; } else { 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); } 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 false; @@ -1159,13 +1159,13 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer } private attachProblemMatcher(task: ContributedTask | CustomTask): Promise { - interface ProblemMatcherPickEntry extends IQuickPickItem { - matcher: NamedProblemMatcher | undefined; + interface IProblemMatcherPickEntry extends IQuickPickItem { + matcher: INamedProblemMatcher | undefined; never?: boolean; learnMore?: boolean; setting?: string; } - let entries: QuickPickInput[] = []; + let entries: QuickPickInput[] = []; for (let key of ProblemMatcherRegistry.keys()) { let matcher = ProblemMatcherRegistry.get(key); 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') }); let taskType: string; if (CustomTask.is(task)) { - let configProperties: TaskConfig.ConfigurationProperties = task._source.config.element; + let configProperties: TaskConfig.IConfigurationProperties = task._source.config.element; taskType = (configProperties).type; } else { taskType = task.getDefinition().type; @@ -1216,7 +1216,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer } else if (selected.matcher) { let newTask = task.clone(); let matcherReference = `$${selected.matcher.name}`; - let properties: CustomizationProperties = { problemMatcher: [matcherReference] }; + let properties: ICustomizationProperties = { problemMatcher: [matcherReference] }; newTask.configurationProperties.problemMatchers = [matcherReference]; let matcher = ProblemMatcherRegistry.get(selected.matcher.name); if (matcher && matcher.watching !== undefined) { @@ -1271,7 +1271,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer return false; } - private async formatTaskForJson(resource: URI, task: TaskConfig.CustomTask | TaskConfig.ConfiguringTask): Promise { + private async formatTaskForJson(resource: URI, task: TaskConfig.ICustomTask | TaskConfig.IConfiguringTask): Promise { let reference: IReference | undefined; let stringValue: string = ''; try { @@ -1292,7 +1292,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer return stringValue; } - private openEditorAtTask(resource: URI | undefined, task: TaskConfig.CustomTask | TaskConfig.ConfiguringTask | string | undefined, configIndex: number = -1): Promise { + private openEditorAtTask(resource: URI | undefined, task: TaskConfig.ICustomTask | TaskConfig.IConfiguringTask | string | undefined, configIndex: number = -1): Promise { if (resource === undefined) { return Promise.resolve(false); } @@ -1305,7 +1305,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer const contentValue = content.toString(); let stringValue: string | undefined; if (configIndex !== -1) { - const json: TaskConfig.ExternalTaskRunnerConfiguration = this.configurationService.getValue('tasks', { resource }); + const json: TaskConfig.IExternalTaskRunnerConfiguration = this.configurationService.getValue('tasks', { resource }); if (json.tasks && (json.tasks.length > 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 { - let toCustomize: TaskConfig.CustomTask | TaskConfig.ConfiguringTask | undefined; + private createCustomizableTask(task: ContributedTask | CustomTask | ConfiguringTask): TaskConfig.ICustomTask | TaskConfig.IConfiguringTask | undefined { + let toCustomize: TaskConfig.ICustomTask | TaskConfig.IConfiguringTask | undefined; let taskConfig = CustomTask.is(task) || ConfiguringTask.is(task) ? task._source.config : undefined; if (taskConfig && taskConfig.element) { toCustomize = { ...(taskConfig.element) }; } else if (ContributedTask.is(task)) { 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']; Object.keys(identifier).forEach(key => (toCustomize)![key] = identifier[key]); 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; } - public async customize(task: ContributedTask | CustomTask | ConfiguringTask, properties?: CustomizationProperties, openConfig?: boolean): Promise { + public async customize(task: ContributedTask | CustomTask | ConfiguringTask, properties?: ICustomizationProperties, openConfig?: boolean): Promise { if (!(await this.trust())) { return; } @@ -1519,13 +1519,13 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer } private createRunnableTask(tasks: TaskMap, group: TaskGroup): { task: Task; resolver: ITaskResolver } | undefined { - interface ResolverData { + interface IResolverData { id: Map; label: Map; identifier: Map; } - let resolverData: Map = new Map(); + let resolverData: Map = new Map(); let workspaceTasks: Task[] = []; let extensionTasks: Task[] = []; tasks.forEach((tasks, folder) => { @@ -1603,7 +1603,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer let resolverData: Map | 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 taskUri = ((ConfiguringTask.is(task) || CustomTask.is(task)) ? task._source.config.workspaceFolder?.uri : undefined); const originalUri = (typeof uri === 'string' ? uri : uri.toString()); @@ -1652,7 +1652,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer 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); let data = allResolverData.get(typeof uri === 'string' ? uri : uri.toString()); if (!data) { @@ -1667,7 +1667,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer } return { - resolve: async (uri: URI | string, identifier: string | TaskIdentifier | undefined) => { + resolve: async (uri: URI | string, identifier: string | ITaskIdentifier | undefined) => { if (!identifier) { return undefined; } @@ -1775,7 +1775,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer }); } - public async terminate(task: Task): Promise { + public async terminate(task: Task): Promise { if (!(await this.trust())) { return { success: true, task: undefined }; } @@ -1786,9 +1786,9 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer return this._taskSystem.terminate(task); } - private terminateAll(): Promise { + private terminateAll(): Promise { if (!this._taskSystem) { - return Promise.resolve([]); + return Promise.resolve([]); } return this._taskSystem.terminateAll(); } @@ -1832,10 +1832,10 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer TaskDefinitionRegistry.all().forEach(definition => validTypes[definition.taskType] = true); validTypes['shell'] = true; validTypes['process'] = true; - return new Promise(resolve => { - let result: TaskSet[] = []; + return new Promise(resolve => { + let result: ITaskSet[] = []; let counter: number = 0; - let done = (value: TaskSet | undefined) => { + let done = (value: ITaskSet | undefined) => { if (value) { result.push(value); } @@ -1870,7 +1870,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer } foundAnyProviders = true; counter++; - provider.provideTasks(validTypes).then((taskSet: TaskSet) => { + provider.provideTasks(validTypes).then((taskSet: ITaskSet) => { // Check that the tasks provided are of the correct type for (const task of taskSet.tasks) { if (task.type !== this._providerTypes.get(handle)) { @@ -2043,7 +2043,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer }); } - private getLegacyTaskConfigurations(workspaceTasks: TaskSet): IStringDictionary | undefined { + private getLegacyTaskConfigurations(workspaceTasks: ITaskSet): IStringDictionary | undefined { let result: IStringDictionary | undefined; function getResult(): IStringDictionary { 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 // if we had a gulp, jake or grunt command a task specification was a annotation if (commandName === 'gulp' || commandName === 'grunt' || commandName === 'jake') { - let identifier = NKeyedTaskIdentifier.create({ + let identifier = KeyedTaskIdentifier.create({ type: commandName, task: task.configurationProperties.name }); @@ -2069,7 +2069,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer return result; } - public async getWorkspaceTasks(runSource: TaskRunSource = TaskRunSource.User): Promise> { + public async getWorkspaceTasks(runSource: TaskRunSource = TaskRunSource.User): Promise> { if (!(await this.trust())) { return new Map(); } @@ -2080,7 +2080,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer return this.updateWorkspaceTasks(runSource); } - private updateWorkspaceTasks(runSource: TaskRunSource = TaskRunSource.User): Promise> { + private updateWorkspaceTasks(runSource: TaskRunSource = TaskRunSource.User): Promise> { this._workspaceTasksPromise = this.computeWorkspaceTasks(runSource); return this._workspaceTasksPromise; } @@ -2094,13 +2094,13 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer return folder; } - protected computeWorkspaceTasks(runSource: TaskRunSource = TaskRunSource.User): Promise> { - let promises: Promise[] = []; + protected computeWorkspaceTasks(runSource: TaskRunSource = TaskRunSource.User): Promise> { + let promises: Promise[] = []; for (let folder of this.workspaceFolders) { promises.push(this.computeWorkspaceFolderTasks(folder, runSource).then((value) => value, () => undefined)); } return Promise.all(promises).then(async (values) => { - let result = new Map(); + let result = new Map(); for (let value of values) { if (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); } - private computeWorkspaceFolderTasks(workspaceFolder: IWorkspaceFolder, runSource: TaskRunSource = TaskRunSource.User): Promise { + private computeWorkspaceFolderTasks(workspaceFolder: IWorkspaceFolder, runSource: TaskRunSource = TaskRunSource.User): Promise { return (this.executionEngine === ExecutionEngine.Process ? this.computeLegacyConfiguration(workspaceFolder) : this.computeConfiguration(workspaceFolder)). @@ -2135,8 +2135,8 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer if (!workspaceFolderConfiguration || !workspaceFolderConfiguration.config || workspaceFolderConfiguration.hasErrors) { return Promise.resolve({ workspaceFolder, set: undefined, configurations: undefined, hasErrors: workspaceFolderConfiguration ? workspaceFolderConfiguration.hasErrors : false }); } - return ProblemMatcherRegistry.onReady().then(async (): Promise => { - let taskSystemInfo: TaskSystemInfo | undefined = this.getTaskSystemInfo(workspaceFolder.uri.scheme); + return ProblemMatcherRegistry.onReady().then(async (): Promise => { + let taskSystemInfo: ITaskSystemInfo | undefined = this.getTaskSystemInfo(workspaceFolder.uri.scheme); 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 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) { return { config: undefined, hasParseErrors: false }; } @@ -2187,7 +2187,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer return { config, hasParseErrors: false }; } - private async computeWorkspaceFileTasks(workspaceFolder: IWorkspaceFolder, runSource: TaskRunSource = TaskRunSource.User): Promise { + private async computeWorkspaceFileTasks(workspaceFolder: IWorkspaceFolder, runSource: TaskRunSource = TaskRunSource.User): Promise { if (this.executionEngine === ExecutionEngine.Process) { 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 }; } - private async computeUserTasks(workspaceFolder: IWorkspaceFolder, runSource: TaskRunSource = TaskRunSource.User): Promise { + private async computeUserTasks(workspaceFolder: IWorkspaceFolder, runSource: TaskRunSource = TaskRunSource.User): Promise { if (this.executionEngine === ExecutionEngine.Process) { 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 }; } - private emptyWorkspaceTaskResults(workspaceFolder: IWorkspaceFolder): WorkspaceFolderTaskResult { + private emptyWorkspaceTaskResults(workspaceFolder: IWorkspaceFolder): IWorkspaceFolderTaskResult { return { workspaceFolder, set: undefined, configurations: undefined, hasErrors: false }; } - private async computeTasksForSingleConfig(workspaceFolder: IWorkspaceFolder, config: TaskConfig.ExternalTaskRunnerConfiguration | undefined, runSource: TaskRunSource, custom: CustomTask[], customized: IStringDictionary, source: TaskConfig.TaskConfigSource, isRecentTask: boolean = false): Promise { + private async computeTasksForSingleConfig(workspaceFolder: IWorkspaceFolder, config: TaskConfig.IExternalTaskRunnerConfiguration | undefined, runSource: TaskRunSource, custom: CustomTask[], customized: IStringDictionary, source: TaskConfig.TaskConfigSource, isRecentTask: boolean = false): Promise { if (!config) { 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 parseResult = TaskConfig.parse(workspaceFolder, this._workspace, taskSystemInfo ? taskSystemInfo.platform : Platform.platform, config, problemReporter, source, this.contextKeyService, isRecentTask); let hasErrors = false; @@ -2262,12 +2262,12 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer return hasErrors; } - private computeConfiguration(workspaceFolder: IWorkspaceFolder): Promise { + private computeConfiguration(workspaceFolder: IWorkspaceFolder): Promise { let { config, hasParseErrors } = this.getConfiguration(workspaceFolder); - return Promise.resolve({ workspaceFolder, config, hasErrors: hasParseErrors }); + return Promise.resolve({ workspaceFolder, config, hasErrors: hasParseErrors }); } - protected abstract computeLegacyConfiguration(workspaceFolder: IWorkspaceFolder): Promise; + protected abstract computeLegacyConfiguration(workspaceFolder: IWorkspaceFolder): Promise; private computeWorkspaceFolderSetup(): [IWorkspaceFolder[], IWorkspaceFolder[], ExecutionEngine, JsonSchemaVersion, IWorkspace | undefined] { let workspaceFolders: IWorkspaceFolder[] = []; @@ -2324,12 +2324,12 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer 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; if ((source !== TaskSourceKind.User) && (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY)) { result = undefined; } else { - const wholeConfig = this.configurationService.inspect('tasks', { resource: workspaceFolder.uri }); + const wholeConfig = this.configurationService.inspect('tasks', { resource: workspaceFolder.uri }); switch (source) { case TaskSourceKind.User: { if (wholeConfig.userValue !== wholeConfig.workspaceFolderValue) { @@ -2427,12 +2427,12 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer return this.configurationService.getValue(QUICKOPEN_DETAIL_CONFIG); } - private async createTaskQuickPickEntries(tasks: Task[], group: boolean = false, sort: boolean = false, selectedEntry?: TaskQuickPickEntry, includeRecents: boolean = true): Promise { - let encounteredTasks: { [key: string]: TaskQuickPickEntry[] } = {}; + private async createTaskQuickPickEntries(tasks: Task[], group: boolean = false, sort: boolean = false, selectedEntry?: ITaskQuickPickEntry, includeRecents: boolean = true): Promise { + let encounteredTasks: { [key: string]: ITaskQuickPickEntry[] } = {}; if (tasks === undefined || tasks === null || tasks.length === 0) { 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 }; if (encounteredTasks[task._id]) { if (encounteredTasks[task._id].length === 1) { @@ -2446,12 +2446,12 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer return newEntry; }; - function fillEntries(entries: QuickPickInput[], tasks: Task[], groupLabel: string): void { + function fillEntries(entries: QuickPickInput[], tasks: Task[], groupLabel: string): void { if (tasks.length) { entries.push({ type: 'separator', label: groupLabel }); } 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") }]; if (selectedEntry && (task === selectedEntry.task)) { entries.unshift(selectedEntry); @@ -2460,7 +2460,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer } } } - let entries: TaskQuickPickEntry[]; + let entries: ITaskQuickPickEntry[]; if (group) { entries = []; if (tasks.length === 1) { @@ -2512,20 +2512,20 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer const sorter = this.createSorter(); tasks = tasks.sort((a, b) => sorter.compare(a, b)); } - entries = tasks.map(task => TaskQuickPickEntry(task)); + entries = tasks.map(task => TaskQuickPickEntry(task)); } encounteredTasks = {}; 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); } - private async showQuickPick(tasks: Promise | Task[], placeHolder: string, defaultEntry?: TaskQuickPickEntry, group: boolean = false, sort: boolean = false, selectedEntry?: TaskQuickPickEntry, additionalEntries?: TaskQuickPickEntry[]): Promise { + private async showQuickPick(tasks: Promise | Task[], placeHolder: string, defaultEntry?: ITaskQuickPickEntry, group: boolean = false, sort: boolean = false, selectedEntry?: ITaskQuickPickEntry, additionalEntries?: ITaskQuickPickEntry[]): Promise { const tokenSource = new CancellationTokenSource(); const cancellationToken: CancellationToken = tokenSource.token; - let _createEntries = new Promise[]>((resolve) => { + let _createEntries = new Promise[]>((resolve) => { if (Array.isArray(tasks)) { resolve(this.createTaskQuickPickEntries(tasks, group, sort, selectedEntry)); } else { @@ -2543,7 +2543,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer })]); if (!timeout && ((await _createEntries).length === 1) && this.configurationService.getValue(QUICKOPEN_SKIP_CONFIG)) { - return ((await _createEntries)[0]); + return ((await _createEntries)[0]); } const pickEntries = _createEntries.then((entries) => { @@ -2558,7 +2558,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer return entries; }); - const picker: IQuickPick = this.quickInputService.createQuickPick(); + const picker: IQuickPick = this.quickInputService.createQuickPick(); picker.placeholder = placeHolder; picker.matchOnDescription = true; @@ -2578,14 +2578,14 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer }); picker.show(); - return new Promise(resolve => { + return new Promise(resolve => { this._register(picker.onDidAccept(async () => { let selection = picker.selectedItems ? picker.selectedItems[0] : undefined; if (cancellationToken.isCancellationRequested) { // canceled when there's only one task const task = (await pickEntries)[0]; if ((task).task) { - selection = task; + selection = task; } } picker.dispose(); @@ -2682,7 +2682,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer } } - private tasksAndGroupedTasks(filter?: TaskFilter): { tasks: Promise; grouped: Promise } { + private tasksAndGroupedTasks(filter?: ITaskFilter): { tasks: Promise; grouped: Promise } { if (!this.versionAndEngineCompatible(filter)) { return { tasks: Promise.resolve([]), grouped: Promise.resolve(new TaskMap()) }; } @@ -2816,7 +2816,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer 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 => { // 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; if (Types.isString(arg)) { result = arg; - } else if (arg && Types.isString((arg as TaskIdentifier).type)) { - result = TaskDefinition.createTaskIdentifier(arg as TaskIdentifier, console); + } else if (arg && Types.isString((arg as ITaskIdentifier).type)) { + result = TaskDefinition.createTaskIdentifier(arg as ITaskIdentifier, console); } return result; } - private configHasTasks(taskConfig?: TaskConfig.ExternalTaskRunnerConfiguration): boolean { + private configHasTasks(taskConfig?: TaskConfig.IExternalTaskRunnerConfiguration): boolean { return !!taskConfig && !!taskConfig.tasks && taskConfig.tasks.length > 0; } @@ -3070,7 +3070,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer let configFileCreated = false; this.fileService.stat(resource).then((stat) => stat, () => undefined).then(async (stat) => { const fileExists: boolean = !!stat; - const configValue = this.configurationService.inspect('tasks'); + const configValue = this.configurationService.inspect('tasks'); let tasksExistInFile: boolean; let target: ConfigurationTarget; switch (taskSource) { @@ -3270,7 +3270,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer return; } let selectedTask: Task | undefined; - let selectedEntry: TaskQuickPickEntry; + let selectedEntry: ITaskQuickPickEntry; for (let task of tasks) { let taskGroup: TaskGroup | undefined = TaskGroup.from(task.configurationProperties.group); if (taskGroup && taskGroup.isDefault && taskGroup._id === TaskGroup.Build._id) { @@ -3322,7 +3322,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer return; } let selectedTask: Task | undefined; - let selectedEntry: TaskQuickPickEntry; + let selectedEntry: ITaskQuickPickEntry; for (let task of tasks) { let taskGroup: TaskGroup | undefined = TaskGroup.from(task.configurationProperties.group); @@ -3412,7 +3412,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer 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)) { return; } @@ -3488,12 +3488,12 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer continue; } - const configTasks: (TaskConfig.CustomTask | TaskConfig.ConfiguringTask)[] = []; + const configTasks: (TaskConfig.ICustomTask | TaskConfig.IConfiguringTask)[] = []; const suppressTaskName = !!this.configurationService.getValue('tasks.suppressTaskName', { resource: folder.uri }); const globalConfig = { - windows: this.configurationService.getValue('tasks.windows', { resource: folder.uri }), - osx: this.configurationService.getValue('tasks.osx', { resource: folder.uri }), - linux: this.configurationService.getValue('tasks.linux', { resource: folder.uri }) + windows: this.configurationService.getValue('tasks.windows', { resource: folder.uri }), + osx: this.configurationService.getValue('tasks.osx', { resource: folder.uri }), + linux: this.configurationService.getValue('tasks.linux', { resource: folder.uri }) }; tasks.get(folder).forEach(task => { const configTask = this.upgradeTask(task, suppressTaskName, globalConfig); diff --git a/src/vs/workbench/contrib/tasks/browser/runAutomaticTasks.ts b/src/vs/workbench/contrib/tasks/browser/runAutomaticTasks.ts index 270dafb67c2..74deb605b11 100644 --- a/src/vs/workbench/contrib/tasks/browser/runAutomaticTasks.ts +++ b/src/vs/workbench/contrib/tasks/browser/runAutomaticTasks.ts @@ -7,9 +7,9 @@ import * as nls from 'vs/nls'; import * as resources from 'vs/base/common/resources'; import { Disposable } from 'vs/base/common/lifecycle'; 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 { 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 { INotificationService, Severity } from 'vs/platform/notification/common/notification'; 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); switch (taskKind) { case ConfigurationTarget.WORKSPACE_FOLDER: { - return resources.joinPath((source).config.workspaceFolder!.uri, (source).config.file); + return resources.joinPath((source).config.workspaceFolder!.uri, (source).config.file); } case ConfigurationTarget.WORKSPACE: { return (source).config.workspace?.configuration ?? undefined; @@ -86,7 +86,7 @@ export class RunAutomaticTasks extends Disposable implements IWorkbenchContribut return undefined; } - private static findAutoTasks(taskService: ITaskService, workspaceTaskResult: Map): { tasks: Array>; taskNames: Array; locations: Map } { + private static findAutoTasks(taskService: ITaskService, workspaceTaskResult: Map): { tasks: Array>; taskNames: Array; locations: Map } { const tasks = new Array>(); const taskNames = new Array(); const locations = new Map(); @@ -129,7 +129,7 @@ export class RunAutomaticTasks extends Disposable implements IWorkbenchContribut } public static async promptForPermission(taskService: ITaskService, storageService: IStorageService, notificationService: INotificationService, workspaceTrustManagementService: IWorkspaceTrustManagementService, - openerService: IOpenerService, workspaceTaskResult: Map) { + openerService: IOpenerService, workspaceTaskResult: Map) { const isWorkspaceTrusted = workspaceTrustManagementService.isWorkspaceTrusted; if (!isWorkspaceTrusted) { return; diff --git a/src/vs/workbench/contrib/tasks/browser/task.contribution.ts b/src/vs/workbench/contrib/tasks/browser/task.contribution.ts index e6af1d10e89..4fa5859c889 100644 --- a/src/vs/workbench/contrib/tasks/browser/task.contribution.ts +++ b/src/vs/workbench/contrib/tasks/browser/task.contribution.ts @@ -20,7 +20,7 @@ import { StatusbarAlignment, IStatusbarService, IStatusbarEntryAccessor, IStatus 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 { 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()) { return false; } diff --git a/src/vs/workbench/contrib/tasks/browser/taskQuickPick.ts b/src/vs/workbench/contrib/tasks/browser/taskQuickPick.ts index c78e28e9d0c..fd9f0ff7a6e 100644 --- a/src/vs/workbench/contrib/tasks/browser/taskQuickPick.ts +++ b/src/vs/workbench/contrib/tasks/browser/taskQuickPick.ts @@ -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 { IWorkspace, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; 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 { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput'; @@ -27,11 +27,11 @@ export function isWorkspaceFolder(folder: IWorkspace | IWorkspaceFolder): folder return 'uri' in folder; } -export interface TaskQuickPickEntry extends IQuickPickItem { +export interface ITaskQuickPickEntry extends IQuickPickItem { task: Task | undefined | null; } -export interface TaskTwoLevelQuickPickEntry extends IQuickPickItem { +export interface ITaskTwoLevelQuickPickEntry extends IQuickPickItem { task: Task | ConfiguringTask | string | undefined | null; settingType?: string; } @@ -43,7 +43,7 @@ const removeTaskIcon = registerIcon('tasks-remove', Codicon.close, nls.localize( export class TaskQuickPick extends Disposable { private sorter: TaskSorter; - private topLevelEntries: QuickPickInput[] | undefined; + private topLevelEntries: QuickPickInput[] | undefined; constructor( private taskService: ITaskService, private configurationService: IConfigurationService, @@ -74,13 +74,13 @@ export class TaskQuickPick extends Disposable { return ''; } - private createTaskEntry(task: Task | ConfiguringTask, extraButtons: IQuickInputButton[] = []): TaskTwoLevelQuickPickEntry { - const entry: TaskTwoLevelQuickPickEntry = { label: this.guessTaskLabel(task), description: this.taskService.getTaskDescription(task), task, detail: this.showDetail() ? task.configurationProperties.detail : undefined }; + private createTaskEntry(task: Task | ConfiguringTask, extraButtons: IQuickInputButton[] = []): ITaskTwoLevelQuickPickEntry { + 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]; return entry; } - private createEntriesForGroup(entries: QuickPickInput[], tasks: (Task | ConfiguringTask)[], + private createEntriesForGroup(entries: QuickPickInput[], tasks: (Task | ConfiguringTask)[], groupLabel: string, extraButtons: IQuickInputButton[] = []) { entries.push({ type: 'separator', label: groupLabel }); tasks.forEach(task => { @@ -88,7 +88,7 @@ export class TaskQuickPick extends Disposable { }); } - private createTypeEntries(entries: QuickPickInput[], types: string[]) { + private createTypeEntries(entries: QuickPickInput[], types: string[]) { entries.push({ type: 'separator', label: nls.localize('contributedTasks', "contributed") }); types.forEach(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 }); } - private handleFolderTaskResult(result: Map): (Task | ConfiguringTask)[] { + private handleFolderTaskResult(result: Map): (Task | ConfiguringTask)[] { let tasks: (Task | ConfiguringTask)[] = []; Array.from(result).forEach(([key, folderTasks]) => { if (folderTasks.set) { @@ -142,7 +142,7 @@ export class TaskQuickPick extends Disposable { return { configuredTasks: dedupedConfiguredTasks, recentTasks: prunedRecentTasks }; } - public async getTopLevelEntries(defaultEntry?: TaskQuickPickEntry): Promise<{ entries: QuickPickInput[]; isSingleConfigured?: Task | ConfiguringTask }> { + public async getTopLevelEntries(defaultEntry?: ITaskQuickPickEntry): Promise<{ entries: QuickPickInput[]; isSingleConfigured?: Task | ConfiguringTask }> { if (this.topLevelEntries !== undefined) { return { entries: this.topLevelEntries }; } @@ -193,8 +193,8 @@ export class TaskQuickPick extends Disposable { return undefined; } - public async show(placeHolder: string, defaultEntry?: TaskQuickPickEntry, startAtType?: string): Promise { - const picker: IQuickPick = this.quickInputService.createQuickPick(); + public async show(placeHolder: string, defaultEntry?: ITaskQuickPickEntry, startAtType?: string): Promise { + const picker: IQuickPick = this.quickInputService.createQuickPick(); picker.placeholder = placeHolder; picker.matchOnDescription = true; picker.ignoreFocusOut = false; @@ -237,7 +237,7 @@ export class TaskQuickPick extends Disposable { picker.dispose(); return this.toTask(topLevelEntriesResult.isSingleConfigured); } - const taskQuickPickEntries: QuickPickInput[] = topLevelEntriesResult.entries; + const taskQuickPickEntries: QuickPickInput[] = topLevelEntriesResult.entries; firstLevelTask = await this.doPickerFirstLevel(picker, taskQuickPickEntries); } do { @@ -265,9 +265,9 @@ export class TaskQuickPick extends Disposable { return; } - private async doPickerFirstLevel(picker: IQuickPick, taskQuickPickEntries: QuickPickInput[]): Promise { + private async doPickerFirstLevel(picker: IQuickPick, taskQuickPickEntries: QuickPickInput[]): Promise { picker.items = taskQuickPickEntries; - const firstLevelPickerResult = await new Promise(resolve => { + const firstLevelPickerResult = await new Promise(resolve => { Event.once(picker.onDidAccept)(async () => { resolve(picker.selectedItems ? picker.selectedItems[0] : undefined); }); @@ -275,7 +275,7 @@ export class TaskQuickPick extends Disposable { return firstLevelPickerResult?.task; } - private async doPickerSecondLevel(picker: IQuickPick, type: string) { + private async doPickerSecondLevel(picker: IQuickPick, type: string) { picker.busy = true; if (type === SHOW_ALL) { 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.busy = false; - const secondLevelPickerResult = await new Promise(resolve => { + const secondLevelPickerResult = await new Promise(resolve => { Event.once(picker.onDidAccept)(async () => { resolve(picker.selectedItems ? picker.selectedItems[0] : undefined); }); @@ -295,8 +295,8 @@ export class TaskQuickPick extends Disposable { return secondLevelPickerResult; } - public static allSettingEntries(configurationService: IConfigurationService): (TaskTwoLevelQuickPickEntry & { settingType: string })[] { - const entries: (TaskTwoLevelQuickPickEntry & { settingType: string })[] = []; + public static allSettingEntries(configurationService: IConfigurationService): (ITaskTwoLevelQuickPickEntry & { settingType: string })[] { + const entries: (ITaskTwoLevelQuickPickEntry & { settingType: string })[] = []; const gruntEntry = TaskQuickPick.getSettingEntry(configurationService, 'grunt'); if (gruntEntry) { entries.push(gruntEntry); @@ -312,7 +312,7 @@ export class TaskQuickPick extends Disposable { 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') { return { 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; } - private async getEntriesForProvider(type: string): Promise[]> { + private async getEntriesForProvider(type: string): Promise[]> { const tasks = (await this.taskService.tasks({ type })).sort((a, b) => this.sorter.compare(a, b)); - let taskQuickPickEntries: QuickPickInput[]; + let taskQuickPickEntries: QuickPickInput[]; if (tasks.length > 0) { taskQuickPickEntries = tasks.map(task => this.createTaskEntry(task)); taskQuickPickEntries.push({ @@ -367,7 +367,7 @@ export class TaskQuickPick extends Disposable { static async show(taskService: ITaskService, configurationService: IConfigurationService, 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); return taskQuickPick.show(placeHolder, defaultEntry); } diff --git a/src/vs/workbench/contrib/tasks/browser/taskService.ts b/src/vs/workbench/contrib/tasks/browser/taskService.ts index e34ad9e5794..65028c8ab75 100644 --- a/src/vs/workbench/contrib/tasks/browser/taskService.ts +++ b/src/vs/workbench/contrib/tasks/browser/taskService.ts @@ -7,8 +7,8 @@ import * as nls from 'vs/nls'; import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; import { ITaskSystem } from 'vs/workbench/contrib/tasks/common/taskSystem'; import { ExecutionEngine } from 'vs/workbench/contrib/tasks/common/tasks'; -import { AbstractTaskService, WorkspaceFolderConfigurationResult } from 'vs/workbench/contrib/tasks/browser/abstractTaskService'; -import { TaskFilter, ITaskService } from 'vs/workbench/contrib/tasks/common/taskService'; +import { AbstractTaskService, IWorkspaceFolderConfigurationResult } from 'vs/workbench/contrib/tasks/browser/abstractTaskService'; +import { ITaskFilter, ITaskService } from 'vs/workbench/contrib/tasks/common/taskService'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; export class TaskService extends AbstractTaskService { @@ -32,11 +32,11 @@ export class TaskService extends AbstractTaskService { return this._taskSystem!; } - protected computeLegacyConfiguration(workspaceFolder: IWorkspaceFolder): Promise { + protected computeLegacyConfiguration(workspaceFolder: IWorkspaceFolder): Promise { throw new Error(TaskService.ProcessTaskSystemSupportMessage); } - protected versionAndEngineCompatible(filter?: TaskFilter): boolean { + protected versionAndEngineCompatible(filter?: ITaskFilter): boolean { return this.executionEngine === ExecutionEngine.Terminal; } } diff --git a/src/vs/workbench/contrib/tasks/browser/taskTerminalStatus.ts b/src/vs/workbench/contrib/tasks/browser/taskTerminalStatus.ts index 3c6dc5ca458..73c5f8502c6 100644 --- a/src/vs/workbench/contrib/tasks/browser/taskTerminalStatus.ts +++ b/src/vs/workbench/contrib/tasks/browser/taskTerminalStatus.ts @@ -8,14 +8,14 @@ import { Codicon } from 'vs/base/common/codicons'; import { Disposable, IDisposable } from 'vs/base/common/lifecycle'; import Severity from 'vs/base/common/severity'; 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 { ITerminalInstance } from 'vs/workbench/contrib/terminal/browser/terminal'; import { ITerminalStatus } from 'vs/workbench/contrib/terminal/browser/terminalStatusList'; import { MarkerSeverity } from 'vs/platform/markers/common/markers'; import { spinningLoading } from 'vs/platform/theme/common/iconRegistry'; -interface TerminalData { +interface ITerminalData { terminal: ITerminalInstance; task: Task; 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...") }; export class TaskTerminalStatus extends Disposable { - private terminalMap: Map = new Map(); + private terminalMap: Map = new Map(); constructor(taskService: ITaskService) { super(); @@ -56,7 +56,7 @@ export class TaskTerminalStatus extends Disposable { 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) { return undefined; } @@ -64,7 +64,7 @@ export class TaskTerminalStatus extends Disposable { return this.terminalMap.get(event.__task._id); } - private eventEnd(event: TaskEvent) { + private eventEnd(event: ITaskEvent) { const terminalData = this.terminalFromEvent(event); if (!terminalData) { return; @@ -82,7 +82,7 @@ export class TaskTerminalStatus extends Disposable { } } - private eventInactive(event: TaskEvent) { + private eventInactive(event: ITaskEvent) { const terminalData = this.terminalFromEvent(event); if (!terminalData || !terminalData.problemMatcher || terminalData.taskRunEnded) { return; @@ -99,7 +99,7 @@ export class TaskTerminalStatus extends Disposable { } } - private eventActive(event: TaskEvent) { + private eventActive(event: ITaskEvent) { const terminalData = this.terminalFromEvent(event); if (!terminalData) { return; diff --git a/src/vs/workbench/contrib/tasks/browser/tasksQuickAccess.ts b/src/vs/workbench/contrib/tasks/browser/tasksQuickAccess.ts index 24b9b2d9779..6c4080090bb 100644 --- a/src/vs/workbench/contrib/tasks/browser/tasksQuickAccess.ts +++ b/src/vs/workbench/contrib/tasks/browser/tasksQuickAccess.ts @@ -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 { CancellationToken } from 'vs/base/common/cancellation'; 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 { isString } from 'vs/base/common/types'; import { INotificationService } from 'vs/platform/notification/common/notification'; @@ -56,8 +56,8 @@ export class TasksQuickAccessProvider extends PickerQuickAccessProviderentry).task!; - const quickAccessEntry: IPickerQuickAccessItem = entry; + const task: Task | ConfiguringTask | string = (entry).task!; + const quickAccessEntry: IPickerQuickAccessItem = entry; quickAccessEntry.highlights = { label: highlights }; quickAccessEntry.trigger = (index) => { if ((index === 1) && (quickAccessEntry.buttons?.length === 2)) { diff --git a/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts b/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts index 2c06dbc8717..db3cdbd6a79 100644 --- a/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts +++ b/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts @@ -30,12 +30,12 @@ import { ITerminalService, ITerminalInstance, ITerminalGroupService } from 'vs/w import { IOutputService } from 'vs/workbench/services/output/common/output'; import { StartStopProblemCollector, WatchingProblemCollector, ProblemCollectorEventKind, ProblemHandlingStrategy } from 'vs/workbench/contrib/tasks/common/problemCollectors'; import { - Task, CustomTask, ContributedTask, RevealKind, CommandOptions, ShellConfiguration, RuntimeType, PanelKind, - TaskEvent, TaskEventKind, ShellQuotingOptions, ShellQuoting, CommandString, CommandConfiguration, ExtensionTaskSource, TaskScope, RevealProblemKind, DependsOrder, TaskSourceKind, InMemoryTask + Task, CustomTask, ContributedTask, RevealKind, CommandOptions, IShellConfiguration, RuntimeType, PanelKind, + TaskEvent, TaskEventKind, IShellQuotingOptions, ShellQuoting, CommandString, ICommandConfiguration, IExtensionTaskSource, TaskScope, RevealProblemKind, DependsOrder, TaskSourceKind, InMemoryTask, ITaskEvent } from 'vs/workbench/contrib/tasks/common/tasks'; import { 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'; import { URI } from 'vs/base/common/uri'; 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 { INotificationService } from 'vs/platform/notification/common/notification'; -interface TerminalData { +interface ITerminalData { terminal: ITerminalInstance; lastTask: string; group?: string; } -interface ActiveTerminalData { +interface IActiveTerminalData { terminal: ITerminalInstance; task: Task; promise: Promise; @@ -85,7 +85,7 @@ class InstanceManager { class VariableResolver { private static regex = /\$\{(.*?)\}/g; - constructor(public workspaceFolder: IWorkspaceFolder | undefined, public taskSystemInfo: TaskSystemInfo | undefined, public readonly values: Map, private _service: IConfigurationResolverService | undefined) { + constructor(public workspaceFolder: IWorkspaceFolder | undefined, public taskSystemInfo: ITaskSystemInfo | undefined, public readonly values: Map, private _service: IConfigurationResolverService | undefined) { } async resolve(value: string): Promise { const replacers: Promise[] = []; @@ -115,8 +115,8 @@ export class VerifiedTask { readonly task: Task; readonly resolver: ITaskResolver; readonly trigger: string; - resolvedVariables?: ResolvedVariables; - systemInfo?: TaskSystemInfo; + resolvedVariables?: IResolvedVariables; + systemInfo?: ITaskSystemInfo; workspaceFolder?: IWorkspaceFolder; shellLaunchConfig?: IShellLaunchConfig; @@ -134,7 +134,7 @@ export class VerifiedTask { 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()) { return { task: this.task, resolver: this.resolver, trigger: this.trigger, resolvedVariables: this.resolvedVariables!, systemInfo: this.systemInfo!, workspaceFolder: this.workspaceFolder!, shellLaunchConfig: this.shellLaunchConfig! }; } else { @@ -149,7 +149,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { private static readonly ProcessVarName = '__process__'; - private static shellQuotes: IStringDictionary = { + private static shellQuotes: IStringDictionary = { 'cmd': { strong: '"' }, @@ -179,19 +179,19 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { } }; - private static osShellQuotes: IStringDictionary = { + private static osShellQuotes: IStringDictionary = { 'Linux': TerminalTaskSystem.shellQuotes['bash'], 'Mac': TerminalTaskSystem.shellQuotes['bash'], 'Windows': TerminalTaskSystem.shellQuotes['powershell'] }; - private activeTasks: IStringDictionary; + private activeTasks: IStringDictionary; private instances: IStringDictionary; private busyTasks: IStringDictionary; - private terminals: IStringDictionary; + private terminals: IStringDictionary; private idleTaskTerminals: LinkedMap; private sameTaskTerminals: IStringDictionary; - private taskSystemInfoResolver: TaskSystemInfoResolver; + private taskSystemInfoResolver: ITaskSystemInfoResolver; private lastTask: VerifiedTask | undefined; // Should always be set in run private currentTask!: VerifiedTask; @@ -201,7 +201,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { private terminalStatusManager: TaskTerminalStatus; private terminalCreationQueue: Promise = Promise.resolve(); - private readonly _onDidStateChange: Emitter; + private readonly _onDidStateChange: Emitter; constructor( private terminalService: ITerminalService, @@ -222,7 +222,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { private configurationService: IConfigurationService, private notificationService: INotificationService, taskService: ITaskService, - taskSystemInfoResolver: TaskSystemInfoResolver, + taskSystemInfoResolver: ITaskSystemInfoResolver, ) { super(); @@ -238,7 +238,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { this._register(this.terminalStatusManager = new TaskTerminalStatus(taskService)); } - public get onDidStateChange(): Event { + public get onDidStateChange(): Event { return this._onDidStateChange.event; } @@ -425,7 +425,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { this.removeInstances(task); } - private fireTaskEvent(event: TaskEvent) { + private fireTaskEvent(event: ITaskEvent) { if (event.__task) { const activeTask = this.activeTasks[event.__task.getMapKey()]; if (activeTask) { @@ -435,12 +435,12 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { this._onDidStateChange.fire(event); } - public terminate(task: Task): Promise { + public terminate(task: Task): Promise { let activeTerminal = this.activeTasks[task.getMapKey()]; if (!activeTerminal) { - return Promise.resolve({ success: false, task: undefined }); + return Promise.resolve({ success: false, task: undefined }); } - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { let terminal = activeTerminal.terminal; const onExit = terminal.onExit(() => { @@ -457,12 +457,12 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { }); } - public terminateAll(): Promise { - let promises: Promise[] = []; + public terminateAll(): Promise { + let promises: Promise[] = []; Object.keys(this.activeTasks).forEach((key) => { let terminalData = this.activeTasks[key]; let terminal = terminalData.terminal; - promises.push(new Promise((resolve, reject) => { + promises.push(new Promise((resolve, reject) => { const onExit = terminal.onExit(() => { let task = terminalData.task; try { @@ -477,7 +477,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { terminal.dispose(); }); this.activeTasks = Object.create(null); - return Promise.all(promises); + return Promise.all(promises); } @@ -571,7 +571,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { }); } - private async getDependencyPromise(task: ActiveTerminalData): Promise { + private async getDependencyPromise(task: IActiveTerminalData): Promise { if (!task.task.configurationProperties.isBackground) { 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)]); } - private async resolveAndFindExecutable(systemInfo: TaskSystemInfo | undefined, workspaceFolder: IWorkspaceFolder | undefined, task: CustomTask | ContributedTask, cwd: string | undefined, envPath: string | undefined): Promise { + private async resolveAndFindExecutable(systemInfo: ITaskSystemInfo | undefined, workspaceFolder: IWorkspaceFolder | undefined, task: CustomTask | ContributedTask, cwd: string | undefined, envPath: string | undefined): Promise { const command = await this.configurationResolverService.resolveAsync(workspaceFolder, CommandString.value(task.command.name!)); 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; @@ -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, alreadyResolved: Map): Promise { + private async acquireInput(taskSystemInfo: ITaskSystemInfo | undefined, workspaceFolder: IWorkspaceFolder | undefined, task: CustomTask | ContributedTask, variables: Set, alreadyResolved: Map): Promise { const resolved = await this.resolveVariablesFromSet(taskSystemInfo, workspaceFolder, task, variables, alreadyResolved); this.fireTaskEvent(TaskEvent.create(TaskEventKind.AcquiredInput, task)); return resolved; } - private resolveVariablesFromSet(taskSystemInfo: TaskSystemInfo | undefined, workspaceFolder: IWorkspaceFolder | undefined, task: CustomTask | ContributedTask, variables: Set, alreadyResolved: Map): Promise { + private resolveVariablesFromSet(taskSystemInfo: ITaskSystemInfo | undefined, workspaceFolder: IWorkspaceFolder | undefined, task: CustomTask | ContributedTask, variables: Set, alreadyResolved: Map): Promise { let isProcess = task.command && task.command.runtime === RuntimeType.Process; let options = task.command && task.command.options ? task.command.options : undefined; let cwd = options ? options.cwd : undefined; @@ -649,9 +649,9 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { } } const unresolved = this.findUnresolvedVariables(variables, alreadyResolved); - let resolvedVariables: Promise; + let resolvedVariables: Promise; if (taskSystemInfo && workspaceFolder) { - let resolveSet: ResolveSet = { + let resolveSet: IResolveSet = { variables: unresolved }; @@ -685,7 +685,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { let variablesArray = new Array(); unresolved.forEach(variable => variablesArray.push(variable)); - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { this.configurationResolverService.resolveWithInteraction(workspaceFolder, variablesArray, 'tasks', undefined, TaskSourceKind.toConfigurationTarget(task._source.kind)).then(async (resolvedVariablesMap: Map | undefined) => { if (resolvedVariablesMap) { this.mergeMaps(alreadyResolved, resolvedVariablesMap); @@ -699,7 +699,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { } resolvedVariablesMap.set(TerminalTaskSystem.ProcessVarName, processVarValue); } - let resolvedVariablesResult: ResolvedVariables = { + let resolvedVariablesResult: IResolvedVariables = { variables: resolvedVariablesMap, }; resolve(resolvedVariablesResult); @@ -722,7 +722,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { const folders = this.contextService.getWorkspace().folders; 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(); this.collectTaskVariables(variables, task); @@ -1037,7 +1037,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { waitOnExit }; 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.executable) { // 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 taskKey = task.getMapKey(); - let terminalToReuse: TerminalData | undefined; + let terminalToReuse: ITerminalData | undefined; if (prefersSameTerminal) { let terminalId = this.sameTaskTerminals[taskKey]; if (terminalId) { @@ -1326,7 +1326,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { 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 shellQuoteOptions = this.getQuotingOptions(basename, shellOptions, platform); @@ -1425,7 +1425,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { 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) { return shellOptions.quoting; } @@ -1463,7 +1463,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { } } - private collectCommandVariables(variables: Set, command: CommandConfiguration, task: CustomTask | ContributedTask): void { + private collectCommandVariables(variables: Set, command: ICommandConfiguration, task: CustomTask | ContributedTask): void { // The custom execution should have everything it needs already as it provided // the callback. if (command.runtime === RuntimeType.CustomExecution) { @@ -1478,7 +1478,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { command.args.forEach(arg => this.collectVariables(variables, arg)); } // Try to get a scope. - const scope = (task._source).scope; + const scope = (task._source).scope; if (scope !== TaskScope.Global) { variables.add('${workspaceFolder}'); } @@ -1540,7 +1540,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem { } 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: let args: CommandString[] = commandConfig.args ? commandConfig.args.slice() : []; 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')); continue; } - let taskSystemInfo: TaskSystemInfo | undefined = resolver.taskSystemInfo; + let taskSystemInfo: ITaskSystemInfo | undefined = resolver.taskSystemInfo; let hasFilePrefix = matcher.filePrefix !== undefined; let hasUriProvider = taskSystemInfo !== undefined && taskSystemInfo.uriProvider !== undefined; if (!hasFilePrefix && !hasUriProvider) { diff --git a/src/vs/workbench/contrib/tasks/common/problemCollectors.ts b/src/vs/workbench/contrib/tasks/common/problemCollectors.ts index 081843db236..7fa7589e838 100644 --- a/src/vs/workbench/contrib/tasks/common/problemCollectors.ts +++ b/src/vs/workbench/contrib/tasks/common/problemCollectors.ts @@ -10,7 +10,7 @@ import { IDisposable, DisposableStore } from 'vs/base/common/lifecycle'; 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 { generateUuid } from 'vs/base/common/uuid'; import { IFileService } from 'vs/platform/files/common/files'; @@ -21,11 +21,11 @@ export const enum ProblemCollectorEventKind { BackgroundProcessingEnds = 'backgroundProcessingEnds' } -export interface ProblemCollectorEvent { +export interface IProblemCollectorEvent { kind: ProblemCollectorEventKind; } -namespace ProblemCollectorEvent { +namespace IProblemCollectorEvent { export function create(kind: ProblemCollectorEventKind) { return Object.freeze({ kind }); } @@ -56,7 +56,7 @@ export abstract class AbstractProblemCollector implements IDisposable { // [owner] -> [resource] -> number; private deliveredMarkers: Map>; - protected _onDidStateChange: Emitter; + protected _onDidStateChange: Emitter; constructor(public readonly problemMatchers: ProblemMatcher[], protected markerService: IMarkerService, protected modelService: IModelService, fileService?: IFileService) { this.matchers = Object.create(null); @@ -101,7 +101,7 @@ export abstract class AbstractProblemCollector implements IDisposable { this._onDidStateChange = new Emitter(); } - public get onDidStateChange(): Event { + public get onDidStateChange(): Event { return this._onDidStateChange.event; } @@ -130,8 +130,8 @@ export abstract class AbstractProblemCollector implements IDisposable { return this._maxMarkerSeverity; } - protected tryFindMarker(line: string): ProblemMatch | null { - let result: ProblemMatch | null = null; + protected tryFindMarker(line: string): IProblemMatch | null { + let result: IProblemMatch | null = null; if (this.activeMatcher) { result = this.activeMatcher.next(line); if (result) { @@ -158,7 +158,7 @@ export abstract class AbstractProblemCollector implements IDisposable { return result; } - protected async shouldApplyMatch(result: ProblemMatch): Promise { + protected async shouldApplyMatch(result: IProblemMatch): Promise { switch (result.description.applyTo) { case ApplyToKind.allDocuments: return true; @@ -178,7 +178,7 @@ export abstract class AbstractProblemCollector implements IDisposable { return ApplyToKind.allDocuments; } - private tryMatchers(): ProblemMatch | null { + private tryMatchers(): IProblemMatch | null { this.activeMatcher = null; let length = this.buffer.length; for (let startIndex = 0; startIndex < length; startIndex++) { @@ -200,7 +200,7 @@ export abstract class AbstractProblemCollector implements IDisposable { return null; } - private captureMatch(match: ProblemMatch): void { + private captureMatch(match: IProblemMatch): void { this._numberOfMatches++; if (this._maxMarkerSeverity === undefined || match.marker.severity > this._maxMarkerSeverity) { this._maxMarkerSeverity = match.marker.severity; @@ -387,16 +387,16 @@ export class StartStopProblemCollector extends AbstractProblemCollector implemen } } -interface BackgroundPatterns { +interface IBackgroundPatterns { key: string; matcher: ProblemMatcher; - begin: WatchingPattern; - end: WatchingPattern; + begin: IWatchingPattern; + end: IWatchingPattern; } export class WatchingProblemCollector extends AbstractProblemCollector implements IProblemMatcher { - private backgroundPatterns: BackgroundPatterns[]; + private backgroundPatterns: IBackgroundPatterns[]; // workaround for https://github.com/microsoft/vscode/issues/44018 private _activeBackgroundMatchers: Set; @@ -450,7 +450,7 @@ export class WatchingProblemCollector extends AbstractProblemCollector implement for (let background of this.backgroundPatterns) { if (background.matcher.watching && background.matcher.watching.activeOnStart) { this._activeBackgroundMatchers.add(background.key); - this._onDidStateChange.fire(ProblemCollectorEvent.create(ProblemCollectorEventKind.BackgroundProcessingBegins)); + this._onDidStateChange.fire(IProblemCollectorEvent.create(ProblemCollectorEventKind.BackgroundProcessingBegins)); this.recordResourcesToClean(background.matcher.owner); } } @@ -496,7 +496,7 @@ export class WatchingProblemCollector extends AbstractProblemCollector implement result = true; this.lines = []; this.lines.push(line); - this._onDidStateChange.fire(ProblemCollectorEvent.create(ProblemCollectorEventKind.BackgroundProcessingBegins)); + this._onDidStateChange.fire(IProblemCollectorEvent.create(ProblemCollectorEventKind.BackgroundProcessingBegins)); this.cleanMarkerCaches(); this.resetCurrentResource(); let owner = background.matcher.owner; @@ -520,7 +520,7 @@ export class WatchingProblemCollector extends AbstractProblemCollector implement if (this._activeBackgroundMatchers.has(background.key)) { this._activeBackgroundMatchers.delete(background.key); this.resetCurrentResource(); - this._onDidStateChange.fire(ProblemCollectorEvent.create(ProblemCollectorEventKind.BackgroundProcessingEnds)); + this._onDidStateChange.fire(IProblemCollectorEvent.create(ProblemCollectorEventKind.BackgroundProcessingEnds)); result = true; this.lines.push(line); let owner = background.matcher.owner; diff --git a/src/vs/workbench/contrib/tasks/common/problemMatcher.ts b/src/vs/workbench/contrib/tasks/common/problemMatcher.ts index 296d268d888..544942e78d5 100644 --- a/src/vs/workbench/contrib/tasks/common/problemMatcher.ts +++ b/src/vs/workbench/contrib/tasks/common/problemMatcher.ts @@ -63,7 +63,7 @@ export module ProblemLocationKind { } } -export interface ProblemPattern { +export interface IProblemPattern { regexp: RegExp; kind?: ProblemLocationKind; @@ -89,21 +89,21 @@ export interface ProblemPattern { loop?: boolean; } -export interface NamedProblemPattern extends ProblemPattern { +export interface INamedProblemPattern extends IProblemPattern { name: string; } -export type MultiLineProblemPattern = ProblemPattern[]; +export type MultiLineProblemPattern = IProblemPattern[]; -export interface WatchingPattern { +export interface IWatchingPattern { regexp: RegExp; file?: number; } -export interface WatchingMatcher { +export interface IWatchingMatcher { activeOnStart: boolean; - beginsPattern: WatchingPattern; - endsPattern: WatchingPattern; + beginsPattern: IWatchingPattern; + endsPattern: IWatchingPattern; } export enum ApplyToKind { @@ -133,36 +133,36 @@ export interface ProblemMatcher { applyTo: ApplyToKind; fileLocation: FileLocationKind; filePrefix?: string; - pattern: ProblemPattern | ProblemPattern[]; + pattern: IProblemPattern | IProblemPattern[]; severity?: Severity; - watching?: WatchingMatcher; + watching?: IWatchingMatcher; uriProvider?: (path: string) => URI; } -export interface NamedProblemMatcher extends ProblemMatcher { +export interface INamedProblemMatcher extends ProblemMatcher { name: string; label: string; deprecated?: boolean; } -export interface NamedMultiLineProblemPattern { +export interface INamedMultiLineProblemPattern { name: string; label: string; patterns: MultiLineProblemPattern; } -export function isNamedProblemMatcher(value: ProblemMatcher | undefined): value is NamedProblemMatcher { - return value && Types.isString((value).name) ? true : false; +export function isNamedProblemMatcher(value: ProblemMatcher | undefined): value is INamedProblemMatcher { + return value && Types.isString((value).name) ? true : false; } -interface Location { +interface ILocation { startLineNumber: number; startCharacter: number; endLineNumber: number; endCharacter: number; } -interface ProblemData { +interface IProblemData { kind?: ProblemLocationKind; file?: string; location?: string; @@ -175,14 +175,14 @@ interface ProblemData { code?: string; } -export interface ProblemMatch { +export interface IProblemMatch { resource: Promise; marker: IMarkerData; description: ProblemMatcher; } -export interface HandleResult { - match: ProblemMatch | null; +export interface IHandleResult { + match: IProblemMatch | null; continue: boolean; } @@ -230,8 +230,8 @@ export async function getResource(filename: string, matcher: ProblemMatcher, fil export interface ILineMatcher { matchLength: number; - next(line: string): ProblemMatch | null; - handle(lines: string[], start?: number): HandleResult; + next(line: string): IProblemMatch | null; + handle(lines: string[], start?: number): IHandleResult; } export function createLineMatcher(matcher: ProblemMatcher, fileService?: IFileService): ILineMatcher { @@ -254,17 +254,17 @@ abstract class AbstractLineMatcher implements ILineMatcher { this.fileService = fileService; } - public handle(lines: string[], start: number = 0): HandleResult { + public handle(lines: string[], start: number = 0): IHandleResult { return { match: null, continue: false }; } - public next(line: string): ProblemMatch | null { + public next(line: string): IProblemMatch | null { return null; } 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) { this.fillProperty(data, 'file', 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]; if (Types.isUndefined(data[property])) { 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]; if (Types.isUndefined(data[property]) && !Types.isUndefined(patternAtProperty) && patternAtProperty < matches.length) { 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 { let location = this.getLocation(data); if (data.file && location && data.message) { @@ -342,7 +342,7 @@ abstract class AbstractLineMatcher implements ILineMatcher { return getResource(filename, this.matcher, this.fileService); } - private getLocation(data: ProblemData): Location | null { + private getLocation(data: IProblemData): ILocation | null { if (data.kind === ProblemLocationKind.File) { return this.createLocation(0, 0, 0, 0); } @@ -359,7 +359,7 @@ abstract class AbstractLineMatcher implements ILineMatcher { 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+)/)) { 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) { 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 } - private getSeverity(data: ProblemData): MarkerSeverity { + private getSeverity(data: IProblemData): MarkerSeverity { let result: Severity | null = null; if (data.severity) { let value = data.severity; @@ -413,20 +413,20 @@ abstract class AbstractLineMatcher implements ILineMatcher { class SingleLineMatcher extends AbstractLineMatcher { - private pattern: ProblemPattern; + private pattern: IProblemPattern; constructor(matcher: ProblemMatcher, fileService?: IFileService) { super(matcher, fileService); - this.pattern = matcher.pattern; + this.pattern = matcher.pattern; } public get matchLength(): number { 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); - let data: ProblemData = Object.create(null); + let data: IProblemData = Object.create(null); if (this.pattern.kind !== undefined) { data.kind = this.pattern.kind; } @@ -441,26 +441,26 @@ class SingleLineMatcher extends AbstractLineMatcher { return { match: null, continue: false }; } - public override next(line: string): ProblemMatch | null { + public override next(line: string): IProblemMatch | null { return null; } } class MultiLineMatcher extends AbstractLineMatcher { - private patterns: ProblemPattern[]; - private data: ProblemData | undefined; + private patterns: IProblemPattern[]; + private data: IProblemData | undefined; constructor(matcher: ProblemMatcher, fileService?: IFileService) { super(matcher, fileService); - this.patterns = matcher.pattern; + this.patterns = matcher.pattern; } public get matchLength(): number { 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); this.data = Object.create(null); let data = this.data!; @@ -486,7 +486,7 @@ class MultiLineMatcher extends AbstractLineMatcher { 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]; Assert.ok(pattern.loop === true && this.data !== null); let matches = pattern.regexp.exec(line); @@ -495,7 +495,7 @@ class MultiLineMatcher extends AbstractLineMatcher { return null; } let data = Objects.deepClone(this.data); - let problemMatch: ProblemMatch | undefined; + let problemMatch: IProblemMatch | undefined; if (this.fillProblemData(data, pattern, matches)) { problemMatch = this.getMarkerMatch(data); } @@ -505,7 +505,7 @@ class MultiLineMatcher extends AbstractLineMatcher { export namespace Config { - export interface ProblemPattern { + export interface IProblemPattern { /** * The regular expression to find a problem in the console output of an @@ -591,7 +591,7 @@ export namespace Config { 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 * executed task. @@ -600,13 +600,13 @@ export namespace Config { } export namespace CheckedProblemPattern { - export function is(value: any): value is CheckedProblemPattern { - let candidate: ProblemPattern = value as ProblemPattern; + export function is(value: any): value is ICheckedProblemPattern { + let candidate: IProblemPattern = value as IProblemPattern; return candidate && Types.isString(candidate.regexp); } } - export interface NamedProblemPattern extends ProblemPattern { + export interface INamedProblemPattern extends IProblemPattern { /** * The name of the problem pattern. */ @@ -619,13 +619,13 @@ export namespace Config { } export namespace NamedProblemPattern { - export function is(value: any): value is NamedProblemPattern { - let candidate: NamedProblemPattern = value as NamedProblemPattern; + export function is(value: any): value is INamedProblemPattern { + let candidate: INamedProblemPattern = value as INamedProblemPattern; 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 * executed task. @@ -634,13 +634,13 @@ export namespace Config { } export namespace NamedCheckedProblemPattern { - export function is(value: any): value is NamedCheckedProblemPattern { - let candidate: NamedProblemPattern = value as NamedProblemPattern; + export function is(value: any): value is INamedCheckedProblemPattern { + let candidate: INamedProblemPattern = value as INamedProblemPattern; return candidate && NamedProblemPattern.is(candidate) && Types.isString(candidate.regexp); } } - export type MultiLineProblemPattern = ProblemPattern[]; + export type MultiLineProblemPattern = IProblemPattern[]; export namespace 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 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. */ @@ -682,18 +682,18 @@ export namespace Config { } export namespace NamedMultiLineCheckedProblemPattern { - export function is(value: any): value is NamedMultiLineCheckedProblemPattern { - let candidate = value as NamedMultiLineCheckedProblemPattern; + export function is(value: any): value is INamedMultiLineCheckedProblemPattern { + let candidate = value as INamedMultiLineCheckedProblemPattern; 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 */ - export interface WatchingPattern { + export interface IWatchingPattern { /** * The actual regular expression */ @@ -709,7 +709,7 @@ export namespace Config { /** * 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 @@ -721,12 +721,12 @@ export namespace Config { /** * 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. */ - 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 * problems spread over multiple lines. */ - pattern?: string | ProblemPattern | ProblemPattern[]; + pattern?: string | IProblemPattern | IProblemPattern[]; /** * A regular expression signaling that a watched tasks begins executing @@ -820,13 +820,13 @@ export namespace Config { /** * @deprecated Use background instead. */ - watching?: BackgroundMonitor; - background?: BackgroundMonitor; + watching?: IBackgroundMonitor; + background?: IBackgroundMonitor; } export type ProblemMatcherType = string | ProblemMatcher | Array; - export interface NamedProblemMatcher extends ProblemMatcher { + export interface INamedProblemMatcher extends ProblemMatcher { /** * This name can be used to refer to the * problem matcher from within a task. @@ -839,8 +839,8 @@ export namespace Config { label?: string; } - export function isNamedProblemMatcher(value: ProblemMatcher): value is NamedProblemMatcher { - return Types.isString((value).name); + export function isNamedProblemMatcher(value: ProblemMatcher): value is INamedProblemMatcher { + return Types.isString((value).name); } } @@ -850,17 +850,17 @@ export class ProblemPatternParser extends Parser { super(logger); } - public parse(value: Config.ProblemPattern): ProblemPattern; + public parse(value: Config.IProblemPattern): IProblemPattern; public parse(value: Config.MultiLineProblemPattern): MultiLineProblemPattern; - public parse(value: Config.NamedProblemPattern): NamedProblemPattern; - public parse(value: Config.NamedMultiLineCheckedProblemPattern): NamedMultiLineProblemPattern; - public parse(value: Config.ProblemPattern | Config.MultiLineProblemPattern | Config.NamedProblemPattern | Config.NamedMultiLineCheckedProblemPattern): any { + public parse(value: Config.INamedProblemPattern): INamedProblemPattern; + public parse(value: Config.INamedMultiLineCheckedProblemPattern): INamedMultiLineProblemPattern; + public parse(value: Config.IProblemPattern | Config.MultiLineProblemPattern | Config.INamedProblemPattern | Config.INamedMultiLineCheckedProblemPattern): any { if (Config.NamedMultiLineCheckedProblemPattern.is(value)) { return this.createNamedMultiLineProblemPattern(value); } else if (Config.MultiLineCheckedProblemPattern.is(value)) { return this.createMultiLineProblemPattern(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; return result; } 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); if (result === undefined) { return null; @@ -881,7 +881,7 @@ export class ProblemPatternParser extends Parser { 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); if (!validPatterns) { return null; @@ -915,17 +915,17 @@ export class ProblemPatternParser extends Parser { 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); if (regexp === undefined) { return undefined; } - let result: ProblemPattern = { regexp }; + let result: IProblemPattern = { regexp }; if (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]; if (typeof value === 'number') { (result as any)[resultKey] = value; @@ -945,13 +945,13 @@ export class ProblemPatternParser extends Parser { } if (setDefaults) { if (result.location || result.kind === ProblemLocationKind.File) { - let defaultValue: Partial = { + let defaultValue: Partial = { file: 1, message: 0 }; result = Objects.mixin(result, defaultValue, false); } else { - let defaultValue: Partial = { + let defaultValue: Partial = { file: 1, line: 2, character: 3, @@ -963,7 +963,7 @@ export class ProblemPatternParser extends Parser { 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 locationKind = (values[0].kind === undefined) ? ProblemLocationKind.Location : values[0].kind; @@ -1136,12 +1136,12 @@ const problemPatternExtPoint = ExtensionsRegistry.registerExtensionPoint; - get(key: string): ProblemPattern | MultiLineProblemPattern; + get(key: string): IProblemPattern | MultiLineProblemPattern; } class ProblemPatternRegistryImpl implements IProblemPatternRegistry { - private patterns: IStringDictionary; + private patterns: IStringDictionary; private readyPromise: Promise; constructor() { @@ -1196,11 +1196,11 @@ class ProblemPatternRegistryImpl implements IProblemPatternRegistry { return this.readyPromise; } - public add(key: string, value: ProblemPattern | ProblemPattern[]): void { + public add(key: string, value: IProblemPattern | IProblemPattern[]): void { this.patterns[key] = value; } - public get(key: string): ProblemPattern | ProblemPattern[] { + public get(key: string): IProblemPattern | IProblemPattern[] { return this.patterns[key]; } @@ -1447,13 +1447,13 @@ export class ProblemMatcherParser extends Parser { } } if (Config.isNamedProblemMatcher(description)) { - (result as NamedProblemMatcher).name = description.name; - (result as NamedProblemMatcher).label = Types.isString(description.label) ? description.label : description.name; + (result as INamedProblemMatcher).name = description.name; + (result as INamedProblemMatcher).label = Types.isString(description.label) ? description.label : description.name; } 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)) { let variableName: string = value; if (variableName.length > 1 && variableName[0] === '$') { @@ -1495,8 +1495,8 @@ export class ProblemMatcherParser extends Parser { if (Types.isUndefinedOrNull(backgroundMonitor)) { return; } - let begins: WatchingPattern | null = this.createWatchingPattern(backgroundMonitor.beginsPattern); - let ends: WatchingPattern | null = this.createWatchingPattern(backgroundMonitor.endsPattern); + let begins: IWatchingPattern | null = this.createWatchingPattern(backgroundMonitor.beginsPattern); + let ends: IWatchingPattern | null = this.createWatchingPattern(backgroundMonitor.endsPattern); if (begins && ends) { internal.watching = { 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)) { return null; } @@ -1703,7 +1703,7 @@ export namespace Schemas { }; } -const problemMatchersExtPoint = ExtensionsRegistry.registerExtensionPoint({ +const problemMatchersExtPoint = ExtensionsRegistry.registerExtensionPoint({ extensionPoint: 'problemMatchers', deps: [problemPatternExtPoint], jsonSchema: { @@ -1715,14 +1715,14 @@ const problemMatchersExtPoint = ExtensionsRegistry.registerExtensionPoint; - get(name: string): NamedProblemMatcher; + get(name: string): INamedProblemMatcher; keys(): string[]; readonly onMatcherChanged: Event; } class ProblemMatcherRegistryImpl implements IProblemMatcherRegistry { - private matchers: IStringDictionary; + private matchers: IStringDictionary; private readyPromise: Promise; private readonly _onMatchersChanged: Emitter = new Emitter(); public readonly onMatcherChanged: Event = this._onMatchersChanged.event; @@ -1771,11 +1771,11 @@ class ProblemMatcherRegistryImpl implements IProblemMatcherRegistry { return this.readyPromise; } - public add(matcher: NamedProblemMatcher): void { + public add(matcher: INamedProblemMatcher): void { this.matchers[matcher.name] = matcher; } - public get(name: string): NamedProblemMatcher { + public get(name: string): INamedProblemMatcher { return this.matchers[name]; } diff --git a/src/vs/workbench/contrib/tasks/common/taskConfiguration.ts b/src/vs/workbench/contrib/tasks/common/taskConfiguration.ts index 938472b690d..a2b5524e808 100644 --- a/src/vs/workbench/contrib/tasks/common/taskConfiguration.ts +++ b/src/vs/workbench/contrib/tasks/common/taskConfiguration.ts @@ -14,7 +14,7 @@ import * as UUID from 'vs/base/common/uuid'; import { ValidationStatus, IProblemReporter as IProblemReporterBase } from 'vs/base/common/parsers'; import { - NamedProblemMatcher, ProblemMatcherParser, Config as ProblemMatcherConfig, + INamedProblemMatcher, ProblemMatcherParser, Config as ProblemMatcherConfig, isNamedProblemMatcher, ProblemMatcherRegistry, ProblemMatcher } from 'vs/workbench/contrib/tasks/common/problemMatcher'; @@ -43,7 +43,7 @@ export const enum ShellQuoting { weak = 3 } -export interface ShellQuotingOptions { +export interface IShellQuotingOptions { /** * The character used to do character escaping. */ @@ -63,13 +63,13 @@ export interface ShellQuotingOptions { weak?: string; } -export interface ShellConfiguration { +export interface IShellConfiguration { executable?: string; args?: string[]; - quoting?: ShellQuotingOptions; + quoting?: IShellQuotingOptions; } -export interface CommandOptionsConfig { +export interface ICommandOptionsConfig { /** * The current working directory of the executed program or shell. * If omitted VSCode's current workspace root is used. @@ -85,10 +85,10 @@ export interface CommandOptionsConfig { /** * The shell configuration; */ - shell?: ShellConfiguration; + shell?: IShellConfiguration; } -export interface PresentationOptionsConfig { +export interface IPresentationOptionsConfig { /** * Controls whether the terminal executing a task is brought to front or not. * Defaults to `RevealKind.Always`. @@ -137,25 +137,25 @@ export interface PresentationOptionsConfig { close?: boolean; } -export interface RunOptionsConfig { +export interface IRunOptionsConfig { reevaluateOnRerun?: boolean; runOn?: string; instanceLimit?: number; } -export interface TaskIdentifier { +export interface ITaskIdentifier { type?: string; [name: string]: any; } -export namespace TaskIdentifier { - export function is(value: any): value is TaskIdentifier { - let candidate: TaskIdentifier = value; +export namespace ITaskIdentifier { + export function is(value: any): value is ITaskIdentifier { + let candidate: ITaskIdentifier = value; return candidate !== undefined && Types.isString(value.type); } } -export interface LegacyTaskProperties { +export interface ILegacyTaskProperties { /** * @deprecated Use `isBackground` instead. * Whether the executed command is kept alive and is watching the file system. @@ -175,7 +175,7 @@ export interface LegacyTaskProperties { isTestCommand?: boolean; } -export interface LegacyCommandProperties { +export interface ILegacyCommandProperties { /** * Whether this is a shell or process @@ -198,7 +198,7 @@ export interface LegacyCommandProperties { /** * @deprecated Use presentation instead */ - terminal?: PresentationOptionsConfig; + terminal?: IPresentationOptionsConfig; /** * @deprecated Use inline commands. @@ -220,7 +220,7 @@ export interface LegacyCommandProperties { * * Defaults to false if omitted. */ - isShellCommand?: boolean | ShellConfiguration; + isShellCommand?: boolean | IShellConfiguration; } export type CommandString = string | string[] | { value: string | string[]; quoting: 'escape' | 'strong' | 'weak' }; @@ -241,7 +241,7 @@ export namespace CommandString { } } -export interface BaseCommandProperties { +export interface IBaseCommandProperties { /** * The command to be executed. Can be an external program or a shell @@ -252,7 +252,7 @@ export interface BaseCommandProperties { /** * The command options used when the command is executed. Can be omitted. */ - options?: CommandOptionsConfig; + options?: ICommandOptionsConfig; /** * The arguments passed to the command or additional arguments passed to the @@ -262,30 +262,30 @@ export interface BaseCommandProperties { } -export interface CommandProperties extends BaseCommandProperties { +export interface ICommandProperties extends IBaseCommandProperties { /** * Windows specific command properties */ - windows?: BaseCommandProperties; + windows?: IBaseCommandProperties; /** * OSX specific command properties */ - osx?: BaseCommandProperties; + osx?: IBaseCommandProperties; /** * linux specific command properties */ - linux?: BaseCommandProperties; + linux?: IBaseCommandProperties; } -export interface GroupKind { +export interface IGroupKind { kind?: string; isDefault?: boolean | string; } -export interface ConfigurationProperties { +export interface IConfigurationProperties { /** * The task's name */ @@ -315,7 +315,7 @@ export interface ConfigurationProperties { /** * Defines the group the task belongs too. */ - group?: string | GroupKind; + group?: string | IGroupKind; /** * A description of the task. @@ -325,7 +325,7 @@ export interface ConfigurationProperties { /** * The other tasks the task depend on */ - dependsOn?: string | TaskIdentifier | Array; + dependsOn?: string | ITaskIdentifier | Array; /** * The order the dependsOn tasks should be executed in. @@ -335,12 +335,12 @@ export interface ConfigurationProperties { /** * Controls the behavior of the used terminal */ - presentation?: PresentationOptionsConfig; + presentation?: IPresentationOptionsConfig; /** * Controls shell options. */ - options?: CommandOptionsConfig; + options?: ICommandOptionsConfig; /** * The problem matcher(s) to use to capture problems in the tasks @@ -351,10 +351,10 @@ export interface ConfigurationProperties { /** * Task run options. Control run related properties. */ - runOptions?: RunOptionsConfig; + runOptions?: IRunOptionsConfig; } -export interface CustomTask extends CommandProperties, ConfigurationProperties { +export interface ICustomTask extends ICommandProperties, IConfigurationProperties { /** * Custom tasks have the type CUSTOMIZED_TASK_TYPE */ @@ -362,7 +362,7 @@ export interface CustomTask extends CommandProperties, ConfigurationProperties { } -export interface ConfiguringTask extends ConfigurationProperties { +export interface IConfiguringTask extends IConfigurationProperties { /** * The contributed type of the task */ @@ -372,7 +372,7 @@ export interface ConfiguringTask extends ConfigurationProperties { /** * The base task runner configuration */ -export interface BaseTaskRunnerConfiguration { +export interface IBaseTaskRunnerConfiguration { /** * The command to be executed. Can be an external program or a shell @@ -398,7 +398,7 @@ export interface BaseTaskRunnerConfiguration { /** * The command options used when the command is executed. Can be omitted. */ - options?: CommandOptionsConfig; + options?: ICommandOptionsConfig; /** * The arguments passed to the command. Can be omitted. @@ -424,12 +424,12 @@ export interface BaseTaskRunnerConfiguration { /** * The group */ - group?: string | GroupKind; + group?: string | IGroupKind; /** * Controls the behavior of the used terminal */ - presentation?: PresentationOptionsConfig; + presentation?: IPresentationOptionsConfig; /** * If set to false the task name is added as an additional argument to the @@ -475,12 +475,12 @@ export interface BaseTaskRunnerConfiguration { * The configuration of the available tasks. A tasks.json file can either * contain a global problemMatcher property or a tasks property but not both. */ - tasks?: Array; + tasks?: Array; /** * Problem matcher declarations. */ - declares?: ProblemMatcherConfig.NamedProblemMatcher[]; + declares?: ProblemMatcherConfig.INamedProblemMatcher[]; /** * Optional user input variables. @@ -492,7 +492,7 @@ export interface BaseTaskRunnerConfiguration { * A configuration of an external build system. BuildConfiguration.buildSystem * must be set to 'program' */ -export interface ExternalTaskRunnerConfiguration extends BaseTaskRunnerConfiguration { +export interface IExternalTaskRunnerConfiguration extends IBaseTaskRunnerConfiguration { _runner?: string; @@ -509,17 +509,17 @@ export interface ExternalTaskRunnerConfiguration extends BaseTaskRunnerConfigura /** * Windows specific task configuration */ - windows?: BaseTaskRunnerConfiguration; + windows?: IBaseTaskRunnerConfiguration; /** * Mac specific task configuration */ - osx?: BaseTaskRunnerConfiguration; + osx?: IBaseTaskRunnerConfiguration; /** * Linux specific task configuration */ - linux?: BaseTaskRunnerConfiguration; + linux?: IBaseTaskRunnerConfiguration; } enum ProblemMatcherKind { @@ -552,21 +552,21 @@ function fillProperty(target: T, source: Partial, key: } -interface ParserType { +interface IParserType { isEmpty(value: T | undefined): boolean; assignProperties(target: T | undefined, source: T | undefined): T | undefined; fillProperties(target: T | undefined, source: T | undefined): T | undefined; - fillDefaults(value: T | undefined, context: ParseContext): T | undefined; + fillDefaults(value: T | undefined, context: IParseContext): T | undefined; freeze(value: T): Readonly | undefined; } -interface MetaData { +interface IMetaData { property: keyof T; - type?: ParserType; + type?: IParserType; } -function _isEmpty(this: void, value: T | undefined, properties: MetaData[] | undefined, allowEmptyArray: boolean = false): boolean { +function _isEmpty(this: void, value: T | undefined, properties: IMetaData[] | undefined, allowEmptyArray: boolean = false): boolean { if (value === undefined || value === null || properties === undefined) { return true; } @@ -583,7 +583,7 @@ function _isEmpty(this: void, value: T | undefined, properties: MetaData(this: void, target: T | undefined, source: T | undefined, properties: MetaData[]): T | undefined { +function _assignProperties(this: void, target: T | undefined, source: T | undefined, properties: IMetaData[]): T | undefined { if (!source || _isEmpty(source, properties)) { return target; } @@ -605,7 +605,7 @@ function _assignProperties(this: void, target: T | undefined, source: T | und return target; } -function _fillProperties(this: void, target: T | undefined, source: T | undefined, properties: MetaData[] | undefined, allowEmptyArray: boolean = false): T | undefined { +function _fillProperties(this: void, target: T | undefined, source: T | undefined, properties: IMetaData[] | undefined, allowEmptyArray: boolean = false): T | undefined { if (!source || _isEmpty(source, properties)) { return target; } @@ -627,7 +627,7 @@ function _fillProperties(this: void, target: T | undefined, source: T | undef return target; } -function _fillDefaults(this: void, target: T | undefined, defaults: T | undefined, properties: MetaData[], context: ParseContext): T | undefined { +function _fillDefaults(this: void, target: T | undefined, defaults: T | undefined, properties: IMetaData[], context: IParseContext): T | undefined { if (target && Object.isFrozen(target)) { return target; } @@ -657,7 +657,7 @@ function _fillDefaults(this: void, target: T | undefined, defaults: T | undef return target; } -function _freeze(this: void, target: T, properties: MetaData[]): Readonly | undefined { +function _freeze(this: void, target: T, properties: IMetaData[]): Readonly | undefined { if (target === undefined || target === null) { return undefined; } @@ -692,8 +692,8 @@ export namespace RunOnOptions { } export namespace RunOptions { - const properties: MetaData[] = [{ property: 'reevaluateOnRerun' }, { property: 'runOn' }, { property: 'instanceLimit' }]; - export function fromConfiguration(value: RunOptionsConfig | undefined): Tasks.RunOptions { + const properties: IMetaData[] = [{ property: 'reevaluateOnRerun' }, { property: 'runOn' }, { property: 'instanceLimit' }]; + export function fromConfiguration(value: IRunOptionsConfig | undefined): Tasks.IRunOptions { return { reevaluateOnRerun: value ? value.reevaluateOnRerun : true, runOn: value ? RunOnOptions.fromString(value.runOn) : Tasks.RunOnOptions.default, @@ -701,20 +701,20 @@ export namespace RunOptions { }; } - export function assignProperties(target: Tasks.RunOptions, source: Tasks.RunOptions | undefined): Tasks.RunOptions { + export function assignProperties(target: Tasks.IRunOptions, source: Tasks.IRunOptions | undefined): Tasks.IRunOptions { return _assignProperties(target, source, properties)!; } - export function fillProperties(target: Tasks.RunOptions, source: Tasks.RunOptions | undefined): Tasks.RunOptions { + export function fillProperties(target: Tasks.IRunOptions, source: Tasks.IRunOptions | undefined): Tasks.IRunOptions { return _fillProperties(target, source, properties)!; } } -export interface ParseContext { +export interface IParseContext { workspaceFolder: IWorkspaceFolder; workspace: IWorkspace | undefined; problemReporter: IProblemReporter; - namedProblemMatchers: IStringDictionary; + namedProblemMatchers: IStringDictionary; uuidMap: UUIDMap; engine: Tasks.ExecutionEngine; schemaVersion: Tasks.JsonSchemaVersion; @@ -726,18 +726,18 @@ export interface ParseContext { namespace ShellConfiguration { - const properties: MetaData[] = [{ property: 'executable' }, { property: 'args' }, { property: 'quoting' }]; + const properties: IMetaData[] = [{ property: 'executable' }, { property: 'args' }, { property: 'quoting' }]; - export function is(value: any): value is ShellConfiguration { - let candidate: ShellConfiguration = value; + export function is(value: any): value is IShellConfiguration { + let candidate: IShellConfiguration = value; return candidate && (Types.isString(candidate.executable) || Types.isStringArray(candidate.args)); } - export function from(this: void, config: ShellConfiguration | undefined, context: ParseContext): Tasks.ShellConfiguration | undefined { + export function from(this: void, config: IShellConfiguration | undefined, context: IParseContext): Tasks.IShellConfiguration | undefined { if (!is(config)) { return undefined; } - let result: ShellConfiguration = {}; + let result: IShellConfiguration = {}; if (config.executable !== undefined) { result.executable = config.executable; } @@ -751,23 +751,23 @@ namespace ShellConfiguration { return result; } - export function isEmpty(this: void, value: Tasks.ShellConfiguration): boolean { + export function isEmpty(this: void, value: Tasks.IShellConfiguration): boolean { return _isEmpty(value, properties, true); } - export function assignProperties(this: void, target: Tasks.ShellConfiguration | undefined, source: Tasks.ShellConfiguration | undefined): Tasks.ShellConfiguration | undefined { + export function assignProperties(this: void, target: Tasks.IShellConfiguration | undefined, source: Tasks.IShellConfiguration | undefined): Tasks.IShellConfiguration | undefined { return _assignProperties(target, source, properties); } - export function fillProperties(this: void, target: Tasks.ShellConfiguration, source: Tasks.ShellConfiguration): Tasks.ShellConfiguration | undefined { + export function fillProperties(this: void, target: Tasks.IShellConfiguration, source: Tasks.IShellConfiguration): Tasks.IShellConfiguration | undefined { return _fillProperties(target, source, properties, true); } - export function fillDefaults(this: void, value: Tasks.ShellConfiguration, context: ParseContext): Tasks.ShellConfiguration { + export function fillDefaults(this: void, value: Tasks.IShellConfiguration, context: IParseContext): Tasks.IShellConfiguration { return value; } - export function freeze(this: void, value: Tasks.ShellConfiguration): Readonly | undefined { + export function freeze(this: void, value: Tasks.IShellConfiguration): Readonly | undefined { if (!value) { return undefined; } @@ -777,10 +777,10 @@ namespace ShellConfiguration { namespace CommandOptions { - const properties: MetaData[] = [{ property: 'cwd' }, { property: 'env' }, { property: 'shell', type: ShellConfiguration }]; - const defaults: CommandOptionsConfig = { cwd: '${workspaceFolder}' }; + const properties: IMetaData[] = [{ property: 'cwd' }, { property: 'env' }, { property: 'shell', type: ShellConfiguration }]; + const defaults: ICommandOptionsConfig = { cwd: '${workspaceFolder}' }; - export function from(this: void, options: CommandOptionsConfig, context: ParseContext): Tasks.CommandOptions | undefined { + export function from(this: void, options: ICommandOptionsConfig, context: IParseContext): Tasks.CommandOptions | undefined { let result: Tasks.CommandOptions = {}; if (options.cwd !== undefined) { if (Types.isString(options.cwd)) { @@ -828,7 +828,7 @@ namespace CommandOptions { return _fillProperties(target, source, properties); } - export function fillDefaults(value: Tasks.CommandOptions | undefined, context: ParseContext): Tasks.CommandOptions | undefined { + export function fillDefaults(value: Tasks.CommandOptions | undefined, context: IParseContext): Tasks.CommandOptions | undefined { return _fillDefaults(value, defaults, properties, context); } @@ -840,13 +840,13 @@ namespace CommandOptions { namespace CommandConfiguration { export namespace PresentationOptions { - const properties: MetaData[] = [{ property: 'echo' }, { property: 'reveal' }, { property: 'revealProblems' }, { property: 'focus' }, { property: 'panel' }, { property: 'showReuseMessage' }, { property: 'clear' }, { property: 'group' }, { property: 'close' }]; + const properties: IMetaData[] = [{ property: 'echo' }, { property: 'reveal' }, { property: 'revealProblems' }, { property: 'focus' }, { property: 'panel' }, { property: 'showReuseMessage' }, { property: 'clear' }, { property: 'group' }, { property: 'close' }]; - interface PresentationOptionsShape extends LegacyCommandProperties { - presentation?: PresentationOptionsConfig; + interface IPresentationOptionsShape extends ILegacyCommandProperties { + presentation?: IPresentationOptionsConfig; } - export function from(this: void, config: PresentationOptionsShape, context: ParseContext): Tasks.PresentationOptions | undefined { + export function from(this: void, config: IPresentationOptionsShape, context: IParseContext): Tasks.IPresentationOptions | undefined { let echo: boolean; let reveal: Tasks.RevealKind; let revealProblems: Tasks.RevealProblemKind; @@ -902,24 +902,24 @@ namespace CommandConfiguration { return { echo: echo!, reveal: reveal!, revealProblems: revealProblems!, focus: focus!, panel: panel!, showReuseMessage: showReuseMessage!, clear: clear!, group, close: close }; } - export function assignProperties(target: Tasks.PresentationOptions, source: Tasks.PresentationOptions | undefined): Tasks.PresentationOptions | undefined { + export function assignProperties(target: Tasks.IPresentationOptions, source: Tasks.IPresentationOptions | undefined): Tasks.IPresentationOptions | undefined { return _assignProperties(target, source, properties); } - export function fillProperties(target: Tasks.PresentationOptions, source: Tasks.PresentationOptions | undefined): Tasks.PresentationOptions | undefined { + export function fillProperties(target: Tasks.IPresentationOptions, source: Tasks.IPresentationOptions | undefined): Tasks.IPresentationOptions | undefined { return _fillProperties(target, source, properties); } - export function fillDefaults(value: Tasks.PresentationOptions, context: ParseContext): Tasks.PresentationOptions | undefined { + export function fillDefaults(value: Tasks.IPresentationOptions, context: IParseContext): Tasks.IPresentationOptions | undefined { let defaultEcho = context.engine === Tasks.ExecutionEngine.Terminal ? true : false; return _fillDefaults(value, { echo: defaultEcho, reveal: Tasks.RevealKind.Always, revealProblems: Tasks.RevealProblemKind.Never, focus: false, panel: Tasks.PanelKind.Shared, showReuseMessage: true, clear: false }, properties, context); } - export function freeze(value: Tasks.PresentationOptions): Readonly | undefined { + export function freeze(value: Tasks.IPresentationOptions): Readonly | undefined { return _freeze(value, properties); } - export function isEmpty(this: void, value: Tasks.PresentationOptions): boolean { + export function isEmpty(this: void, value: Tasks.IPresentationOptions): boolean { return _isEmpty(value, properties); } } @@ -948,25 +948,25 @@ namespace CommandConfiguration { } } - interface BaseCommandConfigurationShape extends BaseCommandProperties, LegacyCommandProperties { + interface IBaseCommandConfigurationShape extends IBaseCommandProperties, ILegacyCommandProperties { } - interface CommandConfigurationShape extends BaseCommandConfigurationShape { - windows?: BaseCommandConfigurationShape; - osx?: BaseCommandConfigurationShape; - linux?: BaseCommandConfigurationShape; + interface ICommandConfigurationShape extends IBaseCommandConfigurationShape { + windows?: IBaseCommandConfigurationShape; + osx?: IBaseCommandConfigurationShape; + linux?: IBaseCommandConfigurationShape; } - const properties: MetaData[] = [ + const properties: IMetaData[] = [ { property: 'runtime' }, { property: 'name' }, { property: 'options', type: CommandOptions }, { property: 'args' }, { property: 'taskSelector' }, { property: 'suppressTaskName' }, { property: 'presentation', type: PresentationOptions } ]; - export function from(this: void, config: CommandConfigurationShape, context: ParseContext): Tasks.CommandConfiguration | undefined { - let result: Tasks.CommandConfiguration = fromBase(config, context)!; + export function from(this: void, config: ICommandConfigurationShape, context: IParseContext): Tasks.ICommandConfiguration | undefined { + let result: Tasks.ICommandConfiguration = fromBase(config, context)!; - let osConfig: Tasks.CommandConfiguration | undefined = undefined; + let osConfig: Tasks.ICommandConfiguration | undefined = undefined; if (config.windows && context.platform === Platform.Windows) { osConfig = fromBase(config.windows, context); } else if (config.osx && context.platform === Platform.Mac) { @@ -980,7 +980,7 @@ namespace CommandConfiguration { return isEmpty(result) ? undefined : result; } - function fromBase(this: void, config: BaseCommandConfigurationShape, context: ParseContext): Tasks.CommandConfiguration | undefined { + function fromBase(this: void, config: IBaseCommandConfigurationShape, context: IParseContext): Tasks.ICommandConfiguration | undefined { let name: Tasks.CommandString | undefined = ShellString.from(config.command); let runtime: Tasks.RuntimeType; if (Types.isString(config.type)) { @@ -995,7 +995,7 @@ namespace CommandConfiguration { runtime = !!config.isShellCommand ? Tasks.RuntimeType.Shell : Tasks.RuntimeType.Process; } - let result: Tasks.CommandConfiguration = { + let result: Tasks.ICommandConfiguration = { name: name, runtime: runtime!, presentation: PresentationOptions.from(config, context)! @@ -1020,7 +1020,7 @@ namespace CommandConfiguration { if (config.options !== undefined) { result.options = CommandOptions.from(config.options, context); if (result.options && result.options.shell === undefined && isShellConfiguration) { - result.options.shell = ShellConfiguration.from(config.isShellCommand as ShellConfiguration, context); + result.options.shell = ShellConfiguration.from(config.isShellCommand as IShellConfiguration, context); if (context.engine !== Tasks.ExecutionEngine.Terminal) { context.taskLoadIssues.push(nls.localize('ConfigurationParser.noShell', 'Warning: shell configuration is only supported when executing tasks in the terminal.')); } @@ -1037,15 +1037,15 @@ namespace CommandConfiguration { return isEmpty(result) ? undefined : result; } - export function hasCommand(value: Tasks.CommandConfiguration): boolean { + export function hasCommand(value: Tasks.ICommandConfiguration): boolean { return value && !!value.name; } - export function isEmpty(value: Tasks.CommandConfiguration | undefined): boolean { + export function isEmpty(value: Tasks.ICommandConfiguration | undefined): boolean { return _isEmpty(value, properties); } - export function assignProperties(target: Tasks.CommandConfiguration, source: Tasks.CommandConfiguration, overwriteArgs: boolean): Tasks.CommandConfiguration { + export function assignProperties(target: Tasks.ICommandConfiguration, source: Tasks.ICommandConfiguration, overwriteArgs: boolean): Tasks.ICommandConfiguration { if (isEmpty(source)) { return target; } @@ -1068,11 +1068,11 @@ namespace CommandConfiguration { return target; } - export function fillProperties(target: Tasks.CommandConfiguration, source: Tasks.CommandConfiguration): Tasks.CommandConfiguration | undefined { + export function fillProperties(target: Tasks.ICommandConfiguration, source: Tasks.ICommandConfiguration): Tasks.ICommandConfiguration | undefined { return _fillProperties(target, source, properties); } - export function fillGlobals(target: Tasks.CommandConfiguration, source: Tasks.CommandConfiguration | undefined, taskName: string | undefined): Tasks.CommandConfiguration { + export function fillGlobals(target: Tasks.ICommandConfiguration, source: Tasks.ICommandConfiguration | undefined, taskName: string | undefined): Tasks.ICommandConfiguration { if ((source === undefined) || isEmpty(source)) { return target; } @@ -1106,7 +1106,7 @@ namespace CommandConfiguration { return target; } - export function fillDefaults(value: Tasks.CommandConfiguration | undefined, context: ParseContext): void { + export function fillDefaults(value: Tasks.ICommandConfiguration | undefined, context: IParseContext): void { if (!value || Object.isFrozen(value)) { return; } @@ -1125,20 +1125,20 @@ namespace CommandConfiguration { } } - export function freeze(value: Tasks.CommandConfiguration): Readonly | undefined { + export function freeze(value: Tasks.ICommandConfiguration): Readonly | undefined { return _freeze(value, properties); } } export namespace ProblemMatcherConverter { - export function namedFrom(this: void, declares: ProblemMatcherConfig.NamedProblemMatcher[] | undefined, context: ParseContext): IStringDictionary { - let result: IStringDictionary = Object.create(null); + export function namedFrom(this: void, declares: ProblemMatcherConfig.INamedProblemMatcher[] | undefined, context: IParseContext): IStringDictionary { + let result: IStringDictionary = Object.create(null); if (!Types.isArray(declares)) { return result; } - (declares).forEach((value) => { + (declares).forEach((value) => { let namedProblemMatcher = (new ProblemMatcherParser(context.problemReporter)).parse(value); if (isNamedProblemMatcher(namedProblemMatcher)) { result[namedProblemMatcher.name] = namedProblemMatcher; @@ -1149,7 +1149,7 @@ export namespace ProblemMatcherConverter { return result; } - export function fromWithOsConfig(this: void, external: ConfigurationProperties & { [key: string]: any }, context: ParseContext): TaskConfigurationValueWithErrors { + export function fromWithOsConfig(this: void, external: IConfigurationProperties & { [key: string]: any }, context: IParseContext): TaskConfigurationValueWithErrors { let result: TaskConfigurationValueWithErrors = {}; if (external.windows && external.windows.problemMatcher && context.platform === Platform.Windows) { result = from(external.windows.problemMatcher, context); @@ -1163,7 +1163,7 @@ export namespace ProblemMatcherConverter { return result; } - export function from(this: void, config: ProblemMatcherConfig.ProblemMatcherType | undefined, context: ParseContext): TaskConfigurationValueWithErrors { + export function from(this: void, config: ProblemMatcherConfig.ProblemMatcherType | undefined, context: IParseContext): TaskConfigurationValueWithErrors { let result: ProblemMatcher[] = []; if (config === undefined) { return { value: result }; @@ -1207,7 +1207,7 @@ export namespace ProblemMatcherConverter { } } - function resolveProblemMatcher(this: void, value: string | ProblemMatcherConfig.ProblemMatcher, context: ParseContext): TaskConfigurationValueWithErrors { + function resolveProblemMatcher(this: void, value: string | ProblemMatcherConfig.ProblemMatcher, context: IParseContext): TaskConfigurationValueWithErrors { if (Types.isString(value)) { let variableName = value; if (variableName.length > 1 && variableName[0] === '$') { @@ -1216,7 +1216,7 @@ export namespace ProblemMatcherConverter { if (global) { return { value: Objects.deepClone(global) }; } - let localProblemMatcher: ProblemMatcher & Partial = context.namedProblemMatchers[variableName]; + let localProblemMatcher: ProblemMatcher & Partial = context.namedProblemMatchers[variableName]; if (localProblemMatcher) { localProblemMatcher = Objects.deepClone(localProblemMatcher); // remove the name @@ -1238,7 +1238,7 @@ const partialSource: Partial = { }; export namespace GroupKind { - export function from(this: void, external: string | GroupKind | undefined): Tasks.TaskGroup | undefined { + export function from(this: void, external: string | IGroupKind | undefined): Tasks.TaskGroup | undefined { if (external === undefined) { return undefined; } else if (Types.isString(external) && Tasks.TaskGroup.is(external)) { @@ -1252,7 +1252,7 @@ export namespace GroupKind { return undefined; } - export function to(group: Tasks.TaskGroup | string): GroupKind | string { + export function to(group: Tasks.TaskGroup | string): IGroupKind | string { if (Types.isString(group)) { return group; } else if (!group.isDefault) { @@ -1266,7 +1266,7 @@ export namespace GroupKind { } namespace TaskDependency { - function uriFromSource(context: ParseContext, source: TaskConfigSource): URI | string { + function uriFromSource(context: IParseContext, source: TaskConfigSource): URI | string { switch (source) { case TaskConfigSource.User: return Tasks.USER_TASKS_GROUP_KEY; case TaskConfigSource.TasksJson: return context.workspaceFolder.uri; @@ -1274,13 +1274,13 @@ namespace TaskDependency { } } - export function from(this: void, external: string | TaskIdentifier, context: ParseContext, source: TaskConfigSource): Tasks.TaskDependency | undefined { + export function from(this: void, external: string | ITaskIdentifier, context: IParseContext, source: TaskConfigSource): Tasks.ITaskDependency | undefined { if (Types.isString(external)) { return { uri: uriFromSource(context, source), task: external }; - } else if (TaskIdentifier.is(external)) { + } else if (ITaskIdentifier.is(external)) { return { uri: uriFromSource(context, source), - task: Tasks.TaskDefinition.createTaskIdentifier(external as Tasks.TaskIdentifier, context.problemReporter) + task: Tasks.TaskDefinition.createTaskIdentifier(external as Tasks.ITaskIdentifier, context.problemReporter) }; } else { return undefined; @@ -1302,7 +1302,7 @@ namespace DependsOrder { namespace ConfigurationProperties { - const properties: MetaData[] = [ + const properties: IMetaData[] = [ { property: 'name' }, { property: 'identifier' }, { property: 'group' }, { property: 'isBackground' }, { property: 'promptOnClose' }, { property: 'dependsOn' }, @@ -1310,12 +1310,12 @@ namespace ConfigurationProperties { { property: 'options' } ]; - export function from(this: void, external: ConfigurationProperties & { [key: string]: any }, context: ParseContext, - includeCommandOptions: boolean, source: TaskConfigSource, properties?: IJSONSchemaMap): TaskConfigurationValueWithErrors { + export function from(this: void, external: IConfigurationProperties & { [key: string]: any }, context: IParseContext, + includeCommandOptions: boolean, source: TaskConfigSource, properties?: IJSONSchemaMap): TaskConfigurationValueWithErrors { if (!external) { return {}; } - let result: Tasks.ConfigurationProperties & { [key: string]: any } = {}; + let result: Tasks.IConfigurationProperties & { [key: string]: any } = {}; if (properties) { for (const propertyName of Object.keys(properties)) { @@ -1343,7 +1343,7 @@ namespace ConfigurationProperties { result.group = GroupKind.from(external.group); if (external.dependsOn !== undefined) { if (Types.isArray(external.dependsOn)) { - result.dependsOn = external.dependsOn.reduce((dependencies: Tasks.TaskDependency[], item): Tasks.TaskDependency[] => { + result.dependsOn = external.dependsOn.reduce((dependencies: Tasks.ITaskDependency[], item): Tasks.ITaskDependency[] => { const dependency = TaskDependency.from(item, context, source); if (dependency) { dependencies.push(dependency); @@ -1356,7 +1356,7 @@ namespace ConfigurationProperties { } } result.dependsOrder = DependsOrder.from(external.dependsOrder); - if (includeCommandOptions && (external.presentation !== undefined || (external as LegacyCommandProperties).terminal !== undefined)) { + if (includeCommandOptions && (external.presentation !== undefined || (external as ILegacyCommandProperties).terminal !== undefined)) { result.presentation = CommandConfiguration.PresentationOptions.from(external, context); } if (includeCommandOptions && (external.options !== undefined)) { @@ -1372,7 +1372,7 @@ namespace ConfigurationProperties { return isEmpty(result) ? {} : { value: result, errors: configProblemMatcher.errors }; } - export function isEmpty(this: void, value: Tasks.ConfigurationProperties): boolean { + export function isEmpty(this: void, value: Tasks.IConfigurationProperties): boolean { return _isEmpty(value, properties); } } @@ -1385,16 +1385,16 @@ namespace ConfiguringTask { const npm = 'vscode.npm.'; const typescript = 'vscode.typescript.'; - interface CustomizeShape { + interface ICustomizeShape { customize: string; } - export function from(this: void, external: ConfiguringTask, context: ParseContext, index: number, source: TaskConfigSource, registry?: Partial): Tasks.ConfiguringTask | undefined { + export function from(this: void, external: IConfiguringTask, context: IParseContext, index: number, source: TaskConfigSource, registry?: Partial): Tasks.ConfiguringTask | undefined { if (!external) { return undefined; } let type = external.type; - let customize = (external as CustomizeShape).customize; + let customize = (external as ICustomizeShape).customize; if (!type && !customize) { context.problemReporter.error(nls.localize('ConfigurationParser.noTaskType', 'Error: tasks configuration must have a type property. The configuration will be ignored.\n{0}\n', JSON.stringify(external, null, 4))); return undefined; @@ -1405,7 +1405,7 @@ namespace ConfiguringTask { context.problemReporter.error(message); return undefined; } - let identifier: Tasks.TaskIdentifier | undefined; + let identifier: Tasks.ITaskIdentifier | undefined; if (Types.isString(customize)) { if (customize.indexOf(grunt) === 0) { identifier = { type: 'grunt', task: customize.substring(grunt.length) }; @@ -1420,7 +1420,7 @@ namespace ConfiguringTask { } } else { if (Types.isString(external.type)) { - identifier = external as Tasks.TaskIdentifier; + identifier = external as Tasks.ITaskIdentifier; } } if (identifier === undefined) { @@ -1438,7 +1438,7 @@ namespace ConfiguringTask { )); return undefined; } - let configElement: Tasks.TaskSourceConfigElement = { + let configElement: Tasks.ITaskSourceConfigElement = { workspaceFolder: context.workspaceFolder, file: '.vscode/tasks.json', index, @@ -1447,7 +1447,7 @@ namespace ConfiguringTask { let taskSource: Tasks.FileBasedTaskSource; switch (source) { case TaskConfigSource.User: { - taskSource = Object.assign({} as Tasks.UserTaskSource, partialSource, { kind: Tasks.TaskSourceKind.User, config: configElement }); + taskSource = Object.assign({} as Tasks.IUserTaskSource, partialSource, { kind: Tasks.TaskSourceKind.User, config: configElement }); break; } case TaskConfigSource.WorkspaceFile: { @@ -1455,7 +1455,7 @@ namespace ConfiguringTask { break; } default: { - taskSource = Object.assign({} as Tasks.WorkspaceTaskSource, partialSource, { kind: Tasks.TaskSourceKind.Workspace, config: configElement }); + taskSource = Object.assign({} as Tasks.IWorkspaceTaskSource, partialSource, { kind: Tasks.TaskSourceKind.Workspace, config: configElement }); break; } } @@ -1496,7 +1496,7 @@ namespace ConfiguringTask { } namespace CustomTask { - export function from(this: void, external: CustomTask, context: ParseContext, index: number, source: TaskConfigSource): Tasks.CustomTask | undefined { + export function from(this: void, external: ICustomTask, context: IParseContext, index: number, source: TaskConfigSource): Tasks.CustomTask | undefined { if (!external) { return undefined; } @@ -1520,7 +1520,7 @@ namespace CustomTask { let taskSource: Tasks.FileBasedTaskSource; switch (source) { case TaskConfigSource.User: { - taskSource = Object.assign({} as Tasks.UserTaskSource, partialSource, { kind: Tasks.TaskSourceKind.User, config: { index, element: external, file: '.vscode/tasks.json', workspaceFolder: context.workspaceFolder } }); + taskSource = Object.assign({} as Tasks.IUserTaskSource, partialSource, { kind: Tasks.TaskSourceKind.User, config: { index, element: external, file: '.vscode/tasks.json', workspaceFolder: context.workspaceFolder } }); break; } case TaskConfigSource.WorkspaceFile: { @@ -1528,7 +1528,7 @@ namespace CustomTask { break; } default: { - taskSource = Object.assign({} as Tasks.WorkspaceTaskSource, partialSource, { kind: Tasks.TaskSourceKind.Workspace, config: { index, element: external, file: '.vscode/tasks.json', workspaceFolder: context.workspaceFolder } }); + taskSource = Object.assign({} as Tasks.IWorkspaceTaskSource, partialSource, { kind: Tasks.TaskSourceKind.Workspace, config: { index, element: external, file: '.vscode/tasks.json', workspaceFolder: context.workspaceFolder } }); break; } } @@ -1553,7 +1553,7 @@ namespace CustomTask { } let supportLegacy: boolean = true; //context.schemaVersion === Tasks.JsonSchemaVersion.V2_0_0; if (supportLegacy) { - let legacy: LegacyTaskProperties = external as LegacyTaskProperties; + let legacy: ILegacyTaskProperties = external as ILegacyTaskProperties; if (result.configurationProperties.isBackground === undefined && legacy.isWatching !== undefined) { result.configurationProperties.isBackground = !!legacy.isWatching; } @@ -1565,7 +1565,7 @@ namespace CustomTask { } } } - let command: Tasks.CommandConfiguration = CommandConfiguration.from(external, context)!; + let command: Tasks.ICommandConfiguration = CommandConfiguration.from(external, context)!; if (command) { result.command = command; } @@ -1577,7 +1577,7 @@ namespace CustomTask { return result; } - export function fillGlobals(task: Tasks.CustomTask, globals: Globals): void { + export function fillGlobals(task: Tasks.CustomTask, globals: IGlobals): void { // We only merge a command from a global definition if there is no dependsOn // or there is a dependsOn and a defined command. if (CommandConfiguration.hasCommand(task.command) || task.configurationProperties.dependsOn === undefined) { @@ -1593,7 +1593,7 @@ namespace CustomTask { } } - export function fillDefaults(task: Tasks.CustomTask, context: ParseContext): void { + export function fillDefaults(task: Tasks.CustomTask, context: IParseContext): void { CommandConfiguration.fillDefaults(task.command, context); if (task.configurationProperties.promptOnClose === undefined) { task.configurationProperties.promptOnClose = task.configurationProperties.isBackground !== undefined ? !task.configurationProperties.isBackground : true; @@ -1621,7 +1621,7 @@ namespace CustomTask { } ); result.addTaskLoadMessages(configuredProps.taskLoadMessages); - let resultConfigProps: Tasks.ConfigurationProperties = result.configurationProperties; + let resultConfigProps: Tasks.IConfigurationProperties = result.configurationProperties; assignProperty(resultConfigProps, configuredProps.configurationProperties, 'group'); assignProperty(resultConfigProps, configuredProps.configurationProperties, 'isBackground'); @@ -1634,7 +1634,7 @@ namespace CustomTask { result.command.options = CommandOptions.assignProperties(result.command.options, configuredProps.configurationProperties.options); result.runOptions = RunOptions.assignProperties(result.runOptions, configuredProps.runOptions); - let contributedConfigProps: Tasks.ConfigurationProperties = contributedTask.configurationProperties; + let contributedConfigProps: Tasks.IConfigurationProperties = contributedTask.configurationProperties; fillProperty(resultConfigProps, contributedConfigProps, 'group'); fillProperty(resultConfigProps, contributedConfigProps, 'isBackground'); fillProperty(resultConfigProps, contributedConfigProps, 'dependsOn'); @@ -1654,14 +1654,14 @@ namespace CustomTask { } } -export interface TaskParseResult { +export interface ITaskParseResult { custom: Tasks.CustomTask[]; configured: Tasks.ConfiguringTask[]; } export namespace TaskParser { - function isCustomTask(value: CustomTask | ConfiguringTask): value is CustomTask { + function isCustomTask(value: ICustomTask | IConfiguringTask): value is ICustomTask { let type = value.type; let customize = (value as any).customize; return customize === undefined && (type === undefined || type === null || type === Tasks.CUSTOMIZED_TASK_TYPE || type === 'shell' || type === 'process'); @@ -1672,8 +1672,8 @@ export namespace TaskParser { process: ProcessExecutionSupportedContext }; - export function from(this: void, externals: Array | undefined, globals: Globals, context: ParseContext, source: TaskConfigSource, registry?: Partial): TaskParseResult { - let result: TaskParseResult = { custom: [], configured: [] }; + export function from(this: void, externals: Array | undefined, globals: IGlobals, context: IParseContext, source: TaskConfigSource, registry?: Partial): ITaskParseResult { + let result: ITaskParseResult = { custom: [], configured: [] }; if (!externals) { return result; } @@ -1795,8 +1795,8 @@ export namespace TaskParser { } } -export interface Globals { - command?: Tasks.CommandConfiguration; +export interface IGlobals { + command?: Tasks.ICommandConfiguration; problemMatcher?: ProblemMatcher[]; promptOnClose?: boolean; suppressTaskName?: boolean; @@ -1804,9 +1804,9 @@ export interface Globals { namespace Globals { - export function from(config: ExternalTaskRunnerConfiguration, context: ParseContext): Globals { + export function from(config: IExternalTaskRunnerConfiguration, context: IParseContext): IGlobals { let result = fromBase(config, context); - let osGlobals: Globals | undefined = undefined; + let osGlobals: IGlobals | undefined = undefined; if (config.windows && context.platform === Platform.Windows) { osGlobals = fromBase(config.windows, context); } else if (config.osx && context.platform === Platform.Mac) { @@ -1826,8 +1826,8 @@ namespace Globals { return result; } - export function fromBase(this: void, config: BaseTaskRunnerConfiguration, context: ParseContext): Globals { - let result: Globals = {}; + export function fromBase(this: void, config: IBaseTaskRunnerConfiguration, context: IParseContext): IGlobals { + let result: IGlobals = {}; if (config.suppressTaskName !== undefined) { result.suppressTaskName = !!config.suppressTaskName; } @@ -1840,11 +1840,11 @@ namespace Globals { return result; } - export function isEmpty(value: Globals): boolean { + export function isEmpty(value: IGlobals): boolean { return !value || value.command === undefined && value.promptOnClose === undefined && value.suppressTaskName === undefined; } - export function assignProperties(target: Globals, source: Globals): Globals { + export function assignProperties(target: IGlobals, source: IGlobals): IGlobals { if (isEmpty(source)) { return target; } @@ -1856,7 +1856,7 @@ namespace Globals { return target; } - export function fillDefaults(value: Globals, context: ParseContext): void { + export function fillDefaults(value: IGlobals, context: IParseContext): void { if (!value) { return; } @@ -1869,7 +1869,7 @@ namespace Globals { } } - export function freeze(value: Globals): void { + export function freeze(value: IGlobals): void { Object.freeze(value); if (value.command) { CommandConfiguration.freeze(value.command); @@ -1879,7 +1879,7 @@ namespace Globals { export namespace ExecutionEngine { - export function from(config: ExternalTaskRunnerConfiguration): Tasks.ExecutionEngine { + export function from(config: IExternalTaskRunnerConfiguration): Tasks.ExecutionEngine { let runner = config.runner || config._runner; let result: Tasks.ExecutionEngine | undefined; if (runner) { @@ -1907,7 +1907,7 @@ export namespace JsonSchemaVersion { const _default: Tasks.JsonSchemaVersion = Tasks.JsonSchemaVersion.V2_0_0; - export function from(config: ExternalTaskRunnerConfiguration): Tasks.JsonSchemaVersion { + export function from(config: IExternalTaskRunnerConfiguration): Tasks.JsonSchemaVersion { let version = config.version; if (!version) { return _default; @@ -1923,7 +1923,7 @@ export namespace JsonSchemaVersion { } } -export interface ParseResult { +export interface IParseResult { validationStatus: ValidationStatus; custom: Tasks.CustomTask[]; configured: Tasks.ConfiguringTask[]; @@ -2016,10 +2016,10 @@ class ConfigurationParser { this.uuidMap = uuidMap; } - public run(fileConfig: ExternalTaskRunnerConfiguration, source: TaskConfigSource, contextKeyService: IContextKeyService): ParseResult { + public run(fileConfig: IExternalTaskRunnerConfiguration, source: TaskConfigSource, contextKeyService: IContextKeyService): IParseResult { let engine = ExecutionEngine.from(fileConfig); let schemaVersion = JsonSchemaVersion.from(fileConfig); - let context: ParseContext = { + let context: IParseContext = { workspaceFolder: this.workspaceFolder, workspace: this.workspace, problemReporter: this.problemReporter, @@ -2040,14 +2040,14 @@ class ConfigurationParser { }; } - private createTaskRunnerConfiguration(fileConfig: ExternalTaskRunnerConfiguration, context: ParseContext, source: TaskConfigSource): TaskParseResult { + private createTaskRunnerConfiguration(fileConfig: IExternalTaskRunnerConfiguration, context: IParseContext, source: TaskConfigSource): ITaskParseResult { let globals = Globals.from(fileConfig, context); if (this.problemReporter.status.isFatal()) { return { custom: [], configured: [] }; } context.namedProblemMatchers = ProblemMatcherConverter.namedFrom(fileConfig.declares, context); let globalTasks: Tasks.CustomTask[] | undefined = undefined; - let externalGlobalTasks: Array | undefined = undefined; + let externalGlobalTasks: Array | undefined = undefined; if (fileConfig.windows && context.platform === Platform.Windows) { globalTasks = TaskParser.from(fileConfig.windows.tasks, globals, context, source).custom; externalGlobalTasks = fileConfig.windows.tasks; @@ -2070,7 +2070,7 @@ class ConfigurationParser { ); } - let result: TaskParseResult = { custom: [], configured: [] }; + let result: ITaskParseResult = { custom: [], configured: [] }; if (fileConfig.tasks) { result = TaskParser.from(fileConfig.tasks, globals, context, source); } @@ -2084,7 +2084,7 @@ class ConfigurationParser { let name = Tasks.CommandString.value(globals.command.name); let task: Tasks.CustomTask = new Tasks.CustomTask( context.uuidMap.getUUID(name), - Object.assign({} as Tasks.WorkspaceTaskSource, source, { config: { index: -1, element: fileConfig, workspaceFolder: context.workspaceFolder } }), + Object.assign({} as Tasks.IWorkspaceTaskSource, source, { config: { index: -1, element: fileConfig, workspaceFolder: context.workspaceFolder } }), name, Tasks.CUSTOMIZED_TASK_TYPE, { @@ -2121,7 +2121,7 @@ class ConfigurationParser { let uuidMaps: Map> = new Map(); let recentUuidMaps: Map> = new Map(); -export function parse(workspaceFolder: IWorkspaceFolder, workspace: IWorkspace | undefined, platform: Platform, configuration: ExternalTaskRunnerConfiguration, logger: IProblemReporter, source: TaskConfigSource, contextKeyService: IContextKeyService, isRecents: boolean = false): ParseResult { +export function parse(workspaceFolder: IWorkspaceFolder, workspace: IWorkspace | undefined, platform: Platform, configuration: IExternalTaskRunnerConfiguration, logger: IProblemReporter, source: TaskConfigSource, contextKeyService: IContextKeyService, isRecents: boolean = false): IParseResult { let recentOrOtherMaps = isRecents ? recentUuidMaps : uuidMaps; let selectedUuidMaps = recentOrOtherMaps.get(source); if (!selectedUuidMaps) { diff --git a/src/vs/workbench/contrib/tasks/common/taskDefinitionRegistry.ts b/src/vs/workbench/contrib/tasks/common/taskDefinitionRegistry.ts index b3fe1e79f8e..4ec81b1d469 100644 --- a/src/vs/workbench/contrib/tasks/common/taskDefinitionRegistry.ts +++ b/src/vs/workbench/contrib/tasks/common/taskDefinitionRegistry.ts @@ -47,14 +47,14 @@ const taskDefinitionSchema: IJSONSchema = { }; namespace Configuration { - export interface TaskDefinition { + export interface ITaskDefinition { type?: string; required?: string[]; properties?: IJSONSchemaMap; 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) { return undefined; } @@ -81,7 +81,7 @@ namespace Configuration { } -const taskDefinitionsExtPoint = ExtensionsRegistry.registerExtensionPoint({ +const taskDefinitionsExtPoint = ExtensionsRegistry.registerExtensionPoint({ extensionPoint: 'taskDefinitions', jsonSchema: { description: nls.localize('TaskDefinitionExtPoint', 'Contributes task kinds'), @@ -93,15 +93,15 @@ const taskDefinitionsExtPoint = ExtensionsRegistry.registerExtensionPoint; - get(key: string): Tasks.TaskDefinition; - all(): Tasks.TaskDefinition[]; + get(key: string): Tasks.ITaskDefinition; + all(): Tasks.ITaskDefinition[]; getJsonSchema(): IJSONSchema; onDefinitionsChanged: Event; } export class TaskDefinitionRegistryImpl implements ITaskDefinitionRegistry { - private taskTypes: IStringDictionary; + private taskTypes: IStringDictionary; private readyPromise: Promise; private _schema: IJSONSchema | undefined; private _onDefinitionsChanged: Emitter = new Emitter(); @@ -144,11 +144,11 @@ export class TaskDefinitionRegistryImpl implements ITaskDefinitionRegistry { return this.readyPromise; } - public get(key: string): Tasks.TaskDefinition { + public get(key: string): Tasks.ITaskDefinition { return this.taskTypes[key]; } - public all(): Tasks.TaskDefinition[] { + public all(): Tasks.ITaskDefinition[] { return Object.keys(this.taskTypes).map(key => this.taskTypes[key]); } diff --git a/src/vs/workbench/contrib/tasks/common/taskService.ts b/src/vs/workbench/contrib/tasks/common/taskService.ts index b75cd445666..dfe37cf6070 100644 --- a/src/vs/workbench/contrib/tasks/common/taskService.ts +++ b/src/vs/workbench/contrib/tasks/common/taskService.ts @@ -10,12 +10,12 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation' import { IDisposable } from 'vs/base/common/lifecycle'; 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 { ITaskSummary, TaskTerminateResponse, TaskSystemInfo } from 'vs/workbench/contrib/tasks/common/taskSystem'; +import { Task, ContributedTask, CustomTask, ITaskSet, TaskSorter, ITaskEvent, ITaskIdentifier, ConfiguringTask, TaskRunSource } from 'vs/workbench/contrib/tasks/common/tasks'; +import { ITaskSummary, ITaskTerminateResponse, ITaskSystemInfo } from 'vs/workbench/contrib/tasks/common/taskSystem'; import { IStringDictionary } from 'vs/base/common/collections'; import { RawContextKey } from 'vs/platform/contextkey/common/contextkey'; -export { ITaskSummary, Task, TaskTerminateResponse }; +export { ITaskSummary, Task, ITaskTerminateResponse as TaskTerminateResponse }; export const CustomExecutionSupportedContext = new RawContextKey('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('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('proc export const ITaskService = createDecorator('taskService'); export interface ITaskProvider { - provideTasks(validTypes: IStringDictionary): Promise; + provideTasks(validTypes: IStringDictionary): Promise; resolveTask(task: ConfiguringTask): Promise; } -export interface ProblemMatcherRunOptions { +export interface IProblemMatcherRunOptions { attachProblemMatcher?: boolean; } -export interface CustomizationProperties { +export interface ICustomizationProperties { group?: string | { kind?: string; isDefault?: boolean }; problemMatcher?: string | string[]; isBackground?: boolean; } -export interface TaskFilter { +export interface ITaskFilter { version?: string; type?: string; } -interface WorkspaceTaskResult { - set: TaskSet | undefined; +interface IWorkspaceTaskResult { + set: ITaskSet | undefined; configurations: { byIdentifier: IStringDictionary; } | undefined; hasErrors: boolean; } -export interface WorkspaceFolderTaskResult extends WorkspaceTaskResult { +export interface IWorkspaceFolderTaskResult extends IWorkspaceTaskResult { workspaceFolder: IWorkspaceFolder; } export interface ITaskService { readonly _serviceBrand: undefined; - onDidStateChange: Event; + onDidStateChange: Event; supportsMultipleTaskExecutions: boolean; configureAction(): Action; - run(task: Task | undefined, options?: ProblemMatcherRunOptions): Promise; + run(task: Task | undefined, options?: IProblemMatcherRunOptions): Promise; inTerminal(): boolean; getActiveTasks(): Promise; getBusyTasks(): Promise; - terminate(task: Task): Promise; - tasks(filter?: TaskFilter): Promise; + terminate(task: Task): Promise; + tasks(filter?: ITaskFilter): Promise; taskTypes(): string[]; - getWorkspaceTasks(runSource?: TaskRunSource): Promise>; + getWorkspaceTasks(runSource?: TaskRunSource): Promise>; readRecentTasks(): Promise<(Task | ConfiguringTask)[]>; removeRecentlyUsedTask(taskRecentlyUsedKey: string): void; /** * @param alias The task's name, label or defined identifier. */ - getTask(workspaceFolder: IWorkspace | IWorkspaceFolder | string, alias: string | TaskIdentifier, compareId?: boolean): Promise; + getTask(workspaceFolder: IWorkspace | IWorkspaceFolder | string, alias: string | ITaskIdentifier, compareId?: boolean): Promise; tryResolveTask(configuringTask: ConfiguringTask): Promise; createSorter(): TaskSorter; @@ -84,7 +84,7 @@ export interface ITaskService { registerTaskProvider(taskProvider: ITaskProvider, type: string): IDisposable; - registerTaskSystem(scheme: string, taskSystemInfo: TaskSystemInfo): void; + registerTaskSystem(scheme: string, taskSystemInfo: ITaskSystemInfo): void; onDidChangeTaskSystemInfo: Event; readonly hasTaskSystemInfo: boolean; registerSupportedExecutions(custom?: boolean, shell?: boolean, process?: boolean): void; diff --git a/src/vs/workbench/contrib/tasks/common/taskSystem.ts b/src/vs/workbench/contrib/tasks/common/taskSystem.ts index 12bc7501984..e36542f6622 100644 --- a/src/vs/workbench/contrib/tasks/common/taskSystem.ts +++ b/src/vs/workbench/contrib/tasks/common/taskSystem.ts @@ -9,7 +9,7 @@ import { TerminateResponse } from 'vs/base/common/processes'; import { Event } from 'vs/base/common/event'; import { Platform } from 'vs/base/common/platform'; 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'; export const enum TaskErrors { @@ -69,11 +69,11 @@ export interface ITaskResolver { resolve(uri: URI | string, identifier: string | KeyedTaskIdentifier | undefined): Promise; } -export interface TaskTerminateResponse extends TerminateResponse { +export interface ITaskTerminateResponse extends TerminateResponse { task: Task | undefined; } -export interface ResolveSet { +export interface IResolveSet { process?: { name: string; cwd?: string; @@ -82,25 +82,25 @@ export interface ResolveSet { variables: Set; } -export interface ResolvedVariables { +export interface IResolvedVariables { process?: string; variables: Map; } -export interface TaskSystemInfo { +export interface ITaskSystemInfo { platform: Platform; context: any; uriProvider: (this: void, path: string) => URI; - resolveVariables(workspaceFolder: IWorkspaceFolder, toResolve: ResolveSet, target: ConfigurationTarget): Promise; + resolveVariables(workspaceFolder: IWorkspaceFolder, toResolve: IResolveSet, target: ConfigurationTarget): Promise; findExecutable(command: string, cwd?: string, paths?: string[]): Promise; } -export interface TaskSystemInfoResolver { - (workspaceFolder: IWorkspaceFolder | undefined): TaskSystemInfo | undefined; +export interface ITaskSystemInfoResolver { + (workspaceFolder: IWorkspaceFolder | undefined): ITaskSystemInfo | undefined; } export interface ITaskSystem { - onDidStateChange: Event; + onDidStateChange: Event; run(task: Task, resolver: ITaskResolver): ITaskExecuteResult; rerun(): ITaskExecuteResult | undefined; isActive(): Promise; @@ -109,8 +109,8 @@ export interface ITaskSystem { getLastInstance(task: Task): Task | undefined; getBusyTasks(): Task[]; canAutoTerminate(): boolean; - terminate(task: Task): Promise; - terminateAll(): Promise; + terminate(task: Task): Promise; + terminateAll(): Promise; revealTask(task: Task): boolean; customExecutionComplete(task: Task, result: number): Promise; isTaskVisible(task: Task): boolean; diff --git a/src/vs/workbench/contrib/tasks/common/taskTemplates.ts b/src/vs/workbench/contrib/tasks/common/taskTemplates.ts index c367ede9ab7..a53c07420d7 100644 --- a/src/vs/workbench/contrib/tasks/common/taskTemplates.ts +++ b/src/vs/workbench/contrib/tasks/common/taskTemplates.ts @@ -7,13 +7,13 @@ import * as nls from 'vs/nls'; import { IQuickPickItem } from 'vs/platform/quickinput/common/quickInput'; -export interface TaskEntry extends IQuickPickItem { +export interface ITaskEntry extends IQuickPickItem { sort?: string; autoDetect: boolean; content: string; } -const dotnetBuild: TaskEntry = { +const dotnetBuild: ITaskEntry = { id: 'dotnetCore', label: '.NET Core', sort: 'NET Core', @@ -47,7 +47,7 @@ const dotnetBuild: TaskEntry = { ].join('\n') }; -const msbuild: TaskEntry = { +const msbuild: ITaskEntry = { id: 'msbuild', label: 'MSBuild', autoDetect: false, @@ -82,7 +82,7 @@ const msbuild: TaskEntry = { ].join('\n') }; -const command: TaskEntry = { +const command: ITaskEntry = { id: 'externalCommand', label: 'Others', autoDetect: false, @@ -103,7 +103,7 @@ const command: TaskEntry = { ].join('\n') }; -const maven: TaskEntry = { +const maven: ITaskEntry = { id: 'maven', label: 'maven', sort: 'MVN', @@ -132,8 +132,8 @@ const maven: TaskEntry = { ].join('\n') }; -let _templates: TaskEntry[] | null = null; -export function getTemplates(): TaskEntry[] { +let _templates: ITaskEntry[] | null = null; +export function getTemplates(): ITaskEntry[] { if (!_templates) { _templates = [dotnetBuild, msbuild, maven].sort((a, b) => { return (a.sort || a.label).localeCompare(b.sort || b.label); diff --git a/src/vs/workbench/contrib/tasks/common/tasks.ts b/src/vs/workbench/contrib/tasks/common/tasks.ts index e26ad2051e5..595d07dfa93 100644 --- a/src/vs/workbench/contrib/tasks/common/tasks.ts +++ b/src/vs/workbench/contrib/tasks/common/tasks.ts @@ -60,7 +60,7 @@ export namespace ShellQuoting { } } -export interface ShellQuotingOptions { +export interface IShellQuotingOptions { /** * The character used to do character escaping. */ @@ -80,7 +80,7 @@ export interface ShellQuotingOptions { weak?: string; } -export interface ShellConfiguration { +export interface IShellConfiguration { /** * The shell executable. */ @@ -94,7 +94,7 @@ export interface ShellConfiguration { /** * Which kind of quotes the shell supports. */ - quoting?: ShellQuotingOptions; + quoting?: IShellQuotingOptions; } export interface CommandOptions { @@ -102,7 +102,7 @@ export interface CommandOptions { /** * 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. @@ -223,7 +223,7 @@ export namespace PanelKind { } } -export interface PresentationOptions { +export interface IPresentationOptions { /** * Controls whether the task output is reveal in the user interface. * Defaults to `RevealKind.Always`. @@ -276,7 +276,7 @@ export interface 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 }; } @@ -310,12 +310,12 @@ export namespace RuntimeType { } } -export interface QuotedString { +export interface IQuotedString { value: string; quoting: ShellQuoting; } -export type CommandString = string | QuotedString; +export type CommandString = string | IQuotedString; export namespace CommandString { export function value(value: CommandString): string { @@ -327,7 +327,7 @@ export namespace CommandString { } } -export interface CommandConfiguration { +export interface ICommandConfiguration { /** * The task type @@ -363,7 +363,7 @@ export interface CommandConfiguration { /** * Describes how the task is presented in the UI. */ - presentation?: PresentationOptions; + presentation?: IPresentationOptions; } export namespace TaskGroup { @@ -420,7 +420,7 @@ export namespace TaskSourceKind { } } -export interface TaskSourceConfigElement { +export interface ITaskSourceConfigElement { workspaceFolder?: IWorkspaceFolder; workspace?: IWorkspace; file: string; @@ -428,57 +428,57 @@ export interface TaskSourceConfigElement { element: any; } -interface BaseTaskSource { +interface IBaseTaskSource { readonly kind: string; readonly label: string; } -export interface WorkspaceTaskSource extends BaseTaskSource { +export interface IWorkspaceTaskSource extends IBaseTaskSource { readonly kind: 'workspace'; - readonly config: TaskSourceConfigElement; + readonly config: ITaskSourceConfigElement; readonly customizes?: KeyedTaskIdentifier; } -export interface ExtensionTaskSource extends BaseTaskSource { +export interface IExtensionTaskSource extends IBaseTaskSource { readonly kind: 'extension'; readonly extension?: string; readonly scope: TaskScope; readonly workspaceFolder: IWorkspaceFolder | undefined; } -export interface ExtensionTaskSourceTransfer { +export interface IExtensionTaskSourceTransfer { __workspaceFolder: UriComponents; __definition: { type: string;[name: string]: any }; } -export interface InMemoryTaskSource extends BaseTaskSource { +export interface IInMemoryTaskSource extends IBaseTaskSource { readonly kind: 'inMemory'; } -export interface UserTaskSource extends BaseTaskSource { +export interface IUserTaskSource extends IBaseTaskSource { readonly kind: 'user'; - readonly config: TaskSourceConfigElement; + readonly config: ITaskSourceConfigElement; readonly customizes?: KeyedTaskIdentifier; } -export interface WorkspaceFileTaskSource extends BaseTaskSource { +export interface WorkspaceFileTaskSource extends IBaseTaskSource { readonly kind: 'workspaceFile'; - readonly config: TaskSourceConfigElement; + readonly config: ITaskSourceConfigElement; readonly customizes?: KeyedTaskIdentifier; } -export type TaskSource = WorkspaceTaskSource | ExtensionTaskSource | InMemoryTaskSource | UserTaskSource | WorkspaceFileTaskSource; -export type FileBasedTaskSource = WorkspaceTaskSource | UserTaskSource | WorkspaceFileTaskSource; -export interface TaskIdentifier { +export type TaskSource = IWorkspaceTaskSource | IExtensionTaskSource | IInMemoryTaskSource | IUserTaskSource | WorkspaceFileTaskSource; +export type FileBasedTaskSource = IWorkspaceTaskSource | IUserTaskSource | WorkspaceFileTaskSource; +export interface ITaskIdentifier { type: string; [name: string]: any; } -export interface KeyedTaskIdentifier extends TaskIdentifier { +export interface KeyedTaskIdentifier extends ITaskIdentifier { _key: string; } -export interface TaskDependency { +export interface ITaskDependency { uri: URI | string; task: string | KeyedTaskIdentifier | undefined; } @@ -488,7 +488,7 @@ export const enum DependsOrder { sequence = 'sequence' } -export interface ConfigurationProperties { +export interface IConfigurationProperties { /** * The task's name @@ -508,7 +508,7 @@ export interface ConfigurationProperties { /** * The presentation options */ - presentation?: PresentationOptions; + presentation?: IPresentationOptions; /** * The command options; @@ -528,7 +528,7 @@ export interface ConfigurationProperties { /** * The other tasks this task depends on. */ - dependsOn?: TaskDependency[]; + dependsOn?: ITaskDependency[]; /** * The order the dependsOn tasks should be executed in. @@ -551,14 +551,14 @@ export enum RunOnOptions { folderOpen = 2 } -export interface RunOptions { +export interface IRunOptions { reevaluateOnRerun?: boolean; runOn?: RunOnOptions; instanceLimit?: number; } 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 { @@ -575,16 +575,16 @@ export abstract class CommonTask { type?: string; - runOptions: RunOptions; + runOptions: IRunOptions; - configurationProperties: ConfigurationProperties; + configurationProperties: IConfigurationProperties; - _source: BaseTaskSource; + _source: IBaseTaskSource; private _taskLoadMessages: string[] | undefined; - protected constructor(id: string, label: string | undefined, type: string | undefined, runOptions: RunOptions, - configurationProperties: ConfigurationProperties, source: BaseTaskSource) { + protected constructor(id: string, label: string | undefined, type: string | undefined, runOptions: IRunOptions, + configurationProperties: IConfigurationProperties, source: IBaseTaskSource) { this._id = id; if (label) { this._label = label; @@ -612,12 +612,12 @@ export abstract class CommonTask { protected abstract getFolderId(): string | undefined; public getCommonTaskId(): string { - interface RecentTaskKey { + interface IRecentTaskKey { folder: string | undefined; id: string; } - const key: RecentTaskKey = { folder: this.getFolderId(), id: this._id }; + const key: IRecentTaskKey = { folder: this.getFolderId(), id: this._id }; return JSON.stringify(key); } @@ -659,8 +659,8 @@ export abstract class CommonTask { } } - public getTaskExecution(): TaskExecution { - let result: TaskExecution = { + public getTaskExecution(): ITaskExecution { + let result: ITaskExecution = { id: this._id, task: this }; @@ -697,10 +697,10 @@ export class CustomTask extends CommonTask { /** * The command configuration */ - command: CommandConfiguration = {}; + command: ICommandConfiguration = {}; - public constructor(id: string, source: FileBasedTaskSource, label: string, type: string, command: CommandConfiguration | undefined, - hasDefinedMatchers: boolean, runOptions: RunOptions, configurationProperties: ConfigurationProperties) { + public constructor(id: string, source: FileBasedTaskSource, label: string, type: string, command: ICommandConfiguration | undefined, + hasDefinedMatchers: boolean, runOptions: IRunOptions, configurationProperties: IConfigurationProperties) { super(id, label, undefined, runOptions, configurationProperties, source); this._source = source; this.hasDefinedMatchers = hasDefinedMatchers; @@ -774,7 +774,7 @@ export class CustomTask extends CommonTask { } public override getRecentlyUsedKey(): string | undefined { - interface CustomKey { + interface ICustomKey { type: string; folder: string; id: string; @@ -787,7 +787,7 @@ export class CustomTask extends CommonTask { if (this._source.kind !== TaskSourceKind.Workspace) { 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); } @@ -822,7 +822,7 @@ export class ConfiguringTask extends CommonTask { configures: KeyedTaskIdentifier; 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); this._source = source; this.configures = configures; @@ -853,7 +853,7 @@ export class ConfiguringTask extends CommonTask { } public override getRecentlyUsedKey(): string | undefined { - interface CustomKey { + interface ICustomKey { type: string; folder: string; id: string; @@ -866,7 +866,7 @@ export class ConfiguringTask extends CommonTask { if (this._source.kind !== TaskSourceKind.Workspace) { 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); } } @@ -877,7 +877,7 @@ export class ContributedTask extends CommonTask { * Indicated the source of the task (e.g. tasks.json or extension) * Set in the super constructor */ - override _source!: ExtensionTaskSource; + override _source!: IExtensionTaskSource; instance: number | undefined; @@ -888,11 +888,11 @@ export class ContributedTask extends CommonTask { /** * The command configuration */ - command: CommandConfiguration; + command: ICommandConfiguration; - public constructor(id: string, source: ExtensionTaskSource, label: string, type: string | undefined, defines: KeyedTaskIdentifier, - command: CommandConfiguration, hasDefinedMatchers: boolean, runOptions: RunOptions, - configurationProperties: ConfigurationProperties) { + public constructor(id: string, source: IExtensionTaskSource, label: string, type: string | undefined, defines: KeyedTaskIdentifier, + command: ICommandConfiguration, hasDefinedMatchers: boolean, runOptions: IRunOptions, + configurationProperties: IConfigurationProperties) { super(id, label, type, runOptions, configurationProperties, source); this.defines = defines; this.hasDefinedMatchers = hasDefinedMatchers; @@ -926,14 +926,14 @@ export class ContributedTask extends CommonTask { } public override getRecentlyUsedKey(): string | undefined { - interface ContributedKey { + interface IContributedKey { type: string; scope: number; folder?: 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(); 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) */ - override _source: InMemoryTaskSource; + override _source: IInMemoryTaskSource; instance: number | undefined; override type!: 'inMemory'; - public constructor(id: string, source: InMemoryTaskSource, label: string, type: string, - runOptions: RunOptions, configurationProperties: ConfigurationProperties) { + public constructor(id: string, source: IInMemoryTaskSource, label: string, type: string, + runOptions: IRunOptions, configurationProperties: IConfigurationProperties) { super(id, label, type, runOptions, configurationProperties, source); this._source = source; } @@ -994,7 +994,7 @@ export class InMemoryTask extends CommonTask { export type Task = CustomTask | ContributedTask | InMemoryTask; -export interface TaskExecution { +export interface ITaskExecution { id: string; task: Task; } @@ -1013,12 +1013,12 @@ export const enum JsonSchemaVersion { V2_0_0 = 2 } -export interface TaskSet { +export interface ITaskSet { tasks: Task[]; extension?: IExtensionDescription; } -export interface TaskDefinition { +export interface ITaskDefinition { extensionId: string; taskType: string; required: string[]; @@ -1078,7 +1078,7 @@ export const enum TaskRunType { Background = 'background' } -export interface TaskEvent { +export interface ITaskEvent { kind: TaskEventKind; taskId?: string; taskName?: string; @@ -1099,13 +1099,13 @@ export const enum TaskRunSource { } export namespace TaskEvent { - export function create(kind: TaskEventKind.ProcessStarted | TaskEventKind.ProcessEnded, task: Task, processIdOrExitCode?: number): TaskEvent; - export function create(kind: TaskEventKind.Start, task: Task, terminalId?: number, resolvedVariables?: Map): TaskEvent; - 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.Changed): TaskEvent; - export function create(kind: TaskEventKind, task?: Task, processIdOrExitCodeOrTerminalId?: number, resolvedVariables?: Map): 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): ITaskEvent; + 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): ITaskEvent; + export function create(kind: TaskEventKind, task?: Task, processIdOrExitCodeOrTerminalId?: number, resolvedVariables?: Map): ITaskEvent { if (task) { - let result: TaskEvent = { + let result: ITaskEvent = { kind: kind, taskId: task._id, taskName: task.configurationProperties.name, @@ -1146,7 +1146,7 @@ export namespace KeyedTaskIdentifier { } return result; } - export function create(value: TaskIdentifier): KeyedTaskIdentifier { + export function create(value: ITaskIdentifier): KeyedTaskIdentifier { const resultKey = sortedStringify(value); let result = { _key: resultKey, type: value.taskType }; Object.assign(result, value); @@ -1155,7 +1155,7 @@ export namespace KeyedTaskIdentifier { } 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); if (definition === undefined) { // We have no task definition so we can't sanitize the literal. Take it as is diff --git a/src/vs/workbench/contrib/tasks/electron-sandbox/taskService.ts b/src/vs/workbench/contrib/tasks/electron-sandbox/taskService.ts index a17d4185861..52844d4b3ce 100644 --- a/src/vs/workbench/contrib/tasks/electron-sandbox/taskService.ts +++ b/src/vs/workbench/contrib/tasks/electron-sandbox/taskService.ts @@ -10,7 +10,7 @@ import { ITaskSystem } from 'vs/workbench/contrib/tasks/common/taskSystem'; import { ExecutionEngine } from 'vs/workbench/contrib/tasks/common/tasks'; import * as TaskConfig from '../common/taskConfiguration'; 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 { TerminalTaskSystem } from 'vs/workbench/contrib/tasks/browser/terminalTaskSystem'; 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 { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/browser/panecomposite'; -interface WorkspaceFolderConfigurationResult { +interface IWorkspaceFolderConfigurationResult { workspaceFolder: IWorkspaceFolder; - config: TaskConfig.ExternalTaskRunnerConfiguration | undefined; + config: TaskConfig.IExternalTaskRunnerConfiguration | undefined; hasErrors: boolean; } @@ -133,7 +133,7 @@ export class TaskService extends AbstractTaskService { return this._taskSystem; } - protected computeLegacyConfiguration(workspaceFolder: IWorkspaceFolder): Promise { + protected computeLegacyConfiguration(workspaceFolder: IWorkspaceFolder): Promise { let { config, hasParseErrors } = this.getConfiguration(workspaceFolder); if (hasParseErrors) { 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 engine = this.executionEngine; diff --git a/src/vs/workbench/contrib/tasks/test/browser/taskTerminalStatus.test.ts b/src/vs/workbench/contrib/tasks/test/browser/taskTerminalStatus.test.ts index 3b00f83eaf5..be60def9f43 100644 --- a/src/vs/workbench/contrib/tasks/test/browser/taskTerminalStatus.test.ts +++ b/src/vs/workbench/contrib/tasks/test/browser/taskTerminalStatus.test.ts @@ -9,17 +9,17 @@ import { TestConfigurationService } from 'vs/platform/configuration/test/common/ 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 { 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 { ITerminalInstance } from 'vs/workbench/contrib/terminal/browser/terminal'; import { ITerminalStatus, ITerminalStatusList, TerminalStatusList } from 'vs/workbench/contrib/terminal/browser/terminalStatusList'; class TestTaskService implements Partial { - private readonly _onDidStateChange: Emitter = new Emitter(); - public get onDidStateChange(): Event { + private readonly _onDidStateChange: Emitter = new Emitter(); + public get onDidStateChange(): Event { return this._onDidStateChange.event; } - public triggerStateChange(event: TaskEvent): void { + public triggerStateChange(event: ITaskEvent): void { this._onDidStateChange.fire(event); } } diff --git a/src/vs/workbench/contrib/tasks/test/common/problemMatcher.test.ts b/src/vs/workbench/contrib/tasks/test/common/problemMatcher.test.ts index 2de0e6c6100..3042641c34e 100644 --- a/src/vs/workbench/contrib/tasks/test/common/problemMatcher.test.ts +++ b/src/vs/workbench/contrib/tasks/test/common/problemMatcher.test.ts @@ -67,7 +67,7 @@ suite('ProblemPatternParser', () => { suite('single-pattern definitions', () => { test('parses a pattern defined by only a regexp', () => { - let problemPattern: matchers.Config.ProblemPattern = { + let problemPattern: matchers.Config.IProblemPattern = { regexp: 'test' }; let parsed = parser.parse(problemPattern); @@ -82,7 +82,7 @@ suite('ProblemPatternParser', () => { }); }); 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', kind: 'file' }; diff --git a/src/vs/workbench/contrib/tasks/test/common/taskConfiguration.test.ts b/src/vs/workbench/contrib/tasks/test/common/taskConfiguration.test.ts index bf496555a15..1831aeb25c2 100644 --- a/src/vs/workbench/contrib/tasks/test/common/taskConfiguration.test.ts +++ b/src/vs/workbench/contrib/tasks/test/common/taskConfiguration.test.ts @@ -10,11 +10,11 @@ import * as UUID from 'vs/base/common/uuid'; import * as Types from 'vs/base/common/types'; import * as Platform from 'vs/base/common/platform'; 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 * 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 { IContext } from 'vs/platform/contextkey/common/contextkey'; import { Workspace } from 'vs/platform/workspace/test/common/testWorkspace'; @@ -92,7 +92,7 @@ class ConfiguationBuilder { class PresentationBuilder { - public result: Tasks.PresentationOptions; + public result: Tasks.IPresentationOptions; 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 }; @@ -133,7 +133,7 @@ class PresentationBuilder { } class CommandConfigurationBuilder { - public result: Tasks.CommandConfiguration; + public result: Tasks.ICommandConfiguration; private presentationBuilder: PresentationBuilder; @@ -303,7 +303,7 @@ class ProblemMatcherBuilder { } class PatternBuilder { - public result: ProblemPattern; + public result: IProblemPattern; constructor(public parent: ProblemMatcherBuilder, regExp: RegExp) { 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 result = parse(workspaceFolder, workspace, Platform.platform, external, reporter, TaskConfigSource.TasksJson, new TasksMockContextKeyService()); assert.ok(!reporter.receivedMessage); @@ -386,7 +386,7 @@ function testDefaultProblemMatcher(external: ExternalTaskRunnerConfiguration, re assert.strictEqual(task.configurationProperties.problemMatchers!.length, resolved); } -function testConfiguration(external: ExternalTaskRunnerConfiguration, builder: ConfiguationBuilder): void { +function testConfiguration(external: IExternalTaskRunnerConfiguration, builder: ConfiguationBuilder): void { builder.done(); let reporter = new ProblemReporter(); 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()); let actual = result.custom; 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); if (actual && expected) { 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); if (actual && expected) { 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); if (Array.isArray(actual)) { - let actuals = actual; - let expecteds = expected; + let actuals = actual; + let expecteds = expected; assert.strictEqual(actuals.length, expecteds.length); for (let i = 0; i < actuals.length; i++) { assertProblemPattern(actuals[i], expecteds[i]); } } else { - assertProblemPattern(actual, expected); + assertProblemPattern(actual, expected); } } -function assertProblemPattern(actual: ProblemPattern, expected: ProblemPattern) { +function assertProblemPattern(actual: IProblemPattern, expected: IProblemPattern) { assert.strictEqual(actual.regexp.toString(), expected.regexp.toString()); assert.strictEqual(actual.file, expected.file); assert.strictEqual(actual.message, expected.message); @@ -793,7 +793,7 @@ suite('Tasks version 0.1.0', () => { task(name, name). group(Tasks.TaskGroup.Build). command().suppressTaskName(true); - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', windows: { @@ -811,7 +811,7 @@ suite('Tasks version 0.1.0', () => { group(Tasks.TaskGroup.Build). command().suppressTaskName(true). runtime(Tasks.RuntimeType.Shell); - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', isShellCommand: true, @@ -829,7 +829,7 @@ suite('Tasks version 0.1.0', () => { task(name, name). group(Tasks.TaskGroup.Build). command().suppressTaskName(true); - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', osx: { @@ -846,7 +846,7 @@ suite('Tasks version 0.1.0', () => { task(name, name). group(Tasks.TaskGroup.Build). command().suppressTaskName(true); - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', linux: { @@ -863,7 +863,7 @@ suite('Tasks version 0.1.0', () => { group(Tasks.TaskGroup.Build). command().suppressTaskName(true). presentation().reveal(Platform.isWindows ? Tasks.RevealKind.Always : Tasks.RevealKind.Never); - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', showOutput: 'never', @@ -882,7 +882,7 @@ suite('Tasks version 0.1.0', () => { command().suppressTaskName(true). presentation(). echo(Platform.isWindows ? false : true); - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', echoCommand: true, @@ -894,7 +894,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: global problemMatcher one', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', problemMatcher: '$msCompile' @@ -903,7 +903,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: global problemMatcher two', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', problemMatcher: ['$eslint-compact', '$msCompile'] @@ -912,7 +912,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: task definition', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', tasks: [ @@ -927,14 +927,14 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: build task', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', tasks: [ { taskName: 'taskName', isBuildCommand: true - } as CustomTask + } as ICustomTask ] }; let builder = new ConfiguationBuilder(); @@ -943,7 +943,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: default build task', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', tasks: [ @@ -958,14 +958,14 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: test task', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', tasks: [ { taskName: 'taskName', isTestCommand: true - } as CustomTask + } as ICustomTask ] }; let builder = new ConfiguationBuilder(); @@ -974,7 +974,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: default test task', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', tasks: [ @@ -989,7 +989,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: task with values', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', tasks: [ @@ -999,7 +999,7 @@ suite('Tasks version 0.1.0', () => { echoCommand: true, args: ['--p'], isWatching: true - } as CustomTask + } as ICustomTask ] }; let builder = new ConfiguationBuilder(); @@ -1015,7 +1015,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: task inherits global values', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', showOutput: 'never', @@ -1036,7 +1036,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: problem matcher default', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', tasks: [ @@ -1058,7 +1058,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: problem matcher .* regular expression', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', tasks: [ @@ -1080,7 +1080,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: problem matcher owner, applyTo, severity and fileLocation', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', tasks: [ @@ -1112,7 +1112,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: problem matcher fileLocation and filePrefix', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', tasks: [ @@ -1138,7 +1138,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: problem pattern location', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', tasks: [ @@ -1166,7 +1166,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: problem pattern line & column', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', tasks: [ @@ -1199,7 +1199,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: prompt on close default', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', tasks: [ @@ -1216,14 +1216,14 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: prompt on close watching', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', tasks: [ { taskName: 'taskName', isWatching: true - } as CustomTask + } as ICustomTask ] }; let builder = new ConfiguationBuilder(); @@ -1234,7 +1234,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: prompt on close set', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', tasks: [ @@ -1252,7 +1252,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: task selector set', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', taskSelector: '/t:', @@ -1271,7 +1271,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: suppress task name set', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', suppressTaskName: false, @@ -1279,7 +1279,7 @@ suite('Tasks version 0.1.0', () => { { taskName: 'taskName', suppressTaskName: true - } as CustomTask + } as ICustomTask ] }; let builder = new ConfiguationBuilder(); @@ -1289,7 +1289,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: suppress task name inherit', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', suppressTaskName: true, @@ -1306,7 +1306,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: two tasks', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', tasks: [ @@ -1327,7 +1327,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: with command', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', tasks: [ { @@ -1342,7 +1342,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: two tasks with command', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', tasks: [ { @@ -1362,7 +1362,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: with command and args', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', tasks: [ { @@ -1376,7 +1376,7 @@ suite('Tasks version 0.1.0', () => { env: 'env' } } - } as CustomTask + } as ICustomTask ] }; let builder = new ConfiguationBuilder(); @@ -1387,7 +1387,7 @@ suite('Tasks version 0.1.0', () => { test('tasks: with command os specific', () => { let name: string = Platform.isWindows ? 'tsc.win' : 'tsc'; - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', tasks: [ { @@ -1406,7 +1406,7 @@ suite('Tasks version 0.1.0', () => { test('tasks: with Windows specific args', () => { let args: string[] = Platform.isWindows ? ['arg1', 'arg2'] : ['arg1']; - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', tasks: [ { @@ -1426,7 +1426,7 @@ suite('Tasks version 0.1.0', () => { test('tasks: with Linux specific args', () => { let args: string[] = Platform.isLinux ? ['arg1', 'arg2'] : ['arg1']; - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', tasks: [ { @@ -1445,14 +1445,14 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: global command and task command properties', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', tasks: [ { taskName: 'taskNameOne', isShellCommand: true, - } as CustomTask + } as ICustomTask ] }; let builder = new ConfiguationBuilder(); @@ -1461,7 +1461,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: global and tasks args', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', args: ['global'], @@ -1478,7 +1478,7 @@ suite('Tasks version 0.1.0', () => { }); test('tasks: global and tasks args with task selector', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', command: 'tsc', args: ['global'], @@ -1498,7 +1498,7 @@ suite('Tasks version 0.1.0', () => { suite('Tasks version 2.0.0', () => { test.skip('Build workspace task', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '2.0.0', tasks: [ { @@ -1518,7 +1518,7 @@ suite('Tasks version 2.0.0', () => { testConfiguration(external, builder); }); test('Global group none', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '2.0.0', command: 'dir', type: 'shell', @@ -1532,7 +1532,7 @@ suite('Tasks version 2.0.0', () => { testConfiguration(external, builder); }); test.skip('Global group build', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '2.0.0', command: 'dir', type: 'shell', @@ -1547,7 +1547,7 @@ suite('Tasks version 2.0.0', () => { testConfiguration(external, builder); }); test.skip('Global group default build', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '2.0.0', command: 'dir', type: 'shell', @@ -1564,7 +1564,7 @@ suite('Tasks version 2.0.0', () => { testConfiguration(external, builder); }); test('Local group none', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '2.0.0', tasks: [ { @@ -1583,7 +1583,7 @@ suite('Tasks version 2.0.0', () => { testConfiguration(external, builder); }); test.skip('Local group build', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '2.0.0', tasks: [ { @@ -1603,7 +1603,7 @@ suite('Tasks version 2.0.0', () => { testConfiguration(external, builder); }); test.skip('Local group default build', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '2.0.0', tasks: [ { @@ -1625,7 +1625,7 @@ suite('Tasks version 2.0.0', () => { testConfiguration(external, builder); }); test('Arg overwrite', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '2.0.0', tasks: [ { @@ -1678,7 +1678,7 @@ suite('Tasks version 2.0.0', () => { suite('Bugs / regression tests', () => { (Platform.isLinux ? test.skip : test)('Bug 19548', () => { - let external: ExternalTaskRunnerConfiguration = { + let external: IExternalTaskRunnerConfiguration = { version: '0.1.0', windows: { command: 'powershell', @@ -1700,7 +1700,7 @@ suite('Bugs / regression tests', () => { isBuildCommand: false, showOutput: 'always', echoCommand: true - } as CustomTask + } as ICustomTask ] }, osx: { @@ -1718,7 +1718,7 @@ suite('Bugs / regression tests', () => { ], isBuildCommand: false, showOutput: 'always' - } as CustomTask + } as ICustomTask ] } }; @@ -1770,26 +1770,26 @@ suite('Bugs / regression tests', () => { class TestNamedProblemMatcher implements Partial { } -class TestParseContext implements Partial { +class TestParseContext implements Partial { } class TestTaskDefinitionRegistry implements Partial { - private _task: Tasks.TaskDefinition | undefined; - public get(key: string): Tasks.TaskDefinition { + private _task: Tasks.ITaskDefinition | undefined; + public get(key: string): Tasks.ITaskDefinition { return this._task!; } - public set(task: Tasks.TaskDefinition) { + public set(task: Tasks.ITaskDefinition) { this._task = task; } } suite('Task configuration conversions', () => { - const globals = {} as Globals; + const globals = {} as IGlobals; const taskConfigSource = {} as TaskConfigSource; const TaskDefinitionRegistry = new TestTaskDefinitionRegistry(); let instantiationService: TestInstantiationService; - let parseContext: ParseContext; - let namedProblemMatcher: NamedProblemMatcher; + let parseContext: IParseContext; + let namedProblemMatcher: INamedProblemMatcher; let problemReporter: ProblemReporter; setup(() => { instantiationService = new TestInstantiationService(); @@ -1824,18 +1824,18 @@ suite('Task configuration conversions', () => { suite('CustomTask', () => { suite('incomplete config reports an appropriate error for missing', () => { 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'); }); 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"); }); }); test('returns expected result', () => { const expected = [ - { taskName: 'task', command: 'echo test' } as CustomTask, - { taskName: 'task 2', command: 'echo test' } as CustomTask + { taskName: 'task', command: 'echo test' } as ICustomTask, + { taskName: 'task 2', command: 'echo test' } as ICustomTask ]; const result = TaskParser.from(expected, globals, parseContext, taskConfigSource); assertTaskParseResult(result, { custom: expected }, problemReporter, undefined); @@ -1844,7 +1844,7 @@ suite('Task configuration conversions', () => { suite('ConfiguredTask', () => { 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' }]; - 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); 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) { assert.strictEqual(problemReporter.lastMessage, undefined); } else { @@ -1880,10 +1880,10 @@ function assertTaskParseResult(actual: TaskParseResult, expected: ITestTaskParse } interface ITestTaskParseResult { - custom?: Partial[]; - configured?: Partial[]; + custom?: Partial[]; + configured?: Partial[]; } -interface TestConfiguringTask extends Partial { +interface ITestConfiguringTask extends Partial { label: string; }