mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-03 09:35:40 -05:00
* Initial VS Code 1.21 file copy with patches * A few more merges * Post npm install * Fix batch of build breaks * Fix more build breaks * Fix more build errors * Fix more build breaks * Runtime fixes 1 * Get connection dialog working with some todos * Fix a few packaging issues * Copy several node_modules to package build to fix loader issues * Fix breaks from master * A few more fixes * Make tests pass * First pass of license header updates * Second pass of license header updates * Fix restore dialog issues * Remove add additional themes menu items * fix select box issues where the list doesn't show up * formatting * Fix editor dispose issue * Copy over node modules to correct location on all platforms
67 lines
2.6 KiB
TypeScript
67 lines
2.6 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
'use strict';
|
|
|
|
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';
|
|
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
|
|
import URI from 'vs/base/common/uri';
|
|
|
|
@extHostNamedCustomer(MainContext.MainThreadTask)
|
|
export class MainThreadTask implements MainThreadTaskShape {
|
|
|
|
private _proxy: ExtHostTaskShape;
|
|
private _activeHandles: { [handle: number]: boolean; };
|
|
|
|
constructor(
|
|
extHostContext: IExtHostContext,
|
|
@ITaskService private readonly _taskService: ITaskService,
|
|
@IWorkspaceContextService private readonly _workspaceContextServer: IWorkspaceContextService
|
|
) {
|
|
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostTask);
|
|
this._activeHandles = Object.create(null);
|
|
}
|
|
|
|
public dispose(): void {
|
|
Object.keys(this._activeHandles).forEach((handle) => {
|
|
this._taskService.unregisterTaskProvider(parseInt(handle, 10));
|
|
});
|
|
this._activeHandles = Object.create(null);
|
|
}
|
|
|
|
public $registerTaskProvider(handle: number): TPromise<void> {
|
|
this._taskService.registerTaskProvider(handle, {
|
|
provideTasks: () => {
|
|
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) {
|
|
delete (task._source as any as ExtensionTaskSourceTransfer).__workspaceFolder;
|
|
(task._source as any).workspaceFolder = this._workspaceContextServer.getWorkspaceFolder(URI.revive(uri));
|
|
}
|
|
}
|
|
}
|
|
return value;
|
|
});
|
|
}
|
|
});
|
|
this._activeHandles[handle] = true;
|
|
return TPromise.wrap<void>(undefined);
|
|
}
|
|
|
|
public $unregisterTaskProvider(handle: number): TPromise<void> {
|
|
this._taskService.unregisterTaskProvider(handle);
|
|
delete this._activeHandles[handle];
|
|
return TPromise.wrap<void>(undefined);
|
|
}
|
|
}
|