mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
Use I
prefix for task interfaces (#151350)
This commit is contained in:
parent
c51f8ff55c
commit
7c22caad55
|
@ -10,7 +10,7 @@ import {
|
|||
detectNpmScriptsForFolder,
|
||||
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<FolderTaskItem>();
|
||||
const quickPick = vscode.window.createQuickPick<IFolderTaskItem>();
|
||||
quickPick.title = 'Run NPM script in Folder';
|
||||
quickPick.placeholder = 'Select an npm script';
|
||||
quickPick.items = taskList;
|
||||
|
||||
const toDispose: vscode.Disposable[] = [];
|
||||
|
||||
let pickPromise = new Promise<FolderTaskItem | undefined>((c) => {
|
||||
let pickPromise = new Promise<IFolderTaskItem | undefined>((c) => {
|
||||
toDispose.push(quickPick.onDidAccept(() => {
|
||||
toDispose.forEach(d => d.dispose());
|
||||
c(quickPick.selectedItems[0]);
|
||||
|
|
|
@ -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<TreeItem> {
|
|||
});
|
||||
}
|
||||
|
||||
private buildTaskTree(tasks: TaskWithLocation[]): TaskTree {
|
||||
private buildTaskTree(tasks: ITaskWithLocation[]): TaskTree {
|
||||
let folders: Map<String, Folder> = new Map();
|
||||
let packages: Map<String, PackageJSON> = new Map();
|
||||
|
||||
|
@ -301,7 +301,7 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider<TreeItem> {
|
|||
}
|
||||
const regularExpressions = (location && excludeConfig.has(location.uri.toString())) ? excludeConfig.get(location.uri.toString()) : undefined;
|
||||
|
||||
if (regularExpressions && regularExpressions.some((regularExpression) => (<NpmTaskDefinition>each.task.definition).script.match(regularExpression))) {
|
||||
if (regularExpressions && regularExpressions.some((regularExpression) => (<INpmTaskDefinition>each.task.definition).script.match(regularExpression))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -311,7 +311,7 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider<TreeItem> {
|
|||
folder = new Folder(each.task.scope);
|
||||
folders.set(each.task.scope.name, folder);
|
||||
}
|
||||
let definition: NpmTaskDefinition = <NpmTaskDefinition>each.task.definition;
|
||||
let definition: INpmTaskDefinition = <INpmTaskDefinition>each.task.definition;
|
||||
let relativePath = definition.path ? definition.path : '';
|
||||
let fullPath = path.join(each.task.scope.name, relativePath);
|
||||
packageJson = packages.get(fullPath);
|
||||
|
|
|
@ -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<TaskWithLocation[]> {
|
||||
get tasksWithLocation(): Promise<ITaskWithLocation[]> {
|
||||
return provideNpmScripts(this.context, false);
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ export class NpmTaskProvider implements TaskProvider {
|
|||
public async resolveTask(_task: Task): Promise<Task | undefined> {
|
||||
const npmTask = (<any>_task.definition).script;
|
||||
if (npmTask) {
|
||||
const kind: NpmTaskDefinition = (<any>_task.definition);
|
||||
const kind: INpmTaskDefinition = (<any>_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<boolean> {
|
|||
}
|
||||
}
|
||||
|
||||
async function detectNpmScripts(context: ExtensionContext, showWarning: boolean): Promise<TaskWithLocation[]> {
|
||||
async function detectNpmScripts(context: ExtensionContext, showWarning: boolean): Promise<ITaskWithLocation[]> {
|
||||
|
||||
let emptyTasks: TaskWithLocation[] = [];
|
||||
let allTasks: TaskWithLocation[] = [];
|
||||
let emptyTasks: ITaskWithLocation[] = [];
|
||||
let allTasks: ITaskWithLocation[] = [];
|
||||
let visitedPackageJsonFiles: Set<string> = 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<FolderTaskItem[]> {
|
||||
export async function detectNpmScriptsForFolder(context: ExtensionContext, folder: Uri): Promise<IFolderTaskItem[]> {
|
||||
|
||||
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<TaskWithLocation[]> {
|
||||
export async function provideNpmScripts(context: ExtensionContext, showWarning: boolean): Promise<ITaskWithLocation[]> {
|
||||
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<TaskWithLocation[]> {
|
||||
let emptyTasks: TaskWithLocation[] = [];
|
||||
async function provideNpmScriptsForFolder(context: ExtensionContext, packageJsonUri: Uri, showWarning: boolean): Promise<ITaskWithLocation[]> {
|
||||
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<Task> {
|
||||
let kind: NpmTaskDefinition;
|
||||
export async function createTask(packageManager: string, script: INpmTaskDefinition | string, cmd: string[], folder: WorkspaceFolder, packageJsonUri: Uri, scriptValue?: string, matcher?: any): Promise<Task> {
|
||||
let kind: INpmTaskDefinition;
|
||||
if (typeof script === 'string') {
|
||||
kind = { type: 'npm', script: script };
|
||||
} else {
|
||||
|
|
|
@ -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'
|
||||
};
|
||||
|
|
|
@ -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<string> = {};
|
||||
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<string> {
|
||||
$createTaskId(taskDTO: ITaskDTO): Promise<string> {
|
||||
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<TaskDTO[]> {
|
||||
public $fetchTasks(filter?: ITaskFilterDTO): Promise<ITaskDTO[]> {
|
||||
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<TaskExecutionDTO> {
|
||||
public async $getTaskExecution(value: ITaskHandleDTO | ITaskDTO): Promise<ITaskExecutionDTO> {
|
||||
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<TaskExecutionDTO> {
|
||||
return new Promise<TaskExecutionDTO>((resolve, reject) => {
|
||||
public $executeTask(value: ITaskHandleDTO | ITaskDTO): Promise<ITaskExecutionDTO> {
|
||||
return new Promise<ITaskExecutionDTO>((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<ResolvedVariables | undefined> => {
|
||||
resolveVariables: (workspaceFolder: IWorkspaceFolder, toResolve: IResolveSet, target: ConfigurationTarget): Promise<IResolvedVariables | undefined> => {
|
||||
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<ResolvedVariables | undefined>((resolve, reject) => {
|
||||
return new Promise<IResolvedVariables | undefined>((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<string, string>()
|
||||
};
|
||||
|
|
|
@ -1111,14 +1111,14 @@ export interface MainThreadSearchShape extends IDisposable {
|
|||
}
|
||||
|
||||
export interface MainThreadTaskShape extends IDisposable {
|
||||
$createTaskId(task: tasks.TaskDTO): Promise<string>;
|
||||
$createTaskId(task: tasks.ITaskDTO): Promise<string>;
|
||||
$registerTaskProvider(handle: number, type: string): Promise<void>;
|
||||
$unregisterTaskProvider(handle: number): Promise<void>;
|
||||
$fetchTasks(filter?: tasks.TaskFilterDTO): Promise<tasks.TaskDTO[]>;
|
||||
$getTaskExecution(value: tasks.TaskHandleDTO | tasks.TaskDTO): Promise<tasks.TaskExecutionDTO>;
|
||||
$executeTask(task: tasks.TaskHandleDTO | tasks.TaskDTO): Promise<tasks.TaskExecutionDTO>;
|
||||
$fetchTasks(filter?: tasks.ITaskFilterDTO): Promise<tasks.ITaskDTO[]>;
|
||||
$getTaskExecution(value: tasks.ITaskHandleDTO | tasks.ITaskDTO): Promise<tasks.ITaskExecutionDTO>;
|
||||
$executeTask(task: tasks.ITaskHandleDTO | tasks.ITaskDTO): Promise<tasks.ITaskExecutionDTO>;
|
||||
$terminateTask(id: string): Promise<void>;
|
||||
$registerTaskSystem(scheme: string, info: tasks.TaskSystemInfoDTO): void;
|
||||
$registerTaskSystem(scheme: string, info: tasks.ITaskSystemInfoDTO): void;
|
||||
$customExecutionComplete(id: string, result?: number): Promise<void>;
|
||||
$registerSupportedExecutions(custom?: boolean, shell?: boolean, process?: boolean): Promise<void>;
|
||||
}
|
||||
|
@ -1841,12 +1841,12 @@ export interface ExtHostSCMShape {
|
|||
}
|
||||
|
||||
export interface ExtHostTaskShape {
|
||||
$provideTasks(handle: number, validTypes: { [key: string]: boolean }): Promise<tasks.TaskSetDTO>;
|
||||
$resolveTask(handle: number, taskDTO: tasks.TaskDTO): Promise<tasks.TaskDTO | undefined>;
|
||||
$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<tasks.ITaskSetDTO>;
|
||||
$resolveTask(handle: number, taskDTO: tasks.ITaskDTO): Promise<tasks.ITaskDTO | undefined>;
|
||||
$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<boolean>;
|
||||
$findExecutable(command: string, cwd?: string, paths?: string[]): Promise<string | undefined>;
|
||||
|
|
|
@ -38,20 +38,20 @@ export interface IExtHostTask extends ExtHostTaskShape {
|
|||
onDidEndTaskProcess: Event<vscode.TaskProcessEndEvent>;
|
||||
|
||||
registerTaskProvider(extension: IExtensionDescription, type: string, provider: vscode.TaskProvider): vscode.Disposable;
|
||||
registerTaskSystem(scheme: string, info: tasks.TaskSystemInfoDTO): void;
|
||||
registerTaskSystem(scheme: string, info: tasks.ITaskSystemInfoDTO): void;
|
||||
fetchTasks(filter?: vscode.TaskFilter): Promise<vscode.Task[]>;
|
||||
executeTask(extension: IExtensionDescription, task: vscode.Task): Promise<vscode.TaskExecution>;
|
||||
terminateTask(execution: vscode.TaskExecution): Promise<void>;
|
||||
}
|
||||
|
||||
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(<types.CustomExecution>value.execution);
|
||||
}
|
||||
|
||||
const definition: tasks.TaskDefinitionDTO | undefined = TaskDefinitionDTO.from(value.definition);
|
||||
const definition: tasks.ITaskDefinitionDTO | undefined = TaskDefinitionDTO.from(value.definition);
|
||||
let scope: number | UriComponents;
|
||||
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<string, types.CustomExecution>): Promise<types.Task | undefined> {
|
||||
export async function to(value: tasks.ITaskDTO | undefined, workspace: IExtHostWorkspaceProvider, providedCustomExeutions: Map<string, types.CustomExecution>): Promise<types.Task | undefined> {
|
||||
if (value === undefined || value === null) {
|
||||
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<void> {
|
||||
public async $onDidStartTask(execution: tasks.ITaskExecutionDTO, terminalId: number, resolvedDefinition: tasks.ITaskDefinitionDTO): Promise<void> {
|
||||
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<void> {
|
||||
public async $OnDidEndTask(execution: tasks.ITaskExecutionDTO): Promise<void> {
|
||||
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<void> {
|
||||
public async $onDidStartTaskProcess(value: tasks.ITaskProcessStartedDTO): Promise<void> {
|
||||
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<void> {
|
||||
public async $onDidEndTaskProcess(value: tasks.ITaskProcessEndedDTO): Promise<void> {
|
||||
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<void>[], handler: HandlerData, value: vscode.Task[] | null | undefined): { tasks: tasks.TaskDTO[]; extension: IExtensionDescription };
|
||||
protected abstract provideTasksInternal(validTypes: { [key: string]: boolean }, taskIdPromises: Promise<void>[], handler: HandlerData, value: vscode.Task[] | null | undefined): { tasks: tasks.ITaskDTO[]; extension: IExtensionDescription };
|
||||
|
||||
public $provideTasks(handle: number, validTypes: { [key: string]: boolean }): Promise<tasks.TaskSetDTO> {
|
||||
public $provideTasks(handle: number, validTypes: { [key: string]: boolean }): Promise<tasks.ITaskSetDTO> {
|
||||
const handler = this._handlers.get(handle);
|
||||
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<tasks.TaskDTO | undefined>;
|
||||
protected abstract resolveTaskInternal(resolvedTaskDTO: tasks.ITaskDTO): Promise<tasks.ITaskDTO | undefined>;
|
||||
|
||||
public async $resolveTask(handle: number, taskDTO: tasks.TaskDTO): Promise<tasks.TaskDTO | undefined> {
|
||||
public async $resolveTask(handle: number, taskDTO: tasks.ITaskDTO): Promise<tasks.ITaskDTO | undefined> {
|
||||
const handler = this._handlers.get(handle);
|
||||
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<void> {
|
||||
protected async addCustomExecution(taskDTO: tasks.ITaskDTO, task: vscode.Task, isProvided: boolean): Promise<void> {
|
||||
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, <types.CustomExecution>task.execution);
|
||||
}
|
||||
|
||||
protected async getTaskExecution(execution: tasks.TaskExecutionDTO | string, task?: vscode.Task): Promise<TaskExecutionImpl> {
|
||||
protected async getTaskExecution(execution: tasks.ITaskExecutionDTO | string, task?: vscode.Task): Promise<TaskExecutionImpl> {
|
||||
if (typeof execution === 'string') {
|
||||
const taskExecution = this._taskExecutionPromises.get(execution);
|
||||
if (!taskExecution) {
|
||||
|
@ -641,7 +641,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask
|
|||
return result;
|
||||
}
|
||||
const createdResult: Promise<TaskExecutionImpl> = new Promise((resolve, reject) => {
|
||||
function resolvePromiseWithCreatedTask(that: ExtHostTaskBase, execution: tasks.TaskExecutionDTO, taskToCreate: vscode.Task | types.Task | undefined) {
|
||||
function resolvePromiseWithCreatedTask(that: ExtHostTaskBase, execution: tasks.ITaskExecutionDTO, taskToCreate: vscode.Task | types.Task | undefined) {
|
||||
if (!taskToCreate) {
|
||||
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<void>[], handler: HandlerData, value: vscode.Task[] | null | undefined): { tasks: tasks.TaskDTO[]; extension: IExtensionDescription } {
|
||||
const taskDTOs: tasks.TaskDTO[] = [];
|
||||
protected provideTasksInternal(validTypes: { [key: string]: boolean }, taskIdPromises: Promise<void>[], 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<tasks.TaskDTO | undefined> {
|
||||
protected async resolveTaskInternal(resolvedTaskDTO: tasks.ITaskDTO): Promise<tasks.ITaskDTO | undefined> {
|
||||
if (CustomExecutionDTO.is(resolvedTaskDTO.execution)) {
|
||||
return resolvedTaskDTO;
|
||||
} else {
|
||||
|
|
|
@ -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<string | ShellQuotedStringDTO>;
|
||||
options?: ShellExecutionOptionsDTO;
|
||||
command?: string | IShellQuotedStringDTO;
|
||||
args?: Array<string | IShellQuotedStringDTO>;
|
||||
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<IExtensionDescription>;
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -92,8 +92,8 @@ export class ExtHostTask extends ExtHostTaskBase {
|
|||
}
|
||||
}
|
||||
|
||||
protected provideTasksInternal(validTypes: { [key: string]: boolean }, taskIdPromises: Promise<void>[], handler: HandlerData, value: vscode.Task[] | null | undefined): { tasks: tasks.TaskDTO[]; extension: IExtensionDescription } {
|
||||
const taskDTOs: tasks.TaskDTO[] = [];
|
||||
protected provideTasksInternal(validTypes: { [key: string]: boolean }, taskIdPromises: Promise<void>[], 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<tasks.TaskDTO | undefined> {
|
||||
protected async resolveTaskInternal(resolvedTaskDTO: tasks.ITaskDTO): Promise<tasks.ITaskDTO | undefined> {
|
||||
return resolvedTaskDTO;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import { Markers } from 'vs/workbench/contrib/markers/common/markers';
|
|||
import { ITaskService, ITaskSummary } from 'vs/workbench/contrib/tasks/common/taskService';
|
||||
import { 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<TaskEvent>): Event<TaskEvent> {
|
||||
function once(match: (e: ITaskEvent) => boolean, event: Event<ITaskEvent>): Event<ITaskEvent> {
|
||||
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<TaskRunResult> {
|
||||
async runTaskAndCheckErrors(root: IWorkspaceFolder | IWorkspace | undefined, taskId: string | ITaskIdentifier | undefined): Promise<TaskRunResult> {
|
||||
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<ITaskSummary | null> {
|
||||
async runTask(root: IWorkspace | IWorkspaceFolder | undefined, taskId: string | ITaskIdentifier | undefined): Promise<ITaskSummary | null> {
|
||||
if (!taskId) {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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<number, ITaskProvider>;
|
||||
private _providerTypes: Map<number, string>;
|
||||
protected _taskSystemInfos: Map<string, TaskSystemInfo[]>;
|
||||
protected _taskSystemInfos: Map<string, ITaskSystemInfo[]>;
|
||||
|
||||
protected _workspaceTasksPromise?: Promise<Map<string, WorkspaceFolderTaskResult>>;
|
||||
protected _workspaceTasksPromise?: Promise<Map<string, IWorkspaceFolderTaskResult>>;
|
||||
|
||||
protected _taskSystem?: ITaskSystem;
|
||||
protected _taskSystemListener?: IDisposable;
|
||||
|
@ -218,7 +218,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
|||
protected _taskRunningState: IContextKey<boolean>;
|
||||
|
||||
protected _outputChannel: IOutputChannel;
|
||||
protected readonly _onDidStateChange: Emitter<TaskEvent>;
|
||||
protected readonly _onDidStateChange: Emitter<ITaskEvent>;
|
||||
private _waitForSupportedExecutions: Promise<void>;
|
||||
private _onDidRegisterSupportedExecutions: Emitter<void> = new Emitter();
|
||||
private _onDidChangeTaskSystemInfo: Emitter<void> = new Emitter();
|
||||
|
@ -266,7 +266,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
|||
this._outputChannel = this.outputService.getChannel(AbstractTaskService.OutputChannelId)!;
|
||||
this._providers = new Map<number, ITaskProvider>();
|
||||
this._providerTypes = new Map<number, string>();
|
||||
this._taskSystemInfos = new Map<string, TaskSystemInfo[]>();
|
||||
this._taskSystemInfos = new Map<string, ITaskSystemInfo[]>();
|
||||
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<TaskEvent> {
|
||||
public get onDidStateChange(): Event<ITaskEvent> {
|
||||
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<Task | undefined> {
|
||||
public async getTask(folder: IWorkspace | IWorkspaceFolder | string, identifier: string | ITaskIdentifier, compareId: boolean = false): Promise<Task | undefined> {
|
||||
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<Task[]> {
|
||||
public async tasks(filter?: ITaskFilter): Promise<Task[]> {
|
||||
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<ITaskSummary | undefined> {
|
||||
public async run(task: Task | undefined, options?: IProblemMatcherRunOptions, runSource: TaskRunSource = TaskRunSource.System): Promise<ITaskSummary | undefined> {
|
||||
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 = (<any>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<Task | undefined> {
|
||||
interface ProblemMatcherPickEntry extends IQuickPickItem {
|
||||
matcher: NamedProblemMatcher | undefined;
|
||||
interface IProblemMatcherPickEntry extends IQuickPickItem {
|
||||
matcher: INamedProblemMatcher | undefined;
|
||||
never?: boolean;
|
||||
learnMore?: boolean;
|
||||
setting?: string;
|
||||
}
|
||||
let entries: QuickPickInput<ProblemMatcherPickEntry>[] = [];
|
||||
let entries: QuickPickInput<IProblemMatcherPickEntry>[] = [];
|
||||
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 = (<any>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<string> {
|
||||
private async formatTaskForJson(resource: URI, task: TaskConfig.ICustomTask | TaskConfig.IConfiguringTask): Promise<string> {
|
||||
let reference: IReference<IResolvedTextEditorModel> | 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<boolean> {
|
||||
private openEditorAtTask(resource: URI | undefined, task: TaskConfig.ICustomTask | TaskConfig.IConfiguringTask | string | undefined, configIndex: number = -1): Promise<boolean> {
|
||||
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<TaskConfig.ExternalTaskRunnerConfiguration>('tasks', { resource });
|
||||
const json: TaskConfig.IExternalTaskRunnerConfiguration = this.configurationService.getValue<TaskConfig.IExternalTaskRunnerConfiguration>('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 => (<any>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<void> {
|
||||
public async customize(task: ContributedTask | CustomTask | ConfiguringTask, properties?: ICustomizationProperties, openConfig?: boolean): Promise<void> {
|
||||
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<string, Task>;
|
||||
label: Map<string, Task>;
|
||||
identifier: Map<string, Task>;
|
||||
}
|
||||
|
||||
let resolverData: Map<string, ResolverData> = new Map();
|
||||
let resolverData: Map<string, IResolverData> = new Map();
|
||||
let workspaceTasks: Task[] = [];
|
||||
let extensionTasks: Task[] = [];
|
||||
tasks.forEach((tasks, folder) => {
|
||||
|
@ -1603,7 +1603,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
|||
|
||||
let resolverData: Map<string, ResolverData> | undefined;
|
||||
|
||||
async function quickResolve(that: AbstractTaskService, uri: URI | string, identifier: string | TaskIdentifier) {
|
||||
async function quickResolve(that: AbstractTaskService, uri: URI | string, identifier: string | ITaskIdentifier) {
|
||||
const foundTasks = await that._findWorkspaceTasks((task: Task | ConfiguringTask): boolean => {
|
||||
const 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<TaskTerminateResponse> {
|
||||
public async terminate(task: Task): Promise<ITaskTerminateResponse> {
|
||||
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<TaskTerminateResponse[]> {
|
||||
private terminateAll(): Promise<ITaskTerminateResponse[]> {
|
||||
if (!this._taskSystem) {
|
||||
return Promise.resolve<TaskTerminateResponse[]>([]);
|
||||
return Promise.resolve<ITaskTerminateResponse[]>([]);
|
||||
}
|
||||
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<TaskSet[]>(resolve => {
|
||||
let result: TaskSet[] = [];
|
||||
return new Promise<ITaskSet[]>(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<CustomTask> | undefined {
|
||||
private getLegacyTaskConfigurations(workspaceTasks: ITaskSet): IStringDictionary<CustomTask> | undefined {
|
||||
let result: IStringDictionary<CustomTask> | undefined;
|
||||
function getResult(): IStringDictionary<CustomTask> {
|
||||
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<Map<string, WorkspaceFolderTaskResult>> {
|
||||
public async getWorkspaceTasks(runSource: TaskRunSource = TaskRunSource.User): Promise<Map<string, IWorkspaceFolderTaskResult>> {
|
||||
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<Map<string, WorkspaceFolderTaskResult>> {
|
||||
private updateWorkspaceTasks(runSource: TaskRunSource = TaskRunSource.User): Promise<Map<string, IWorkspaceFolderTaskResult>> {
|
||||
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<Map<string, WorkspaceFolderTaskResult>> {
|
||||
let promises: Promise<WorkspaceFolderTaskResult | undefined>[] = [];
|
||||
protected computeWorkspaceTasks(runSource: TaskRunSource = TaskRunSource.User): Promise<Map<string, IWorkspaceFolderTaskResult>> {
|
||||
let promises: Promise<IWorkspaceFolderTaskResult | undefined>[] = [];
|
||||
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<string, WorkspaceFolderTaskResult>();
|
||||
let result = new Map<string, IWorkspaceFolderTaskResult>();
|
||||
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<WorkspaceFolderTaskResult> {
|
||||
private computeWorkspaceFolderTasks(workspaceFolder: IWorkspaceFolder, runSource: TaskRunSource = TaskRunSource.User): Promise<IWorkspaceFolderTaskResult> {
|
||||
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<WorkspaceFolderTaskResult> => {
|
||||
let taskSystemInfo: TaskSystemInfo | undefined = this.getTaskSystemInfo(workspaceFolder.uri.scheme);
|
||||
return ProblemMatcherRegistry.onReady().then(async (): Promise<IWorkspaceFolderTaskResult> => {
|
||||
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<WorkspaceFolderTaskResult> {
|
||||
private async computeWorkspaceFileTasks(workspaceFolder: IWorkspaceFolder, runSource: TaskRunSource = TaskRunSource.User): Promise<IWorkspaceFolderTaskResult> {
|
||||
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<WorkspaceFolderTaskResult> {
|
||||
private async computeUserTasks(workspaceFolder: IWorkspaceFolder, runSource: TaskRunSource = TaskRunSource.User): Promise<IWorkspaceFolderTaskResult> {
|
||||
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<ConfiguringTask>, source: TaskConfig.TaskConfigSource, isRecentTask: boolean = false): Promise<boolean> {
|
||||
private async computeTasksForSingleConfig(workspaceFolder: IWorkspaceFolder, config: TaskConfig.IExternalTaskRunnerConfiguration | undefined, runSource: TaskRunSource, custom: CustomTask[], customized: IStringDictionary<ConfiguringTask>, source: TaskConfig.TaskConfigSource, isRecentTask: boolean = false): Promise<boolean> {
|
||||
if (!config) {
|
||||
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<WorkspaceFolderConfigurationResult> {
|
||||
private computeConfiguration(workspaceFolder: IWorkspaceFolder): Promise<IWorkspaceFolderConfigurationResult> {
|
||||
let { config, hasParseErrors } = this.getConfiguration(workspaceFolder);
|
||||
return Promise.resolve<WorkspaceFolderConfigurationResult>({ workspaceFolder, config, hasErrors: hasParseErrors });
|
||||
return Promise.resolve<IWorkspaceFolderConfigurationResult>({ workspaceFolder, config, hasErrors: hasParseErrors });
|
||||
}
|
||||
|
||||
protected abstract computeLegacyConfiguration(workspaceFolder: IWorkspaceFolder): Promise<WorkspaceFolderConfigurationResult>;
|
||||
protected abstract computeLegacyConfiguration(workspaceFolder: IWorkspaceFolder): Promise<IWorkspaceFolderConfigurationResult>;
|
||||
|
||||
private computeWorkspaceFolderSetup(): [IWorkspaceFolder[], IWorkspaceFolder[], ExecutionEngine, JsonSchemaVersion, IWorkspace | undefined] {
|
||||
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<TaskConfig.ExternalTaskRunnerConfiguration>('tasks', { resource: workspaceFolder.uri });
|
||||
const wholeConfig = this.configurationService.inspect<TaskConfig.IExternalTaskRunnerConfiguration>('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<boolean>(QUICKOPEN_DETAIL_CONFIG);
|
||||
}
|
||||
|
||||
private async createTaskQuickPickEntries(tasks: Task[], group: boolean = false, sort: boolean = false, selectedEntry?: TaskQuickPickEntry, includeRecents: boolean = true): Promise<TaskQuickPickEntry[]> {
|
||||
let encounteredTasks: { [key: string]: TaskQuickPickEntry[] } = {};
|
||||
private async createTaskQuickPickEntries(tasks: Task[], group: boolean = false, sort: boolean = false, selectedEntry?: ITaskQuickPickEntry, includeRecents: boolean = true): Promise<ITaskQuickPickEntry[]> {
|
||||
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<TaskQuickPickEntry>[], tasks: Task[], groupLabel: string): void {
|
||||
function fillEntries(entries: QuickPickInput<ITaskQuickPickEntry>[], 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<TaskQuickPickEntry>(task => TaskQuickPickEntry(task));
|
||||
entries = tasks.map<ITaskQuickPickEntry>(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[]> | Task[], placeHolder: string, defaultEntry?: TaskQuickPickEntry, group: boolean = false, sort: boolean = false, selectedEntry?: TaskQuickPickEntry, additionalEntries?: TaskQuickPickEntry[]): Promise<TaskQuickPickEntry | undefined | null> {
|
||||
private async showQuickPick(tasks: Promise<Task[]> | Task[], placeHolder: string, defaultEntry?: ITaskQuickPickEntry, group: boolean = false, sort: boolean = false, selectedEntry?: ITaskQuickPickEntry, additionalEntries?: ITaskQuickPickEntry[]): Promise<ITaskQuickPickEntry | undefined | null> {
|
||||
const tokenSource = new CancellationTokenSource();
|
||||
const cancellationToken: CancellationToken = tokenSource.token;
|
||||
let _createEntries = new Promise<QuickPickInput<TaskQuickPickEntry>[]>((resolve) => {
|
||||
let _createEntries = new Promise<QuickPickInput<ITaskQuickPickEntry>[]>((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<boolean>(QUICKOPEN_SKIP_CONFIG)) {
|
||||
return (<TaskQuickPickEntry>(await _createEntries)[0]);
|
||||
return (<ITaskQuickPickEntry>(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<TaskQuickPickEntry> = this.quickInputService.createQuickPick();
|
||||
const picker: IQuickPick<ITaskQuickPickEntry> = 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<TaskQuickPickEntry | undefined | null>(resolve => {
|
||||
return new Promise<ITaskQuickPickEntry | undefined | null>(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 ((<any>task).task) {
|
||||
selection = <TaskQuickPickEntry>task;
|
||||
selection = <ITaskQuickPickEntry>task;
|
||||
}
|
||||
}
|
||||
picker.dispose();
|
||||
|
@ -2682,7 +2682,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
|||
}
|
||||
}
|
||||
|
||||
private tasksAndGroupedTasks(filter?: TaskFilter): { tasks: Promise<Task[]>; grouped: Promise<TaskMap> } {
|
||||
private tasksAndGroupedTasks(filter?: ITaskFilter): { tasks: Promise<Task[]>; grouped: Promise<TaskMap> } {
|
||||
if (!this.versionAndEngineCompatible(filter)) {
|
||||
return { tasks: Promise.resolve<Task[]>([]), grouped: Promise.resolve(new TaskMap()) };
|
||||
}
|
||||
|
@ -2816,7 +2816,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
|||
|
||||
let taskGroupTasks: (Task | ConfiguringTask)[] = [];
|
||||
|
||||
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<TaskConfig.ExternalTaskRunnerConfiguration>('tasks');
|
||||
const configValue = this.configurationService.inspect<TaskConfig.IExternalTaskRunnerConfiguration>('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: <CommandUpgrade>this.configurationService.getValue('tasks.windows', { resource: folder.uri }),
|
||||
osx: <CommandUpgrade>this.configurationService.getValue('tasks.osx', { resource: folder.uri }),
|
||||
linux: <CommandUpgrade>this.configurationService.getValue('tasks.linux', { resource: folder.uri })
|
||||
windows: <ICommandUpgrade>this.configurationService.getValue('tasks.windows', { resource: folder.uri }),
|
||||
osx: <ICommandUpgrade>this.configurationService.getValue('tasks.osx', { resource: folder.uri }),
|
||||
linux: <ICommandUpgrade>this.configurationService.getValue('tasks.linux', { resource: folder.uri })
|
||||
};
|
||||
tasks.get(folder).forEach(task => {
|
||||
const configTask = this.upgradeTask(task, suppressTaskName, globalConfig);
|
||||
|
|
|
@ -7,9 +7,9 @@ import * as nls from 'vs/nls';
|
|||
import * as resources from 'vs/base/common/resources';
|
||||
import { 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((<WorkspaceTaskSource>source).config.workspaceFolder!.uri, (<WorkspaceTaskSource>source).config.file);
|
||||
return resources.joinPath((<IWorkspaceTaskSource>source).config.workspaceFolder!.uri, (<IWorkspaceTaskSource>source).config.file);
|
||||
}
|
||||
case ConfigurationTarget.WORKSPACE: {
|
||||
return (<WorkspaceFileTaskSource>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<string, WorkspaceFolderTaskResult>): { tasks: Array<Task | Promise<Task | undefined>>; taskNames: Array<string>; locations: Map<string, URI> } {
|
||||
private static findAutoTasks(taskService: ITaskService, workspaceTaskResult: Map<string, IWorkspaceFolderTaskResult>): { tasks: Array<Task | Promise<Task | undefined>>; taskNames: Array<string>; locations: Map<string, URI> } {
|
||||
const tasks = new Array<Task | Promise<Task | undefined>>();
|
||||
const taskNames = new Array<string>();
|
||||
const locations = new Map<string, URI>();
|
||||
|
@ -129,7 +129,7 @@ export class RunAutomaticTasks extends Disposable implements IWorkbenchContribut
|
|||
}
|
||||
|
||||
public static async promptForPermission(taskService: ITaskService, storageService: IStorageService, notificationService: INotificationService, workspaceTrustManagementService: IWorkspaceTrustManagementService,
|
||||
openerService: IOpenerService, workspaceTaskResult: Map<string, WorkspaceFolderTaskResult>) {
|
||||
openerService: IOpenerService, workspaceTaskResult: Map<string, IWorkspaceFolderTaskResult>) {
|
||||
const isWorkspaceTrusted = workspaceTrustManagementService.isWorkspaceTrusted;
|
||||
if (!isWorkspaceTrusted) {
|
||||
return;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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<TaskTwoLevelQuickPickEntry>[] | undefined;
|
||||
private topLevelEntries: QuickPickInput<ITaskTwoLevelQuickPickEntry>[] | 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<TaskTwoLevelQuickPickEntry>[], tasks: (Task | ConfiguringTask)[],
|
||||
private createEntriesForGroup(entries: QuickPickInput<ITaskTwoLevelQuickPickEntry>[], 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<TaskTwoLevelQuickPickEntry>[], types: string[]) {
|
||||
private createTypeEntries(entries: QuickPickInput<ITaskTwoLevelQuickPickEntry>[], 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<string, WorkspaceFolderTaskResult>): (Task | ConfiguringTask)[] {
|
||||
private handleFolderTaskResult(result: Map<string, IWorkspaceFolderTaskResult>): (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<TaskTwoLevelQuickPickEntry>[]; isSingleConfigured?: Task | ConfiguringTask }> {
|
||||
public async getTopLevelEntries(defaultEntry?: ITaskQuickPickEntry): Promise<{ entries: QuickPickInput<ITaskTwoLevelQuickPickEntry>[]; 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<Task | undefined | null> {
|
||||
const picker: IQuickPick<TaskTwoLevelQuickPickEntry> = this.quickInputService.createQuickPick();
|
||||
public async show(placeHolder: string, defaultEntry?: ITaskQuickPickEntry, startAtType?: string): Promise<Task | undefined | null> {
|
||||
const picker: IQuickPick<ITaskTwoLevelQuickPickEntry> = 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<TaskTwoLevelQuickPickEntry>[] = topLevelEntriesResult.entries;
|
||||
const taskQuickPickEntries: QuickPickInput<ITaskTwoLevelQuickPickEntry>[] = topLevelEntriesResult.entries;
|
||||
firstLevelTask = await this.doPickerFirstLevel(picker, taskQuickPickEntries);
|
||||
}
|
||||
do {
|
||||
|
@ -265,9 +265,9 @@ export class TaskQuickPick extends Disposable {
|
|||
return;
|
||||
}
|
||||
|
||||
private async doPickerFirstLevel(picker: IQuickPick<TaskTwoLevelQuickPickEntry>, taskQuickPickEntries: QuickPickInput<TaskTwoLevelQuickPickEntry>[]): Promise<Task | ConfiguringTask | string | null | undefined> {
|
||||
private async doPickerFirstLevel(picker: IQuickPick<ITaskTwoLevelQuickPickEntry>, taskQuickPickEntries: QuickPickInput<ITaskTwoLevelQuickPickEntry>[]): Promise<Task | ConfiguringTask | string | null | undefined> {
|
||||
picker.items = taskQuickPickEntries;
|
||||
const firstLevelPickerResult = await new Promise<TaskTwoLevelQuickPickEntry | undefined | null>(resolve => {
|
||||
const firstLevelPickerResult = await new Promise<ITaskTwoLevelQuickPickEntry | undefined | null>(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<TaskTwoLevelQuickPickEntry>, type: string) {
|
||||
private async doPickerSecondLevel(picker: IQuickPick<ITaskTwoLevelQuickPickEntry>, 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<TaskTwoLevelQuickPickEntry | undefined | null>(resolve => {
|
||||
const secondLevelPickerResult = await new Promise<ITaskTwoLevelQuickPickEntry | undefined | null>(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<QuickPickInput<TaskTwoLevelQuickPickEntry>[]> {
|
||||
private async getEntriesForProvider(type: string): Promise<QuickPickInput<ITaskTwoLevelQuickPickEntry>[]> {
|
||||
const tasks = (await this.taskService.tasks({ type })).sort((a, b) => this.sorter.compare(a, b));
|
||||
let taskQuickPickEntries: QuickPickInput<TaskTwoLevelQuickPickEntry>[];
|
||||
let taskQuickPickEntries: QuickPickInput<ITaskTwoLevelQuickPickEntry>[];
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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<WorkspaceFolderConfigurationResult> {
|
||||
protected computeLegacyConfiguration(workspaceFolder: IWorkspaceFolder): Promise<IWorkspaceFolderConfigurationResult> {
|
||||
throw new Error(TaskService.ProcessTaskSystemSupportMessage);
|
||||
}
|
||||
|
||||
protected versionAndEngineCompatible(filter?: TaskFilter): boolean {
|
||||
protected versionAndEngineCompatible(filter?: ITaskFilter): boolean {
|
||||
return this.executionEngine === ExecutionEngine.Terminal;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,14 +8,14 @@ import { Codicon } from 'vs/base/common/codicons';
|
|||
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import 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<string, TerminalData> = new Map();
|
||||
private terminalMap: Map<string, ITerminalData> = 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;
|
||||
|
|
|
@ -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 PickerQuickAccessProvider<IPickerQ
|
|||
taskPicks.push(entry);
|
||||
}
|
||||
|
||||
const task: Task | ConfiguringTask | string = (<TaskTwoLevelQuickPickEntry>entry).task!;
|
||||
const quickAccessEntry: IPickerQuickAccessItem = <TaskTwoLevelQuickPickEntry>entry;
|
||||
const task: Task | ConfiguringTask | string = (<ITaskTwoLevelQuickPickEntry>entry).task!;
|
||||
const quickAccessEntry: IPickerQuickAccessItem = <ITaskTwoLevelQuickPickEntry>entry;
|
||||
quickAccessEntry.highlights = { label: highlights };
|
||||
quickAccessEntry.trigger = (index) => {
|
||||
if ((index === 1) && (quickAccessEntry.buttons?.length === 2)) {
|
||||
|
|
|
@ -30,12 +30,12 @@ import { ITerminalService, ITerminalInstance, ITerminalGroupService } from 'vs/w
|
|||
import { IOutputService } from 'vs/workbench/services/output/common/output';
|
||||
import { 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<ITaskSummary>;
|
||||
|
@ -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<string, string>, private _service: IConfigurationResolverService | undefined) {
|
||||
constructor(public workspaceFolder: IWorkspaceFolder | undefined, public taskSystemInfo: ITaskSystemInfo | undefined, public readonly values: Map<string, string>, private _service: IConfigurationResolverService | undefined) {
|
||||
}
|
||||
async resolve(value: string): Promise<string> {
|
||||
const replacers: Promise<string>[] = [];
|
||||
|
@ -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<ShellQuotingOptions> = {
|
||||
private static shellQuotes: IStringDictionary<IShellQuotingOptions> = {
|
||||
'cmd': {
|
||||
strong: '"'
|
||||
},
|
||||
|
@ -179,19 +179,19 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
|||
}
|
||||
};
|
||||
|
||||
private static osShellQuotes: IStringDictionary<ShellQuotingOptions> = {
|
||||
private static osShellQuotes: IStringDictionary<IShellQuotingOptions> = {
|
||||
'Linux': TerminalTaskSystem.shellQuotes['bash'],
|
||||
'Mac': TerminalTaskSystem.shellQuotes['bash'],
|
||||
'Windows': TerminalTaskSystem.shellQuotes['powershell']
|
||||
};
|
||||
|
||||
private activeTasks: IStringDictionary<ActiveTerminalData>;
|
||||
private activeTasks: IStringDictionary<IActiveTerminalData>;
|
||||
private instances: IStringDictionary<InstanceManager>;
|
||||
private busyTasks: IStringDictionary<Task>;
|
||||
private terminals: IStringDictionary<TerminalData>;
|
||||
private terminals: IStringDictionary<ITerminalData>;
|
||||
private idleTaskTerminals: LinkedMap<string, string>;
|
||||
private sameTaskTerminals: IStringDictionary<string>;
|
||||
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<ITerminalInstance | void> = Promise.resolve();
|
||||
|
||||
private readonly _onDidStateChange: Emitter<TaskEvent>;
|
||||
private readonly _onDidStateChange: Emitter<ITaskEvent>;
|
||||
|
||||
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<TaskEvent> {
|
||||
public get onDidStateChange(): Event<ITaskEvent> {
|
||||
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<TaskTerminateResponse> {
|
||||
public terminate(task: Task): Promise<ITaskTerminateResponse> {
|
||||
let activeTerminal = this.activeTasks[task.getMapKey()];
|
||||
if (!activeTerminal) {
|
||||
return Promise.resolve<TaskTerminateResponse>({ success: false, task: undefined });
|
||||
return Promise.resolve<ITaskTerminateResponse>({ success: false, task: undefined });
|
||||
}
|
||||
return new Promise<TaskTerminateResponse>((resolve, reject) => {
|
||||
return new Promise<ITaskTerminateResponse>((resolve, reject) => {
|
||||
let terminal = activeTerminal.terminal;
|
||||
|
||||
const onExit = terminal.onExit(() => {
|
||||
|
@ -457,12 +457,12 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
|||
});
|
||||
}
|
||||
|
||||
public terminateAll(): Promise<TaskTerminateResponse[]> {
|
||||
let promises: Promise<TaskTerminateResponse>[] = [];
|
||||
public terminateAll(): Promise<ITaskTerminateResponse[]> {
|
||||
let promises: Promise<ITaskTerminateResponse>[] = [];
|
||||
Object.keys(this.activeTasks).forEach((key) => {
|
||||
let terminalData = this.activeTasks[key];
|
||||
let terminal = terminalData.terminal;
|
||||
promises.push(new Promise<TaskTerminateResponse>((resolve, reject) => {
|
||||
promises.push(new Promise<ITaskTerminateResponse>((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<TaskTerminateResponse>(promises);
|
||||
return Promise.all<ITaskTerminateResponse>(promises);
|
||||
}
|
||||
|
||||
|
||||
|
@ -571,7 +571,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
|||
});
|
||||
}
|
||||
|
||||
private async getDependencyPromise(task: ActiveTerminalData): Promise<ITaskSummary> {
|
||||
private async getDependencyPromise(task: IActiveTerminalData): Promise<ITaskSummary> {
|
||||
if (!task.task.configurationProperties.isBackground) {
|
||||
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<string> {
|
||||
private async resolveAndFindExecutable(systemInfo: ITaskSystemInfo | undefined, workspaceFolder: IWorkspaceFolder | undefined, task: CustomTask | ContributedTask, cwd: string | undefined, envPath: string | undefined): Promise<string> {
|
||||
const command = await this.configurationResolverService.resolveAsync(workspaceFolder, CommandString.value(task.command.name!));
|
||||
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<string>, alreadyResolved: Map<string, string>): Promise<ResolvedVariables | undefined> {
|
||||
private async acquireInput(taskSystemInfo: ITaskSystemInfo | undefined, workspaceFolder: IWorkspaceFolder | undefined, task: CustomTask | ContributedTask, variables: Set<string>, alreadyResolved: Map<string, string>): Promise<IResolvedVariables | undefined> {
|
||||
const resolved = await this.resolveVariablesFromSet(taskSystemInfo, workspaceFolder, task, variables, alreadyResolved);
|
||||
this.fireTaskEvent(TaskEvent.create(TaskEventKind.AcquiredInput, task));
|
||||
return resolved;
|
||||
}
|
||||
|
||||
private resolveVariablesFromSet(taskSystemInfo: TaskSystemInfo | undefined, workspaceFolder: IWorkspaceFolder | undefined, task: CustomTask | ContributedTask, variables: Set<string>, alreadyResolved: Map<string, string>): Promise<ResolvedVariables | undefined> {
|
||||
private resolveVariablesFromSet(taskSystemInfo: ITaskSystemInfo | undefined, workspaceFolder: IWorkspaceFolder | undefined, task: CustomTask | ContributedTask, variables: Set<string>, alreadyResolved: Map<string, string>): Promise<IResolvedVariables | undefined> {
|
||||
let isProcess = task.command && task.command.runtime === RuntimeType.Process;
|
||||
let 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<ResolvedVariables | undefined>;
|
||||
let resolvedVariables: Promise<IResolvedVariables | undefined>;
|
||||
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<string>();
|
||||
unresolved.forEach(variable => variablesArray.push(variable));
|
||||
|
||||
return new Promise<ResolvedVariables | undefined>((resolve, reject) => {
|
||||
return new Promise<IResolvedVariables | undefined>((resolve, reject) => {
|
||||
this.configurationResolverService.resolveWithInteraction(workspaceFolder, variablesArray, 'tasks', undefined, TaskSourceKind.toConfigurationTarget(task._source.kind)).then(async (resolvedVariablesMap: Map<string, string> | undefined) => {
|
||||
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<string>();
|
||||
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<string>, command: CommandConfiguration, task: CustomTask | ContributedTask): void {
|
||||
private collectCommandVariables(variables: Set<string>, command: ICommandConfiguration, task: CustomTask | ContributedTask): void {
|
||||
// The custom execution should have everything it needs already as it provided
|
||||
// the 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 = (<ExtensionTaskSource>task._source).scope;
|
||||
const scope = (<IExtensionTaskSource>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) {
|
||||
|
|
|
@ -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<string, Map<string, number>>;
|
||||
|
||||
protected _onDidStateChange: Emitter<ProblemCollectorEvent>;
|
||||
protected _onDidStateChange: Emitter<IProblemCollectorEvent>;
|
||||
|
||||
constructor(public readonly problemMatchers: ProblemMatcher[], protected markerService: IMarkerService, protected modelService: IModelService, fileService?: IFileService) {
|
||||
this.matchers = Object.create(null);
|
||||
|
@ -101,7 +101,7 @@ export abstract class AbstractProblemCollector implements IDisposable {
|
|||
this._onDidStateChange = new Emitter();
|
||||
}
|
||||
|
||||
public get onDidStateChange(): Event<ProblemCollectorEvent> {
|
||||
public get onDidStateChange(): Event<IProblemCollectorEvent> {
|
||||
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<boolean> {
|
||||
protected async shouldApplyMatch(result: IProblemMatch): Promise<boolean> {
|
||||
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<string>;
|
||||
|
@ -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;
|
||||
|
|
|
@ -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((<NamedProblemMatcher>value).name) ? true : false;
|
||||
export function isNamedProblemMatcher(value: ProblemMatcher | undefined): value is INamedProblemMatcher {
|
||||
return value && Types.isString((<INamedProblemMatcher>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<URI>;
|
||||
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 = <ProblemPattern>matcher.pattern;
|
||||
this.pattern = <IProblemPattern>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 = <ProblemPattern[]>matcher.pattern;
|
||||
this.patterns = <IProblemPattern[]>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<string | ProblemMatcher>;
|
||||
|
||||
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((<NamedProblemMatcher>value).name);
|
||||
export function isNamedProblemMatcher(value: ProblemMatcher): value is INamedProblemMatcher {
|
||||
return Types.isString((<INamedProblemMatcher>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<ProblemPattern> = {
|
||||
let defaultValue: Partial<IProblemPattern> = {
|
||||
file: 1,
|
||||
message: 0
|
||||
};
|
||||
result = Objects.mixin(result, defaultValue, false);
|
||||
} else {
|
||||
let defaultValue: Partial<ProblemPattern> = {
|
||||
let defaultValue: Partial<IProblemPattern> = {
|
||||
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<Config.
|
|||
export interface IProblemPatternRegistry {
|
||||
onReady(): Promise<void>;
|
||||
|
||||
get(key: string): ProblemPattern | MultiLineProblemPattern;
|
||||
get(key: string): IProblemPattern | MultiLineProblemPattern;
|
||||
}
|
||||
|
||||
class ProblemPatternRegistryImpl implements IProblemPatternRegistry {
|
||||
|
||||
private patterns: IStringDictionary<ProblemPattern | ProblemPattern[]>;
|
||||
private patterns: IStringDictionary<IProblemPattern | IProblemPattern[]>;
|
||||
private readyPromise: Promise<void>;
|
||||
|
||||
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 = <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<Config.NamedProblemMatcher[]>({
|
||||
const problemMatchersExtPoint = ExtensionsRegistry.registerExtensionPoint<Config.INamedProblemMatcher[]>({
|
||||
extensionPoint: 'problemMatchers',
|
||||
deps: [problemPatternExtPoint],
|
||||
jsonSchema: {
|
||||
|
@ -1715,14 +1715,14 @@ const problemMatchersExtPoint = ExtensionsRegistry.registerExtensionPoint<Config
|
|||
|
||||
export interface IProblemMatcherRegistry {
|
||||
onReady(): Promise<void>;
|
||||
get(name: string): NamedProblemMatcher;
|
||||
get(name: string): INamedProblemMatcher;
|
||||
keys(): string[];
|
||||
readonly onMatcherChanged: Event<void>;
|
||||
}
|
||||
|
||||
class ProblemMatcherRegistryImpl implements IProblemMatcherRegistry {
|
||||
|
||||
private matchers: IStringDictionary<NamedProblemMatcher>;
|
||||
private matchers: IStringDictionary<INamedProblemMatcher>;
|
||||
private readyPromise: Promise<void>;
|
||||
private readonly _onMatchersChanged: Emitter<void> = new Emitter<void>();
|
||||
public readonly onMatcherChanged: Event<void> = 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];
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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<Configuration.TaskDefinition[]>({
|
||||
const taskDefinitionsExtPoint = ExtensionsRegistry.registerExtensionPoint<Configuration.ITaskDefinition[]>({
|
||||
extensionPoint: 'taskDefinitions',
|
||||
jsonSchema: {
|
||||
description: nls.localize('TaskDefinitionExtPoint', 'Contributes task kinds'),
|
||||
|
@ -93,15 +93,15 @@ const taskDefinitionsExtPoint = ExtensionsRegistry.registerExtensionPoint<Config
|
|||
export interface ITaskDefinitionRegistry {
|
||||
onReady(): Promise<void>;
|
||||
|
||||
get(key: string): Tasks.TaskDefinition;
|
||||
all(): Tasks.TaskDefinition[];
|
||||
get(key: string): Tasks.ITaskDefinition;
|
||||
all(): Tasks.ITaskDefinition[];
|
||||
getJsonSchema(): IJSONSchema;
|
||||
onDefinitionsChanged: Event<void>;
|
||||
}
|
||||
|
||||
export class TaskDefinitionRegistryImpl implements ITaskDefinitionRegistry {
|
||||
|
||||
private taskTypes: IStringDictionary<Tasks.TaskDefinition>;
|
||||
private taskTypes: IStringDictionary<Tasks.ITaskDefinition>;
|
||||
private readyPromise: Promise<void>;
|
||||
private _schema: IJSONSchema | undefined;
|
||||
private _onDefinitionsChanged: Emitter<void> = 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]);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<boolean>('customExecutionSupported', true, nls.localize('tasks.customExecutionSupported', "Whether CustomExecution tasks are supported. Consider using in the when clause of a \'taskDefinition\' contribution."));
|
||||
export const ShellExecutionSupportedContext = new RawContextKey<boolean>('shellExecutionSupported', false, nls.localize('tasks.shellExecutionSupported', "Whether ShellExecution tasks are supported. Consider using in the when clause of a \'taskDefinition\' contribution."));
|
||||
|
@ -24,57 +24,57 @@ export const ProcessExecutionSupportedContext = new RawContextKey<boolean>('proc
|
|||
export const ITaskService = createDecorator<ITaskService>('taskService');
|
||||
|
||||
export interface ITaskProvider {
|
||||
provideTasks(validTypes: IStringDictionary<boolean>): Promise<TaskSet>;
|
||||
provideTasks(validTypes: IStringDictionary<boolean>): Promise<ITaskSet>;
|
||||
resolveTask(task: ConfiguringTask): Promise<ContributedTask | undefined>;
|
||||
}
|
||||
|
||||
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<ConfiguringTask>;
|
||||
} | undefined;
|
||||
hasErrors: boolean;
|
||||
}
|
||||
|
||||
export interface WorkspaceFolderTaskResult extends WorkspaceTaskResult {
|
||||
export interface IWorkspaceFolderTaskResult extends IWorkspaceTaskResult {
|
||||
workspaceFolder: IWorkspaceFolder;
|
||||
}
|
||||
|
||||
export interface ITaskService {
|
||||
readonly _serviceBrand: undefined;
|
||||
onDidStateChange: Event<TaskEvent>;
|
||||
onDidStateChange: Event<ITaskEvent>;
|
||||
supportsMultipleTaskExecutions: boolean;
|
||||
|
||||
configureAction(): Action;
|
||||
run(task: Task | undefined, options?: ProblemMatcherRunOptions): Promise<ITaskSummary | undefined>;
|
||||
run(task: Task | undefined, options?: IProblemMatcherRunOptions): Promise<ITaskSummary | undefined>;
|
||||
inTerminal(): boolean;
|
||||
getActiveTasks(): Promise<Task[]>;
|
||||
getBusyTasks(): Promise<Task[]>;
|
||||
terminate(task: Task): Promise<TaskTerminateResponse>;
|
||||
tasks(filter?: TaskFilter): Promise<Task[]>;
|
||||
terminate(task: Task): Promise<ITaskTerminateResponse>;
|
||||
tasks(filter?: ITaskFilter): Promise<Task[]>;
|
||||
taskTypes(): string[];
|
||||
getWorkspaceTasks(runSource?: TaskRunSource): Promise<Map<string, WorkspaceFolderTaskResult>>;
|
||||
getWorkspaceTasks(runSource?: TaskRunSource): Promise<Map<string, IWorkspaceFolderTaskResult>>;
|
||||
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<Task | undefined>;
|
||||
getTask(workspaceFolder: IWorkspace | IWorkspaceFolder | string, alias: string | ITaskIdentifier, compareId?: boolean): Promise<Task | undefined>;
|
||||
tryResolveTask(configuringTask: ConfiguringTask): Promise<Task | undefined>;
|
||||
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<void>;
|
||||
readonly hasTaskSystemInfo: boolean;
|
||||
registerSupportedExecutions(custom?: boolean, shell?: boolean, process?: boolean): void;
|
||||
|
|
|
@ -9,7 +9,7 @@ import { TerminateResponse } from 'vs/base/common/processes';
|
|||
import { Event } from 'vs/base/common/event';
|
||||
import { 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<Task | undefined>;
|
||||
}
|
||||
|
||||
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<string>;
|
||||
}
|
||||
|
||||
export interface ResolvedVariables {
|
||||
export interface IResolvedVariables {
|
||||
process?: string;
|
||||
variables: Map<string, string>;
|
||||
}
|
||||
|
||||
export interface TaskSystemInfo {
|
||||
export interface ITaskSystemInfo {
|
||||
platform: Platform;
|
||||
context: any;
|
||||
uriProvider: (this: void, path: string) => URI;
|
||||
resolveVariables(workspaceFolder: IWorkspaceFolder, toResolve: ResolveSet, target: ConfigurationTarget): Promise<ResolvedVariables | undefined>;
|
||||
resolveVariables(workspaceFolder: IWorkspaceFolder, toResolve: IResolveSet, target: ConfigurationTarget): Promise<IResolvedVariables | undefined>;
|
||||
findExecutable(command: string, cwd?: string, paths?: string[]): Promise<string | undefined>;
|
||||
}
|
||||
|
||||
export interface TaskSystemInfoResolver {
|
||||
(workspaceFolder: IWorkspaceFolder | undefined): TaskSystemInfo | undefined;
|
||||
export interface ITaskSystemInfoResolver {
|
||||
(workspaceFolder: IWorkspaceFolder | undefined): ITaskSystemInfo | undefined;
|
||||
}
|
||||
|
||||
export interface ITaskSystem {
|
||||
onDidStateChange: Event<TaskEvent>;
|
||||
onDidStateChange: Event<ITaskEvent>;
|
||||
run(task: Task, resolver: ITaskResolver): ITaskExecuteResult;
|
||||
rerun(): ITaskExecuteResult | undefined;
|
||||
isActive(): Promise<boolean>;
|
||||
|
@ -109,8 +109,8 @@ export interface ITaskSystem {
|
|||
getLastInstance(task: Task): Task | undefined;
|
||||
getBusyTasks(): Task[];
|
||||
canAutoTerminate(): boolean;
|
||||
terminate(task: Task): Promise<TaskTerminateResponse>;
|
||||
terminateAll(): Promise<TaskTerminateResponse[]>;
|
||||
terminate(task: Task): Promise<ITaskTerminateResponse>;
|
||||
terminateAll(): Promise<ITaskTerminateResponse[]>;
|
||||
revealTask(task: Task): boolean;
|
||||
customExecutionComplete(task: Task, result: number): Promise<void>;
|
||||
isTaskVisible(task: Task): boolean;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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: <any>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<string, string>): 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<string, string>): TaskEvent {
|
||||
export function create(kind: TaskEventKind.ProcessStarted | TaskEventKind.ProcessEnded, task: Task, processIdOrExitCode?: number): ITaskEvent;
|
||||
export function create(kind: TaskEventKind.Start, task: Task, terminalId?: number, resolvedVariables?: Map<string, string>): 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<string, string>): 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
|
||||
|
|
|
@ -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<WorkspaceFolderConfigurationResult> {
|
||||
protected computeLegacyConfiguration(workspaceFolder: IWorkspaceFolder): Promise<IWorkspaceFolderConfigurationResult> {
|
||||
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;
|
||||
|
||||
|
|
|
@ -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<ITaskService> {
|
||||
private readonly _onDidStateChange: Emitter<TaskEvent> = new Emitter();
|
||||
public get onDidStateChange(): Event<TaskEvent> {
|
||||
private readonly _onDidStateChange: Emitter<ITaskEvent> = new Emitter();
|
||||
public get onDidStateChange(): Event<ITaskEvent> {
|
||||
return this._onDidStateChange.event;
|
||||
}
|
||||
public triggerStateChange(event: TaskEvent): void {
|
||||
public triggerStateChange(event: ITaskEvent): void {
|
||||
this._onDidStateChange.fire(event);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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'
|
||||
};
|
||||
|
|
|
@ -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 = <ProblemPattern[]>actual;
|
||||
let expecteds = <ProblemPattern[]>expected;
|
||||
let actuals = <IProblemPattern[]>actual;
|
||||
let expecteds = <IProblemPattern[]>expected;
|
||||
assert.strictEqual(actuals.length, expecteds.length);
|
||||
for (let i = 0; i < actuals.length; i++) {
|
||||
assertProblemPattern(actuals[i], expecteds[i]);
|
||||
}
|
||||
} else {
|
||||
assertProblemPattern(<ProblemPattern>actual, <ProblemPattern>expected);
|
||||
assertProblemPattern(<IProblemPattern>actual, <IProblemPattern>expected);
|
||||
}
|
||||
}
|
||||
|
||||
function assertProblemPattern(actual: ProblemPattern, expected: ProblemPattern) {
|
||||
function assertProblemPattern(actual: IProblemPattern, expected: IProblemPattern) {
|
||||
assert.strictEqual(actual.regexp.toString(), expected.regexp.toString());
|
||||
assert.strictEqual(actual.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<ProblemMatcher> {
|
||||
}
|
||||
|
||||
class TestParseContext implements Partial<ParseContext> {
|
||||
class TestParseContext implements Partial<IParseContext> {
|
||||
}
|
||||
|
||||
class TestTaskDefinitionRegistry implements Partial<ITaskDefinitionRegistry> {
|
||||
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<CustomTask>[];
|
||||
configured?: Partial<TestConfiguringTask>[];
|
||||
custom?: Partial<ICustomTask>[];
|
||||
configured?: Partial<ITestConfiguringTask>[];
|
||||
}
|
||||
|
||||
interface TestConfiguringTask extends Partial<Tasks.ConfiguringTask> {
|
||||
interface ITestConfiguringTask extends Partial<Tasks.ConfiguringTask> {
|
||||
label: string;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue