提交 e0ce8810 编写于 作者: D Dirk Baeumer

First cut of #50416: Add support that FileSystemProviders can control the URI...

First cut of #50416: Add support that FileSystemProviders can control the URI of a generated problem marker
上级 8f3f91d1
...@@ -12,6 +12,7 @@ import URI from 'vs/base/common/uri'; ...@@ -12,6 +12,7 @@ import URI from 'vs/base/common/uri';
import * as Objects from 'vs/base/common/objects'; import * as Objects from 'vs/base/common/objects';
import { TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import * as Types from 'vs/base/common/types'; import * as Types from 'vs/base/common/types';
import * as Platform from 'vs/base/common/platform';
import { IWorkspaceContextService, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; import { IWorkspaceContextService, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
...@@ -21,12 +22,11 @@ import { ...@@ -21,12 +22,11 @@ import {
} from 'vs/workbench/parts/tasks/common/tasks'; } from 'vs/workbench/parts/tasks/common/tasks';
import { ITaskService, TaskFilter } from 'vs/workbench/parts/tasks/common/taskService'; import { ITaskService, TaskFilter } from 'vs/workbench/parts/tasks/common/taskService';
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers'; import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
import { ExtHostContext, MainThreadTaskShape, ExtHostTaskShape, MainContext, IExtHostContext } from 'vs/workbench/api/node/extHost.protocol'; import { ExtHostContext, MainThreadTaskShape, ExtHostTaskShape, MainContext, IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
import { import {
TaskDefinitionDTO, TaskExecutionDTO, ProcessExecutionOptionsDTO, TaskPresentationOptionsDTO, TaskDefinitionDTO, TaskExecutionDTO, ProcessExecutionOptionsDTO, TaskPresentationOptionsDTO,
ProcessExecutionDTO, ShellExecutionDTO, ShellExecutionOptionsDTO, TaskDTO, TaskSourceDTO, TaskHandleDTO, TaskFilterDTO, TaskProcessStartedDTO, TaskProcessEndedDTO ProcessExecutionDTO, ShellExecutionDTO, ShellExecutionOptionsDTO, TaskDTO, TaskSourceDTO, TaskHandleDTO, TaskFilterDTO, TaskProcessStartedDTO, TaskProcessEndedDTO, TaskSystemInfoDTO
} from 'vs/workbench/api/shared/tasks'; } from 'vs/workbench/api/shared/tasks';
export { TaskDTO, TaskHandleDTO, TaskExecutionDTO, TaskFilterDTO }; export { TaskDTO, TaskHandleDTO, TaskExecutionDTO, TaskFilterDTO };
...@@ -357,6 +357,7 @@ namespace TaskFilterDTO { ...@@ -357,6 +357,7 @@ namespace TaskFilterDTO {
@extHostNamedCustomer(MainContext.MainThreadTask) @extHostNamedCustomer(MainContext.MainThreadTask)
export class MainThreadTask implements MainThreadTaskShape { export class MainThreadTask implements MainThreadTaskShape {
private _extHostContext: IExtHostContext;
private _proxy: ExtHostTaskShape; private _proxy: ExtHostTaskShape;
private _activeHandles: { [handle: number]: boolean; }; private _activeHandles: { [handle: number]: boolean; };
...@@ -471,4 +472,26 @@ export class MainThreadTask implements MainThreadTaskShape { ...@@ -471,4 +472,26 @@ export class MainThreadTask implements MainThreadTaskShape {
}); });
}); });
} }
public $registerTaskSystem(key: string, info: TaskSystemInfoDTO): void {
let platform: Platform.Platform;
switch (info.platform) {
case 'win32':
platform = Platform.Platform.Windows;
break;
case 'darwin':
platform = Platform.Platform.Mac;
break;
case 'linux':
platform = Platform.Platform.Linux;
break;
default:
platform = Platform.platform;
}
this._taskService.registerTaskSystem(key, {
platform: platform,
fileSystemScheme: key,
context: this._extHostContext
});
}
} }
...@@ -48,7 +48,7 @@ import { CommentRule, CharacterPair, EnterAction } from 'vs/editor/common/modes/ ...@@ -48,7 +48,7 @@ import { CommentRule, CharacterPair, EnterAction } from 'vs/editor/common/modes/
import { ISingleEditOperation } from 'vs/editor/common/model'; import { ISingleEditOperation } from 'vs/editor/common/model';
import { IPatternInfo, IRawSearchQuery, IRawFileMatch2, ISearchCompleteStats } from 'vs/platform/search/common/search'; import { IPatternInfo, IRawSearchQuery, IRawFileMatch2, ISearchCompleteStats } from 'vs/platform/search/common/search';
import { LogLevel } from 'vs/platform/log/common/log'; import { LogLevel } from 'vs/platform/log/common/log';
import { TaskExecutionDTO, TaskDTO, TaskHandleDTO, TaskFilterDTO, TaskProcessStartedDTO, TaskProcessEndedDTO } from 'vs/workbench/api/shared/tasks'; import { TaskExecutionDTO, TaskDTO, TaskHandleDTO, TaskFilterDTO, TaskProcessStartedDTO, TaskProcessEndedDTO, TaskSystemInfoDTO } from 'vs/workbench/api/shared/tasks';
export interface IEnvironment { export interface IEnvironment {
isExtensionDevelopmentDebug: boolean; isExtensionDevelopmentDebug: boolean;
...@@ -410,10 +410,11 @@ export interface MainThreadSearchShape extends IDisposable { ...@@ -410,10 +410,11 @@ export interface MainThreadSearchShape extends IDisposable {
export interface MainThreadTaskShape extends IDisposable { export interface MainThreadTaskShape extends IDisposable {
$registerTaskProvider(handle: number): TPromise<void>; $registerTaskProvider(handle: number): TPromise<void>;
$unregisterTaskProvider(handle: number): TPromise<void>;
$fetchTasks(filter?: TaskFilterDTO): TPromise<TaskDTO[]>; $fetchTasks(filter?: TaskFilterDTO): TPromise<TaskDTO[]>;
$executeTask(task: TaskHandleDTO | TaskDTO): TPromise<TaskExecutionDTO>; $executeTask(task: TaskHandleDTO | TaskDTO): TPromise<TaskExecutionDTO>;
$terminateTask(id: string): TPromise<void>; $terminateTask(id: string): TPromise<void>;
$unregisterTaskProvider(handle: number): TPromise<void>; $registerTaskSystem(scheme: string, info: TaskSystemInfoDTO): void;
} }
export interface MainThreadExtensionServiceShape extends IDisposable { export interface MainThreadExtensionServiceShape extends IDisposable {
......
...@@ -12,7 +12,7 @@ import { asWinJsPromise } from 'vs/base/common/async'; ...@@ -12,7 +12,7 @@ import { asWinJsPromise } from 'vs/base/common/async';
import { Event, Emitter } from 'vs/base/common/event'; import { Event, Emitter } from 'vs/base/common/event';
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions'; import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
import * as TaskSystem from 'vs/workbench/parts/tasks/common/tasks'; import * as tasks from 'vs/workbench/parts/tasks/common/tasks';
import { MainContext, MainThreadTaskShape, ExtHostTaskShape, IMainContext } from 'vs/workbench/api/node/extHost.protocol'; import { MainContext, MainThreadTaskShape, ExtHostTaskShape, IMainContext } from 'vs/workbench/api/node/extHost.protocol';
...@@ -21,7 +21,7 @@ import { ExtHostWorkspace } from 'vs/workbench/api/node/extHostWorkspace'; ...@@ -21,7 +21,7 @@ import { ExtHostWorkspace } from 'vs/workbench/api/node/extHostWorkspace';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import { import {
TaskDefinitionDTO, TaskExecutionDTO, TaskPresentationOptionsDTO, ProcessExecutionOptionsDTO, ProcessExecutionDTO, TaskDefinitionDTO, TaskExecutionDTO, TaskPresentationOptionsDTO, ProcessExecutionOptionsDTO, ProcessExecutionDTO,
ShellExecutionOptionsDTO, ShellExecutionDTO, TaskDTO, TaskHandleDTO, TaskFilterDTO, TaskProcessStartedDTO, TaskProcessEndedDTO ShellExecutionOptionsDTO, ShellExecutionDTO, TaskDTO, TaskHandleDTO, TaskFilterDTO, TaskProcessStartedDTO, TaskProcessEndedDTO, TaskSystemInfoDTO
} from '../shared/tasks'; } from '../shared/tasks';
export { TaskExecutionDTO }; export { TaskExecutionDTO };
...@@ -197,40 +197,40 @@ namespace ProblemMatcher { ...@@ -197,40 +197,40 @@ namespace ProblemMatcher {
*/ */
namespace TaskRevealKind { namespace TaskRevealKind {
export function from(value: vscode.TaskRevealKind): TaskSystem.RevealKind { export function from(value: vscode.TaskRevealKind): tasks.RevealKind {
if (value === void 0 || value === null) { if (value === void 0 || value === null) {
return TaskSystem.RevealKind.Always; return tasks.RevealKind.Always;
} }
switch (value) { switch (value) {
case types.TaskRevealKind.Silent: case types.TaskRevealKind.Silent:
return TaskSystem.RevealKind.Silent; return tasks.RevealKind.Silent;
case types.TaskRevealKind.Never: case types.TaskRevealKind.Never:
return TaskSystem.RevealKind.Never; return tasks.RevealKind.Never;
} }
return TaskSystem.RevealKind.Always; return tasks.RevealKind.Always;
} }
} }
namespace TaskPanelKind { namespace TaskPanelKind {
export function from(value: vscode.TaskPanelKind): TaskSystem.PanelKind { export function from(value: vscode.TaskPanelKind): tasks.PanelKind {
if (value === void 0 || value === null) { if (value === void 0 || value === null) {
return TaskSystem.PanelKind.Shared; return tasks.PanelKind.Shared;
} }
switch (value) { switch (value) {
case types.TaskPanelKind.Dedicated: case types.TaskPanelKind.Dedicated:
return TaskSystem.PanelKind.Dedicated; return tasks.PanelKind.Dedicated;
case types.TaskPanelKind.New: case types.TaskPanelKind.New:
return TaskSystem.PanelKind.New; return tasks.PanelKind.New;
default: default:
return TaskSystem.PanelKind.Shared; return tasks.PanelKind.Shared;
} }
} }
} }
namespace PresentationOptions { namespace PresentationOptions {
export function from(value: vscode.TaskPresentationOptions): TaskSystem.PresentationOptions { export function from(value: vscode.TaskPresentationOptions): tasks.PresentationOptions {
if (value === void 0 || value === null) { if (value === void 0 || value === null) {
return { reveal: TaskSystem.RevealKind.Always, echo: true, focus: false, panel: TaskSystem.PanelKind.Shared }; return { reveal: tasks.RevealKind.Always, echo: true, focus: false, panel: tasks.PanelKind.Shared };
} }
return { return {
reveal: TaskRevealKind.from(value.reveal), reveal: TaskRevealKind.from(value.reveal),
...@@ -259,11 +259,11 @@ namespace CommandOptions { ...@@ -259,11 +259,11 @@ namespace CommandOptions {
function isShellConfiguration(value: any): value is { executable: string; shellArgs?: string[] } { function isShellConfiguration(value: any): value is { executable: string; shellArgs?: string[] } {
return value && typeof value.executable === 'string'; return value && typeof value.executable === 'string';
} }
export function from(value: vscode.ShellExecutionOptions | vscode.ProcessExecutionOptions): TaskSystem.CommandOptions { export function from(value: vscode.ShellExecutionOptions | vscode.ProcessExecutionOptions): tasks.CommandOptions {
if (value === void 0 || value === null) { if (value === void 0 || value === null) {
return undefined; return undefined;
} }
let result: TaskSystem.CommandOptions = { let result: tasks.CommandOptions = {
}; };
if (typeof value.cwd === 'string') { if (typeof value.cwd === 'string') {
result.cwd = value.cwd; result.cwd = value.cwd;
...@@ -285,7 +285,7 @@ namespace CommandOptions { ...@@ -285,7 +285,7 @@ namespace CommandOptions {
} }
namespace ShellQuoteOptions { namespace ShellQuoteOptions {
export function from(value: vscode.ShellQuotingOptions): TaskSystem.ShellQuotingOptions { export function from(value: vscode.ShellQuotingOptions): tasks.ShellQuotingOptions {
if (value === void 0 || value === null) { if (value === void 0 || value === null) {
return undefined; return undefined;
} }
...@@ -298,12 +298,12 @@ namespace ShellQuoteOptions { ...@@ -298,12 +298,12 @@ namespace ShellQuoteOptions {
} }
namespace ShellConfiguration { namespace ShellConfiguration {
export function from(value: { executable?: string, shellArgs?: string[], quotes?: vscode.ShellQuotingOptions }): TaskSystem.ShellConfiguration { export function from(value: { executable?: string, shellArgs?: string[], quotes?: vscode.ShellQuotingOptions }): tasks.ShellConfiguration {
if (value === void 0 || value === null || !value.executable) { if (value === void 0 || value === null || !value.executable) {
return undefined; return undefined;
} }
let result: TaskSystem.ShellConfiguration = { let result: tasks.ShellConfiguration = {
executable: value.executable, executable: value.executable,
args: Strings.from(value.shellArgs), args: Strings.from(value.shellArgs),
quoting: ShellQuoteOptions.from(value.quotes) quoting: ShellQuoteOptions.from(value.quotes)
...@@ -313,7 +313,7 @@ namespace ShellConfiguration { ...@@ -313,7 +313,7 @@ namespace ShellConfiguration {
} }
namespace ShellString { namespace ShellString {
export function from(value: (string | vscode.ShellQuotedString)[]): TaskSystem.CommandString[] { export function from(value: (string | vscode.ShellQuotedString)[]): tasks.CommandString[] {
if (value === void 0 || value === null) { if (value === void 0 || value === null) {
return undefined; return undefined;
} }
...@@ -323,11 +323,11 @@ namespace ShellString { ...@@ -323,11 +323,11 @@ namespace ShellString {
namespace Tasks { namespace Tasks {
export function from(tasks: vscode.Task[], rootFolder: vscode.WorkspaceFolder, extension: IExtensionDescription): TaskSystem.ContributedTask[] { export function from(tasks: vscode.Task[], rootFolder: vscode.WorkspaceFolder, extension: IExtensionDescription): tasks.ContributedTask[] {
if (tasks === void 0 || tasks === null) { if (tasks === void 0 || tasks === null) {
return []; return [];
} }
let result: TaskSystem.ContributedTask[] = []; let result: tasks.ContributedTask[] = [];
for (let task of tasks) { for (let task of tasks) {
let converted = fromSingle(task, rootFolder, extension); let converted = fromSingle(task, rootFolder, extension);
if (converted) { if (converted) {
...@@ -337,11 +337,11 @@ namespace Tasks { ...@@ -337,11 +337,11 @@ namespace Tasks {
return result; return result;
} }
function fromSingle(task: vscode.Task, rootFolder: vscode.WorkspaceFolder, extension: IExtensionDescription): TaskSystem.ContributedTask { function fromSingle(task: vscode.Task, rootFolder: vscode.WorkspaceFolder, extension: IExtensionDescription): tasks.ContributedTask {
if (typeof task.name !== 'string') { if (typeof task.name !== 'string') {
return undefined; return undefined;
} }
let command: TaskSystem.CommandConfiguration; let command: tasks.CommandConfiguration;
let execution = task.execution; let execution = task.execution;
if (execution instanceof types.ProcessExecution) { if (execution instanceof types.ProcessExecution) {
command = getProcessCommand(execution); command = getProcessCommand(execution);
...@@ -357,21 +357,21 @@ namespace Tasks { ...@@ -357,21 +357,21 @@ namespace Tasks {
let taskScope: types.TaskScope.Global | types.TaskScope.Workspace | vscode.WorkspaceFolder | undefined = task.scope; let taskScope: types.TaskScope.Global | types.TaskScope.Workspace | vscode.WorkspaceFolder | undefined = task.scope;
let workspaceFolder: vscode.WorkspaceFolder | undefined; let workspaceFolder: vscode.WorkspaceFolder | undefined;
let scope: TaskSystem.TaskScope; let scope: tasks.TaskScope;
// For backwards compatibility // For backwards compatibility
if (taskScope === void 0) { if (taskScope === void 0) {
scope = TaskSystem.TaskScope.Folder; scope = tasks.TaskScope.Folder;
workspaceFolder = rootFolder; workspaceFolder = rootFolder;
} else if (taskScope === types.TaskScope.Global) { } else if (taskScope === types.TaskScope.Global) {
scope = TaskSystem.TaskScope.Global; scope = tasks.TaskScope.Global;
} else if (taskScope === types.TaskScope.Workspace) { } else if (taskScope === types.TaskScope.Workspace) {
scope = TaskSystem.TaskScope.Workspace; scope = tasks.TaskScope.Workspace;
} else { } else {
scope = TaskSystem.TaskScope.Folder; scope = tasks.TaskScope.Folder;
workspaceFolder = taskScope; workspaceFolder = taskScope;
} }
let source: TaskSystem.ExtensionTaskSource = { let source: tasks.ExtensionTaskSource = {
kind: TaskSystem.TaskSourceKind.Extension, kind: tasks.TaskSourceKind.Extension,
label: typeof task.source === 'string' ? task.source : extension.name, label: typeof task.source === 'string' ? task.source : extension.name,
extension: extension.id, extension: extension.id,
scope: scope, scope: scope,
...@@ -380,17 +380,17 @@ namespace Tasks { ...@@ -380,17 +380,17 @@ namespace Tasks {
// We can't transfer a workspace folder object from the extension host to main since they differ // We can't transfer a workspace folder object from the extension host to main since they differ
// in shape and we don't have backwards converting function. So transfer the URI and resolve the // in shape and we don't have backwards converting function. So transfer the URI and resolve the
// workspace folder on the main side. // workspace folder on the main side.
(source as any as TaskSystem.ExtensionTaskSourceTransfer).__workspaceFolder = workspaceFolder ? workspaceFolder.uri as URI : undefined; (source as any as tasks.ExtensionTaskSourceTransfer).__workspaceFolder = workspaceFolder ? workspaceFolder.uri as URI : undefined;
let label = nls.localize('task.label', '{0}: {1}', source.label, task.name); let label = nls.localize('task.label', '{0}: {1}', source.label, task.name);
let key = (task as types.Task).definitionKey; let key = (task as types.Task).definitionKey;
let kind = (task as types.Task).definition; let kind = (task as types.Task).definition;
let id = `${extension.id}.${key}`; let id = `${extension.id}.${key}`;
let taskKind: TaskSystem.TaskIdentifier = { let taskKind: tasks.TaskIdentifier = {
_key: key, _key: key,
type: kind.type type: kind.type
}; };
Objects.assign(taskKind, kind); Objects.assign(taskKind, kind);
let result: TaskSystem.ContributedTask = { let result: tasks.ContributedTask = {
_id: id, // uuidMap.getUUID(identifier), _id: id, // uuidMap.getUUID(identifier),
_source: source, _source: source,
_label: label, _label: label,
...@@ -407,14 +407,14 @@ namespace Tasks { ...@@ -407,14 +407,14 @@ namespace Tasks {
return result; return result;
} }
function getProcessCommand(value: vscode.ProcessExecution): TaskSystem.CommandConfiguration { function getProcessCommand(value: vscode.ProcessExecution): tasks.CommandConfiguration {
if (typeof value.process !== 'string') { if (typeof value.process !== 'string') {
return undefined; return undefined;
} }
let result: TaskSystem.CommandConfiguration = { let result: tasks.CommandConfiguration = {
name: value.process, name: value.process,
args: Strings.from(value.args), args: Strings.from(value.args),
runtime: TaskSystem.RuntimeType.Process, runtime: tasks.RuntimeType.Process,
suppressTaskName: true, suppressTaskName: true,
presentation: undefined presentation: undefined
}; };
...@@ -424,15 +424,15 @@ namespace Tasks { ...@@ -424,15 +424,15 @@ namespace Tasks {
return result; return result;
} }
function getShellCommand(value: vscode.ShellExecution): TaskSystem.CommandConfiguration { function getShellCommand(value: vscode.ShellExecution): tasks.CommandConfiguration {
if (value.args) { if (value.args) {
if (typeof value.command !== 'string' && typeof value.command.value !== 'string') { if (typeof value.command !== 'string' && typeof value.command.value !== 'string') {
return undefined; return undefined;
} }
let result: TaskSystem.CommandConfiguration = { let result: tasks.CommandConfiguration = {
name: value.command, name: value.command,
args: ShellString.from(value.args), args: ShellString.from(value.args),
runtime: TaskSystem.RuntimeType.Shell, runtime: tasks.RuntimeType.Shell,
presentation: undefined presentation: undefined
}; };
if (value.options) { if (value.options) {
...@@ -443,9 +443,9 @@ namespace Tasks { ...@@ -443,9 +443,9 @@ namespace Tasks {
if (typeof value.commandLine !== 'string') { if (typeof value.commandLine !== 'string') {
return undefined; return undefined;
} }
let result: TaskSystem.CommandConfiguration = { let result: tasks.CommandConfiguration = {
name: value.commandLine, name: value.commandLine,
runtime: TaskSystem.RuntimeType.Shell, runtime: tasks.RuntimeType.Shell,
presentation: undefined presentation: undefined
}; };
if (value.options) { if (value.options) {
...@@ -728,7 +728,7 @@ interface HandlerData { ...@@ -728,7 +728,7 @@ interface HandlerData {
export class ExtHostTask implements ExtHostTaskShape { export class ExtHostTask implements ExtHostTaskShape {
private _proxy: MainThreadTaskShape; private _proxy: MainThreadTaskShape;
private _extHostWorkspace: ExtHostWorkspace; private _workspaceService: ExtHostWorkspace;
private _handleCounter: number; private _handleCounter: number;
private _handlers: Map<number, HandlerData>; private _handlers: Map<number, HandlerData>;
private _taskExecutions: Map<string, TaskExecutionImpl>; private _taskExecutions: Map<string, TaskExecutionImpl>;
...@@ -739,16 +739,16 @@ export class ExtHostTask implements ExtHostTaskShape { ...@@ -739,16 +739,16 @@ export class ExtHostTask implements ExtHostTaskShape {
private readonly _onDidTaskProcessStarted: Emitter<vscode.TaskProcessStartEvent> = new Emitter<vscode.TaskProcessStartEvent>(); private readonly _onDidTaskProcessStarted: Emitter<vscode.TaskProcessStartEvent> = new Emitter<vscode.TaskProcessStartEvent>();
private readonly _onDidTaskProcessEnded: Emitter<vscode.TaskProcessEndEvent> = new Emitter<vscode.TaskProcessEndEvent>(); private readonly _onDidTaskProcessEnded: Emitter<vscode.TaskProcessEndEvent> = new Emitter<vscode.TaskProcessEndEvent>();
constructor(mainContext: IMainContext, extHostWorkspace: ExtHostWorkspace) { constructor(mainContext: IMainContext, workspaceService: ExtHostWorkspace) {
this._proxy = mainContext.getProxy(MainContext.MainThreadTask); this._proxy = mainContext.getProxy(MainContext.MainThreadTask);
this._extHostWorkspace = extHostWorkspace; this._workspaceService = workspaceService;
this._handleCounter = 0; this._handleCounter = 0;
this._handlers = new Map<number, HandlerData>(); this._handlers = new Map<number, HandlerData>();
this._taskExecutions = new Map<string, TaskExecutionImpl>(); this._taskExecutions = new Map<string, TaskExecutionImpl>();
} }
public get extHostWorkspace(): ExtHostWorkspace { public get extHostWorkspace(): ExtHostWorkspace {
return this._extHostWorkspace; return this._workspaceService;
} }
public registerTaskProvider(extension: IExtensionDescription, provider: vscode.TaskProvider): vscode.Disposable { public registerTaskProvider(extension: IExtensionDescription, provider: vscode.TaskProvider): vscode.Disposable {
...@@ -764,11 +764,15 @@ export class ExtHostTask implements ExtHostTaskShape { ...@@ -764,11 +764,15 @@ export class ExtHostTask implements ExtHostTaskShape {
}); });
} }
public registerTaskSystem(scheme: string, info: TaskSystemInfoDTO): void {
this._proxy.$registerTaskSystem(scheme, info);
}
public fetchTasks(filter?: vscode.TaskFilter): Thenable<vscode.Task[]> { public fetchTasks(filter?: vscode.TaskFilter): Thenable<vscode.Task[]> {
return this._proxy.$fetchTasks(TaskFilterDTO.from(filter)).then((values) => { return this._proxy.$fetchTasks(TaskFilterDTO.from(filter)).then((values) => {
let result: vscode.Task[] = []; let result: vscode.Task[] = [];
for (let value of values) { for (let value of values) {
let task = TaskDTO.to(value, this._extHostWorkspace); let task = TaskDTO.to(value, this._workspaceService);
if (task) { if (task) {
result.push(task); result.push(task);
} }
...@@ -854,13 +858,13 @@ export class ExtHostTask implements ExtHostTaskShape { ...@@ -854,13 +858,13 @@ export class ExtHostTask implements ExtHostTaskShape {
} }
} }
public $provideTasks(handle: number): TPromise<TaskSystem.TaskSet> { public $provideTasks(handle: number): TPromise<tasks.TaskSet> {
let handler = this._handlers.get(handle); let handler = this._handlers.get(handle);
if (!handler) { if (!handler) {
return TPromise.wrapError<TaskSystem.TaskSet>(new Error('no handler found')); return TPromise.wrapError<tasks.TaskSet>(new Error('no handler found'));
} }
return asWinJsPromise(token => handler.provider.provideTasks(token)).then(value => { return asWinJsPromise(token => handler.provider.provideTasks(token)).then(value => {
let workspaceFolders = this._extHostWorkspace.getWorkspaceFolders(); let workspaceFolders = this._workspaceService.getWorkspaceFolders();
return { return {
tasks: Tasks.from(value, workspaceFolders && workspaceFolders.length > 0 ? workspaceFolders[0] : undefined, handler.extension), tasks: Tasks.from(value, workspaceFolders && workspaceFolders.length > 0 ? workspaceFolders[0] : undefined, handler.extension),
extension: handler.extension extension: handler.extension
...@@ -881,7 +885,7 @@ export class ExtHostTask implements ExtHostTaskShape { ...@@ -881,7 +885,7 @@ export class ExtHostTask implements ExtHostTaskShape {
if (result) { if (result) {
return result; return result;
} }
result = new TaskExecutionImpl(this, execution.id, task ? task : TaskDTO.to(execution.task, this._extHostWorkspace)); result = new TaskExecutionImpl(this, execution.id, task ? task : TaskDTO.to(execution.task, this._workspaceService));
this._taskExecutions.set(execution.id, result); this._taskExecutions.set(execution.id, result);
return result; return result;
} }
......
...@@ -102,4 +102,8 @@ export interface TaskProcessEndedDTO { ...@@ -102,4 +102,8 @@ export interface TaskProcessEndedDTO {
export interface TaskFilterDTO { export interface TaskFilterDTO {
version?: string; version?: string;
type?: string; type?: string;
}
export interface TaskSystemInfoDTO {
platform: string;
} }
\ No newline at end of file
...@@ -134,6 +134,7 @@ export interface ProblemMatcher { ...@@ -134,6 +134,7 @@ export interface ProblemMatcher {
pattern: ProblemPattern | ProblemPattern[]; pattern: ProblemPattern | ProblemPattern[];
severity?: Severity; severity?: Severity;
watching?: WatchingMatcher; watching?: WatchingMatcher;
fileSystemScheme?: string;
} }
export interface NamedProblemMatcher extends ProblemMatcher { export interface NamedProblemMatcher extends ProblemMatcher {
...@@ -195,7 +196,11 @@ export function getResource(filename: string, matcher: ProblemMatcher): URI { ...@@ -195,7 +196,11 @@ export function getResource(filename: string, matcher: ProblemMatcher): URI {
if (fullPath[0] !== '/') { if (fullPath[0] !== '/') {
fullPath = '/' + fullPath; fullPath = '/' + fullPath;
} }
return URI.parse('file://' + fullPath); if (matcher.fileSystemScheme !== void 0) {
return URI.parse(`${matcher.fileSystemScheme}://${fullPath}`);
} else {
return URI.file(fullPath);
}
} }
export interface ILineMatcher { export interface ILineMatcher {
......
...@@ -12,7 +12,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation' ...@@ -12,7 +12,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { Task, ContributedTask, CustomTask, TaskSet, TaskSorter, TaskEvent } from 'vs/workbench/parts/tasks/common/tasks'; import { Task, ContributedTask, CustomTask, TaskSet, TaskSorter, TaskEvent } from 'vs/workbench/parts/tasks/common/tasks';
import { ITaskSummary, TaskTerminateResponse } from 'vs/workbench/parts/tasks/common/taskSystem'; import { ITaskSummary, TaskTerminateResponse, TaskSystemInfo } from 'vs/workbench/parts/tasks/common/taskSystem';
export { ITaskSummary, Task, TaskTerminateResponse }; export { ITaskSummary, Task, TaskTerminateResponse };
...@@ -66,4 +66,6 @@ export interface ITaskService { ...@@ -66,4 +66,6 @@ export interface ITaskService {
registerTaskProvider(handle: number, taskProvider: ITaskProvider): void; registerTaskProvider(handle: number, taskProvider: ITaskProvider): void;
unregisterTaskProvider(handle: number): boolean; unregisterTaskProvider(handle: number): boolean;
registerTaskSystem(scheme: string, taskSystemInfo: TaskSystemInfo): void;
} }
\ No newline at end of file
...@@ -8,6 +8,7 @@ import Severity from 'vs/base/common/severity'; ...@@ -8,6 +8,7 @@ import Severity from 'vs/base/common/severity';
import { TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import { TerminateResponse } from 'vs/base/common/processes'; import { TerminateResponse } from 'vs/base/common/processes';
import { Event } from 'vs/base/common/event'; import { Event } from 'vs/base/common/event';
import { Platform } from 'vs/base/common/platform';
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
...@@ -101,6 +102,16 @@ export interface TaskTerminateResponse extends TerminateResponse { ...@@ -101,6 +102,16 @@ export interface TaskTerminateResponse extends TerminateResponse {
task: Task | undefined; task: Task | undefined;
} }
export interface TaskSystemInfo {
fileSystemScheme: string;
platform: Platform;
context: any;
}
export interface TaskSystemInfoResovler {
(workspaceFolder: IWorkspaceFolder): TaskSystemInfo;
}
export interface ITaskSystem { export interface ITaskSystem {
onDidStateChange: Event<TaskEvent>; onDidStateChange: Event<TaskEvent>;
run(task: Task, resolver: ITaskResolver): ITaskExecuteResult; run(task: Task, resolver: ITaskResolver): ITaskExecuteResult;
......
...@@ -25,6 +25,7 @@ import { TerminateResponseCode } from 'vs/base/common/processes'; ...@@ -25,6 +25,7 @@ import { TerminateResponseCode } from 'vs/base/common/processes';
import * as strings from 'vs/base/common/strings'; import * as strings from 'vs/base/common/strings';
import { ValidationStatus, ValidationState } from 'vs/base/common/parsers'; import { ValidationStatus, ValidationState } from 'vs/base/common/parsers';
import * as UUID from 'vs/base/common/uuid'; import * as UUID from 'vs/base/common/uuid';
import * as Platform from 'vs/base/common/platform';
import { LinkedMap, Touch } from 'vs/base/common/map'; import { LinkedMap, Touch } from 'vs/base/common/map';
import { OcticonLabel } from 'vs/base/browser/ui/octiconLabel/octiconLabel'; import { OcticonLabel } from 'vs/base/browser/ui/octiconLabel/octiconLabel';
...@@ -70,7 +71,7 @@ import { Scope, IActionBarRegistry, Extensions as ActionBarExtensions } from 'vs ...@@ -70,7 +71,7 @@ import { Scope, IActionBarRegistry, Extensions as ActionBarExtensions } from 'vs
import { ITerminalService } from 'vs/workbench/parts/terminal/common/terminal'; import { ITerminalService } from 'vs/workbench/parts/terminal/common/terminal';
import { ITaskSystem, ITaskResolver, ITaskSummary, TaskExecuteKind, TaskError, TaskErrors, TaskTerminateResponse } from 'vs/workbench/parts/tasks/common/taskSystem'; import { ITaskSystem, ITaskResolver, ITaskSummary, TaskExecuteKind, TaskError, TaskErrors, TaskTerminateResponse, TaskSystemInfo } from 'vs/workbench/parts/tasks/common/taskSystem';
import { import {
Task, CustomTask, ConfiguringTask, ContributedTask, InMemoryTask, TaskEvent, Task, CustomTask, ConfiguringTask, ContributedTask, InMemoryTask, TaskEvent,
TaskEventKind, TaskSet, TaskGroup, GroupType, ExecutionEngine, JsonSchemaVersion, TaskSourceKind, TaskEventKind, TaskSet, TaskGroup, GroupType, ExecutionEngine, JsonSchemaVersion, TaskSourceKind,
...@@ -442,12 +443,13 @@ class TaskService implements ITaskService { ...@@ -442,12 +443,13 @@ class TaskService implements ITaskService {
public static OutputChannelLabel: string = nls.localize('tasks', "Tasks"); public static OutputChannelLabel: string = nls.localize('tasks', "Tasks");
private _configHasErrors: boolean; private _configHasErrors: boolean;
private __schemaVersion: JsonSchemaVersion; private _schemaVersion: JsonSchemaVersion;
private __executionEngine: ExecutionEngine; private _executionEngine: ExecutionEngine;
private __workspaceFolders: IWorkspaceFolder[]; private _workspaceFolders: IWorkspaceFolder[];
private __ignoredWorkspaceFolders: IWorkspaceFolder[]; private _ignoredWorkspaceFolders: IWorkspaceFolder[];
private __showIgnoreMessage: boolean; private _showIgnoreMessage: boolean;
private _providers: Map<number, ITaskProvider>; private _providers: Map<number, ITaskProvider>;
private _taskSystemInfos: Map<string, TaskSystemInfo>;
private _workspaceTasksPromise: TPromise<Map<string, WorkspaceFolderTaskResult>>; private _workspaceTasksPromise: TPromise<Map<string, WorkspaceFolderTaskResult>>;
...@@ -486,6 +488,7 @@ class TaskService implements ITaskService { ...@@ -486,6 +488,7 @@ class TaskService implements ITaskService {
this._taskSystemListener = undefined; this._taskSystemListener = undefined;
this._outputChannel = this.outputService.getChannel(TaskService.OutputChannelId); this._outputChannel = this.outputService.getChannel(TaskService.OutputChannelId);
this._providers = new Map<number, ITaskProvider>(); this._providers = new Map<number, ITaskProvider>();
this._taskSystemInfos = new Map<string, TaskSystemInfo>();
this.configurationService.onDidChangeConfiguration(() => { this.configurationService.onDidChangeConfiguration(() => {
if (!this._taskSystem && !this._workspaceTasksPromise) { if (!this._taskSystem && !this._workspaceTasksPromise) {
return; return;
...@@ -584,62 +587,62 @@ class TaskService implements ITaskService { ...@@ -584,62 +587,62 @@ class TaskService implements ITaskService {
} }
private get workspaceFolders(): IWorkspaceFolder[] { private get workspaceFolders(): IWorkspaceFolder[] {
if (!this.__workspaceFolders) { if (!this._workspaceFolders) {
this.updateSetup(); this.updateSetup();
} }
return this.__workspaceFolders; return this._workspaceFolders;
} }
private get ignoredWorkspaceFolders(): IWorkspaceFolder[] { private get ignoredWorkspaceFolders(): IWorkspaceFolder[] {
if (!this.__ignoredWorkspaceFolders) { if (!this._ignoredWorkspaceFolders) {
this.updateSetup(); this.updateSetup();
} }
return this.__ignoredWorkspaceFolders; return this._ignoredWorkspaceFolders;
} }
private get executionEngine(): ExecutionEngine { private get executionEngine(): ExecutionEngine {
if (this.__executionEngine === void 0) { if (this._executionEngine === void 0) {
this.updateSetup(); this.updateSetup();
} }
return this.__executionEngine; return this._executionEngine;
} }
private get schemaVersion(): JsonSchemaVersion { private get schemaVersion(): JsonSchemaVersion {
if (this.__schemaVersion === void 0) { if (this._schemaVersion === void 0) {
this.updateSetup(); this.updateSetup();
} }
return this.__schemaVersion; return this._schemaVersion;
} }
private get showIgnoreMessage(): boolean { private get showIgnoreMessage(): boolean {
if (this.__showIgnoreMessage === void 0) { if (this._showIgnoreMessage === void 0) {
this.__showIgnoreMessage = !this.storageService.getBoolean(TaskService.IgnoreTask010DonotShowAgain_key, StorageScope.WORKSPACE, false); this._showIgnoreMessage = !this.storageService.getBoolean(TaskService.IgnoreTask010DonotShowAgain_key, StorageScope.WORKSPACE, false);
} }
return this.__showIgnoreMessage; return this._showIgnoreMessage;
} }
private updateSetup(setup?: [IWorkspaceFolder[], IWorkspaceFolder[], ExecutionEngine, JsonSchemaVersion]): void { private updateSetup(setup?: [IWorkspaceFolder[], IWorkspaceFolder[], ExecutionEngine, JsonSchemaVersion]): void {
if (!setup) { if (!setup) {
setup = this.computeWorkspaceFolderSetup(); setup = this.computeWorkspaceFolderSetup();
} }
this.__workspaceFolders = setup[0]; this._workspaceFolders = setup[0];
if (this.__ignoredWorkspaceFolders) { if (this._ignoredWorkspaceFolders) {
if (this.__ignoredWorkspaceFolders.length !== setup[1].length) { if (this._ignoredWorkspaceFolders.length !== setup[1].length) {
this.__showIgnoreMessage = undefined; this._showIgnoreMessage = undefined;
} else { } else {
let set: Set<string> = new Set(); let set: Set<string> = new Set();
this.__ignoredWorkspaceFolders.forEach(folder => set.add(folder.uri.toString())); this._ignoredWorkspaceFolders.forEach(folder => set.add(folder.uri.toString()));
for (let folder of setup[1]) { for (let folder of setup[1]) {
if (!set.has(folder.uri.toString())) { if (!set.has(folder.uri.toString())) {
this.__showIgnoreMessage = undefined; this._showIgnoreMessage = undefined;
break; break;
} }
} }
} }
} }
this.__ignoredWorkspaceFolders = setup[1]; this._ignoredWorkspaceFolders = setup[1];
this.__executionEngine = setup[2]; this._executionEngine = setup[2];
this.__schemaVersion = setup[3]; this._schemaVersion = setup[3];
} }
private showOutput(): void { private showOutput(): void {
...@@ -663,6 +666,10 @@ class TaskService implements ITaskService { ...@@ -663,6 +666,10 @@ class TaskService implements ITaskService {
return this._providers.delete(handle); return this._providers.delete(handle);
} }
public registerTaskSystem(key: string, info: TaskSystemInfo): void {
this._taskSystemInfos.set(key, info);
}
public getTask(folder: IWorkspaceFolder | string, alias: string, compareId: boolean = false): TPromise<Task> { public getTask(folder: IWorkspaceFolder | string, alias: string, compareId: boolean = false): TPromise<Task> {
let name = Types.isString(folder) ? folder : folder.name; let name = Types.isString(folder) ? folder : folder.name;
if (this.ignoredWorkspaceFolders.some(ignored => ignored.name === name)) { if (this.ignoredWorkspaceFolders.some(ignored => ignored.name === name)) {
...@@ -1244,7 +1251,13 @@ class TaskService implements ITaskService { ...@@ -1244,7 +1251,13 @@ class TaskService implements ITaskService {
this._taskSystem = new TerminalTaskSystem( this._taskSystem = new TerminalTaskSystem(
this.terminalService, this.outputService, this.markerService, this.terminalService, this.outputService, this.markerService,
this.modelService, this.configurationResolverService, this.telemetryService, this.modelService, this.configurationResolverService, this.telemetryService,
this.contextService, TaskService.OutputChannelId this.contextService, TaskService.OutputChannelId,
(workspaceFolder: IWorkspaceFolder) => {
if (!workspaceFolder) {
return undefined;
}
return this._taskSystemInfos.get(workspaceFolder.uri.scheme);
}
); );
} else { } else {
let system = new ProcessTaskSystem( let system = new ProcessTaskSystem(
...@@ -1472,8 +1485,9 @@ class TaskService implements ITaskService { ...@@ -1472,8 +1485,9 @@ class TaskService implements ITaskService {
return TPromise.as({ workspaceFolder, set: undefined, configurations: undefined, hasErrors: workspaceFolderConfiguration ? workspaceFolderConfiguration.hasErrors : false }); return TPromise.as({ workspaceFolder, set: undefined, configurations: undefined, hasErrors: workspaceFolderConfiguration ? workspaceFolderConfiguration.hasErrors : false });
} }
return ProblemMatcherRegistry.onReady().then((): WorkspaceFolderTaskResult => { return ProblemMatcherRegistry.onReady().then((): WorkspaceFolderTaskResult => {
let taskSystemInfo: TaskSystemInfo = this._taskSystemInfos.get(workspaceFolder.uri.scheme);
let problemReporter = new ProblemReporter(this._outputChannel); let problemReporter = new ProblemReporter(this._outputChannel);
let parseResult = TaskConfig.parse(workspaceFolder, workspaceFolderConfiguration.config, problemReporter); let parseResult = TaskConfig.parse(workspaceFolder, taskSystemInfo ? taskSystemInfo.platform : Platform.platform, workspaceFolderConfiguration.config, problemReporter);
let hasErrors = false; let hasErrors = false;
if (!parseResult.validationStatus.isOK()) { if (!parseResult.validationStatus.isOK()) {
hasErrors = true; hasErrors = true;
...@@ -1869,7 +1883,7 @@ class TaskService implements ITaskService { ...@@ -1869,7 +1883,7 @@ class TaskService implements ITaskService {
isSecondary: true, isSecondary: true,
run: () => { run: () => {
this.storageService.store(TaskService.IgnoreTask010DonotShowAgain_key, true, StorageScope.WORKSPACE); this.storageService.store(TaskService.IgnoreTask010DonotShowAgain_key, true, StorageScope.WORKSPACE);
this.__showIgnoreMessage = false; this._showIgnoreMessage = false;
} }
}] }]
); );
......
...@@ -37,7 +37,7 @@ import { ...@@ -37,7 +37,7 @@ import {
} from 'vs/workbench/parts/tasks/common/tasks'; } from 'vs/workbench/parts/tasks/common/tasks';
import { import {
ITaskSystem, ITaskSummary, ITaskExecuteResult, TaskExecuteKind, TaskError, TaskErrors, ITaskResolver, ITaskSystem, ITaskSummary, ITaskExecuteResult, TaskExecuteKind, TaskError, TaskErrors, ITaskResolver,
TelemetryEvent, Triggers, TaskTerminateResponse TelemetryEvent, Triggers, TaskTerminateResponse, TaskSystemInfoResovler, TaskSystemInfo
} from 'vs/workbench/parts/tasks/common/taskSystem'; } from 'vs/workbench/parts/tasks/common/taskSystem';
interface TerminalData { interface TerminalData {
...@@ -96,6 +96,7 @@ export class TerminalTaskSystem implements ITaskSystem { ...@@ -96,6 +96,7 @@ export class TerminalTaskSystem implements ITaskSystem {
private terminals: IStringDictionary<TerminalData>; private terminals: IStringDictionary<TerminalData>;
private idleTaskTerminals: LinkedMap<string, string>; private idleTaskTerminals: LinkedMap<string, string>;
private sameTaskTerminals: IStringDictionary<string>; private sameTaskTerminals: IStringDictionary<string>;
private taskSystemInfoResolver: TaskSystemInfoResovler;
private readonly _onDidStateChange: Emitter<TaskEvent>; private readonly _onDidStateChange: Emitter<TaskEvent>;
...@@ -104,7 +105,8 @@ export class TerminalTaskSystem implements ITaskSystem { ...@@ -104,7 +105,8 @@ export class TerminalTaskSystem implements ITaskSystem {
private configurationResolverService: IConfigurationResolverService, private configurationResolverService: IConfigurationResolverService,
private telemetryService: ITelemetryService, private telemetryService: ITelemetryService,
private contextService: IWorkspaceContextService, private contextService: IWorkspaceContextService,
outputChannelId: string) { outputChannelId: string,
taskSystemInfoResolver: TaskSystemInfoResovler) {
this.outputChannel = this.outputService.getChannel(outputChannelId); this.outputChannel = this.outputService.getChannel(outputChannelId);
this.activeTasks = Object.create(null); this.activeTasks = Object.create(null);
...@@ -113,6 +115,7 @@ export class TerminalTaskSystem implements ITaskSystem { ...@@ -113,6 +115,7 @@ export class TerminalTaskSystem implements ITaskSystem {
this.sameTaskTerminals = Object.create(null); this.sameTaskTerminals = Object.create(null);
this._onDidStateChange = new Emitter(); this._onDidStateChange = new Emitter();
this.taskSystemInfoResolver = taskSystemInfoResolver;
} }
public get onDidStateChange(): Event<TaskEvent> { public get onDidStateChange(): Event<TaskEvent> {
...@@ -830,11 +833,23 @@ export class TerminalTaskSystem implements ITaskSystem { ...@@ -830,11 +833,23 @@ export class TerminalTaskSystem implements ITaskSystem {
this.outputChannel.append(nls.localize('unkownProblemMatcher', 'Problem matcher {0} can\'t be resolved. The matcher will be ignored')); this.outputChannel.append(nls.localize('unkownProblemMatcher', 'Problem matcher {0} can\'t be resolved. The matcher will be ignored'));
return; return;
} }
if (!matcher.filePrefix) { let workspaceFolder = Task.getWorkspaceFolder(task);
let taskSystemInfo: TaskSystemInfo;
if (workspaceFolder) {
taskSystemInfo = this.taskSystemInfoResolver(workspaceFolder);
}
let hasFilePrefix = matcher.filePrefix !== void 0;
let hasScheme = taskSystemInfo !== void 0 && taskSystemInfo.fileSystemScheme !== void 0 && taskSystemInfo.fileSystemScheme === 'file';
if (!hasFilePrefix && !hasScheme) {
result.push(matcher); result.push(matcher);
} else { } else {
let copy = Objects.deepClone(matcher); let copy = Objects.deepClone(matcher);
copy.filePrefix = this.resolveVariable(task, copy.filePrefix); if (hasScheme) {
copy.fileSystemScheme = taskSystemInfo.fileSystemScheme;
}
if (hasFilePrefix) {
copy.filePrefix = this.resolveVariable(task, copy.filePrefix);
}
result.push(copy); result.push(copy);
} }
}); });
......
...@@ -10,7 +10,7 @@ import * as nls from 'vs/nls'; ...@@ -10,7 +10,7 @@ import * as nls from 'vs/nls';
import * as Objects from 'vs/base/common/objects'; import * as Objects from 'vs/base/common/objects';
import { IStringDictionary } from 'vs/base/common/collections'; import { IStringDictionary } from 'vs/base/common/collections';
import * as Platform from 'vs/base/common/platform'; import { Platform } from 'vs/base/common/platform';
import * as Types from 'vs/base/common/types'; import * as Types from 'vs/base/common/types';
import * as UUID from 'vs/base/common/uuid'; import * as UUID from 'vs/base/common/uuid';
...@@ -614,6 +614,7 @@ interface ParseContext { ...@@ -614,6 +614,7 @@ interface ParseContext {
uuidMap: UUIDMap; uuidMap: UUIDMap;
engine: Tasks.ExecutionEngine; engine: Tasks.ExecutionEngine;
schemaVersion: Tasks.JsonSchemaVersion; schemaVersion: Tasks.JsonSchemaVersion;
platform: Platform;
} }
...@@ -829,11 +830,11 @@ namespace CommandConfiguration { ...@@ -829,11 +830,11 @@ namespace CommandConfiguration {
let result: Tasks.CommandConfiguration = fromBase(config, context); let result: Tasks.CommandConfiguration = fromBase(config, context);
let osConfig: Tasks.CommandConfiguration = undefined; let osConfig: Tasks.CommandConfiguration = undefined;
if (config.windows && Platform.platform === Platform.Platform.Windows) { if (config.windows && context.platform === Platform.Windows) {
osConfig = fromBase(config.windows, context); osConfig = fromBase(config.windows, context);
} else if (config.osx && Platform.platform === Platform.Platform.Mac) { } else if (config.osx && context.platform === Platform.Mac) {
osConfig = fromBase(config.osx, context); osConfig = fromBase(config.osx, context);
} else if (config.linux && Platform.platform === Platform.Platform.Linux) { } else if (config.linux && context.platform === Platform.Linux) {
osConfig = fromBase(config.linux, context); osConfig = fromBase(config.linux, context);
} }
if (osConfig) { if (osConfig) {
...@@ -1553,11 +1554,11 @@ namespace Globals { ...@@ -1553,11 +1554,11 @@ namespace Globals {
export function from(config: ExternalTaskRunnerConfiguration, context: ParseContext): Globals { export function from(config: ExternalTaskRunnerConfiguration, context: ParseContext): Globals {
let result = fromBase(config, context); let result = fromBase(config, context);
let osGlobals: Globals = undefined; let osGlobals: Globals = undefined;
if (config.windows && Platform.platform === Platform.Platform.Windows) { if (config.windows && context.platform === Platform.Windows) {
osGlobals = fromBase(config.windows, context); osGlobals = fromBase(config.windows, context);
} else if (config.osx && Platform.platform === Platform.Platform.Mac) { } else if (config.osx && context.platform === Platform.Mac) {
osGlobals = fromBase(config.osx, context); osGlobals = fromBase(config.osx, context);
} else if (config.linux && Platform.platform === Platform.Platform.Linux) { } else if (config.linux && context.platform === Platform.Linux) {
osGlobals = fromBase(config.linux, context); osGlobals = fromBase(config.linux, context);
} }
if (osGlobals) { if (osGlobals) {
...@@ -1742,9 +1743,11 @@ class ConfigurationParser { ...@@ -1742,9 +1743,11 @@ class ConfigurationParser {
private workspaceFolder: IWorkspaceFolder; private workspaceFolder: IWorkspaceFolder;
private problemReporter: IProblemReporter; private problemReporter: IProblemReporter;
private uuidMap: UUIDMap; private uuidMap: UUIDMap;
private platform: Platform;
constructor(workspaceFolder: IWorkspaceFolder, problemReporter: IProblemReporter, uuidMap: UUIDMap) { constructor(workspaceFolder: IWorkspaceFolder, platform: Platform, problemReporter: IProblemReporter, uuidMap: UUIDMap) {
this.workspaceFolder = workspaceFolder; this.workspaceFolder = workspaceFolder;
this.platform = platform;
this.problemReporter = problemReporter; this.problemReporter = problemReporter;
this.uuidMap = uuidMap; this.uuidMap = uuidMap;
} }
...@@ -1758,7 +1761,8 @@ class ConfigurationParser { ...@@ -1758,7 +1761,8 @@ class ConfigurationParser {
uuidMap: this.uuidMap, uuidMap: this.uuidMap,
namedProblemMatchers: undefined, namedProblemMatchers: undefined,
engine, engine,
schemaVersion schemaVersion,
platform: this.platform
}; };
let taskParseResult = this.createTaskRunnerConfiguration(fileConfig, context); let taskParseResult = this.createTaskRunnerConfiguration(fileConfig, context);
return { return {
...@@ -1777,13 +1781,13 @@ class ConfigurationParser { ...@@ -1777,13 +1781,13 @@ class ConfigurationParser {
context.namedProblemMatchers = ProblemMatcherConverter.namedFrom(fileConfig.declares, context); context.namedProblemMatchers = ProblemMatcherConverter.namedFrom(fileConfig.declares, context);
let globalTasks: Tasks.CustomTask[]; let globalTasks: Tasks.CustomTask[];
let externalGlobalTasks: (ConfiguringTask | CustomTask)[]; let externalGlobalTasks: (ConfiguringTask | CustomTask)[];
if (fileConfig.windows && Platform.platform === Platform.Platform.Windows) { if (fileConfig.windows && context.platform === Platform.Windows) {
globalTasks = TaskParser.from(fileConfig.windows.tasks, globals, context).custom; globalTasks = TaskParser.from(fileConfig.windows.tasks, globals, context).custom;
externalGlobalTasks = fileConfig.windows.tasks; externalGlobalTasks = fileConfig.windows.tasks;
} else if (fileConfig.osx && Platform.platform === Platform.Platform.Mac) { } else if (fileConfig.osx && context.platform === Platform.Mac) {
globalTasks = TaskParser.from(fileConfig.osx.tasks, globals, context).custom; globalTasks = TaskParser.from(fileConfig.osx.tasks, globals, context).custom;
externalGlobalTasks = fileConfig.osx.tasks; externalGlobalTasks = fileConfig.osx.tasks;
} else if (fileConfig.linux && Platform.platform === Platform.Platform.Linux) { } else if (fileConfig.linux && context.platform === Platform.Linux) {
globalTasks = TaskParser.from(fileConfig.linux.tasks, globals, context).custom; globalTasks = TaskParser.from(fileConfig.linux.tasks, globals, context).custom;
externalGlobalTasks = fileConfig.linux.tasks; externalGlobalTasks = fileConfig.linux.tasks;
} }
...@@ -1846,7 +1850,7 @@ class ConfigurationParser { ...@@ -1846,7 +1850,7 @@ class ConfigurationParser {
} }
let uuidMaps: Map<string, UUIDMap> = new Map(); let uuidMaps: Map<string, UUIDMap> = new Map();
export function parse(workspaceFolder: IWorkspaceFolder, configuration: ExternalTaskRunnerConfiguration, logger: IProblemReporter): ParseResult { export function parse(workspaceFolder: IWorkspaceFolder, platform: Platform, configuration: ExternalTaskRunnerConfiguration, logger: IProblemReporter): ParseResult {
let uuidMap = uuidMaps.get(workspaceFolder.uri.toString()); let uuidMap = uuidMaps.get(workspaceFolder.uri.toString());
if (!uuidMap) { if (!uuidMap) {
uuidMap = new UUIDMap(); uuidMap = new UUIDMap();
...@@ -1854,7 +1858,7 @@ export function parse(workspaceFolder: IWorkspaceFolder, configuration: External ...@@ -1854,7 +1858,7 @@ export function parse(workspaceFolder: IWorkspaceFolder, configuration: External
} }
try { try {
uuidMap.start(); uuidMap.start();
return (new ConfigurationParser(workspaceFolder, logger, uuidMap)).run(configuration); return (new ConfigurationParser(workspaceFolder, platform, logger, uuidMap)).run(configuration);
} finally { } finally {
uuidMap.finish(); uuidMap.finish();
} }
......
...@@ -350,7 +350,7 @@ class PatternBuilder { ...@@ -350,7 +350,7 @@ class PatternBuilder {
function testDefaultProblemMatcher(external: ExternalTaskRunnerConfiguration, resolved: number) { function testDefaultProblemMatcher(external: ExternalTaskRunnerConfiguration, resolved: number) {
let reporter = new ProblemReporter(); let reporter = new ProblemReporter();
let result = parse(workspaceFolder, external, reporter); let result = parse(workspaceFolder, Platform.platform, external, reporter);
assert.ok(!reporter.receivedMessage); assert.ok(!reporter.receivedMessage);
assert.strictEqual(result.custom.length, 1); assert.strictEqual(result.custom.length, 1);
let task = result.custom[0]; let task = result.custom[0];
...@@ -361,7 +361,7 @@ function testDefaultProblemMatcher(external: ExternalTaskRunnerConfiguration, re ...@@ -361,7 +361,7 @@ function testDefaultProblemMatcher(external: ExternalTaskRunnerConfiguration, re
function testConfiguration(external: ExternalTaskRunnerConfiguration, builder: ConfiguationBuilder): void { function testConfiguration(external: ExternalTaskRunnerConfiguration, builder: ConfiguationBuilder): void {
builder.done(); builder.done();
let reporter = new ProblemReporter(); let reporter = new ProblemReporter();
let result = parse(workspaceFolder, external, reporter); let result = parse(workspaceFolder, Platform.platform, external, reporter);
if (reporter.receivedMessage) { if (reporter.receivedMessage) {
assert.ok(false, reporter.lastMessage); assert.ok(false, reporter.lastMessage);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册