More work to make task multi folder aware

This commit is contained in:
Dirk Baeumer
2017-09-19 12:30:39 +02:00
parent 351b05d6e1
commit 95deca7678
11 changed files with 309 additions and 139 deletions

View File

@@ -6,6 +6,9 @@
import { TPromise } from 'vs/base/common/winjs.base';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { ContributedTask, ExtensionTaskSourceTransfer } from 'vs/workbench/parts/tasks/common/tasks';
import { ITaskService } from 'vs/workbench/parts/tasks/common/taskService';
import { ExtHostContext, MainThreadTaskShape, ExtHostTaskShape, MainContext, IExtHostContext } from '../node/extHost.protocol';
@@ -19,7 +22,8 @@ export class MainThreadTask implements MainThreadTaskShape {
constructor(
extHostContext: IExtHostContext,
@ITaskService private _taskService: ITaskService
@ITaskService private _taskService: ITaskService,
@IWorkspaceContextService private _workspaceContextServer: IWorkspaceContextService
) {
this._proxy = extHostContext.get(ExtHostContext.ExtHostTask);
this._activeHandles = Object.create(null);
@@ -35,7 +39,17 @@ export class MainThreadTask implements MainThreadTaskShape {
public $registerTaskProvider(handle: number): TPromise<void> {
this._taskService.registerTaskProvider(handle, {
provideTasks: () => {
return this._proxy.$provideTasks(handle);
return this._proxy.$provideTasks(handle).then((value) => {
for (let task of value.tasks) {
if (ContributedTask.is(task)) {
let uri = (task._source as any as ExtensionTaskSourceTransfer).__workspaceFolder;
if (uri) {
(task._source as any).workspaceFolder = this._workspaceContextServer.getWorkspaceFolder(uri);
}
}
}
return value;
});
}
});
this._activeHandles[handle] = true;