提交 f5992a03 编写于 作者: S Sandeep Somavarapu

Fix #14380

上级 b326ba71
......@@ -288,8 +288,13 @@ export class WorkbenchShell {
this.toUnbind.push(lifecycleService.onShutdown(() => disposables.dispose()));
serviceCollection.set(ILifecycleService, lifecycleService);
const extensionManagementChannel = getDelayedChannel<IExtensionManagementChannel>(sharedProcess.then(c => c.getChannel('extensions')));
const extensionManagementChannelClient = new ExtensionManagementChannelClient(extensionManagementChannel);
serviceCollection.set(IExtensionManagementService, extensionManagementChannelClient);
const extensionsRuntimeService = instantiationService.createInstance(ExtensionsRuntimeService);
serviceCollection.set(IExtensionsRuntimeService, extensionsRuntimeService);
disposables.add(extensionsRuntimeService);
const extensionHostProcessWorker = this.startExtensionHost(instantiationService);
this.threadService = instantiationService.createInstance(MainThreadService, extensionHostProcessWorker.messagingProtocol);
......@@ -333,10 +338,6 @@ export class WorkbenchShell {
const integrityService = instantiationService.createInstance(IntegrityServiceImpl);
serviceCollection.set(IIntegrityService, integrityService);
const extensionManagementChannel = getDelayedChannel<IExtensionManagementChannel>(sharedProcess.then(c => c.getChannel('extensions')));
const extensionManagementChannelClient = new ExtensionManagementChannelClient(extensionManagementChannel);
serviceCollection.set(IExtensionManagementService, extensionManagementChannelClient);
const urlChannel = mainProcessClient.getChannel('url');
const urlChannelClient = new URLChannelClient(urlChannel, this.windowService.getWindowId());
serviceCollection.set(IURLService, urlChannelClient);
......
......@@ -627,7 +627,6 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
if (!error) {
this.unInstalled.push(uninstalling.extension);
this.extensionsRuntimeService.setEnablement(uninstalling.extension.identifier, true);
uninstalling.extension.needsReload = !newlyInstalled;
this.reportTelemetry(uninstalling, true);
}
......
......@@ -9,7 +9,9 @@ import { TPromise } from 'vs/base/common/winjs.base';
import { distinct } from 'vs/base/common/arrays';
import * as paths from 'vs/base/common/paths';
import URI from 'vs/base/common/uri';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { ExtensionScanner, MessagesCollector } from 'vs/workbench/node/extensionPoints';
import { IExtensionManagementService, DidUninstallExtensionEvent } from 'vs/platform/extensionManagement/common/extensionManagement';
import { IWorkspaceContextService, IWorkspace } from 'vs/platform/workspace/common/workspace';
import { IExtensionsRuntimeService, IExtensionDescription, IMessage } from 'vs/platform/extensions/common/extensions';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
......@@ -29,17 +31,20 @@ export class ExtensionsRuntimeService implements IExtensionsRuntimeService {
private workspace: IWorkspace;
private installedExtensions: TPromise<IExtensionDescription[]>;
private _globalDisabledExtensions: string[];
private _workspaceDisabledExtensions: string[];
private disposables: IDisposable[] = [];
constructor(
@IStorageService private storageService: IStorageService,
@IWorkspaceContextService contextService: IWorkspaceContextService,
@IMessageService private messageService: IMessageService,
@IEnvironmentService private environmentService: IEnvironmentService
@IEnvironmentService private environmentService: IEnvironmentService,
@IExtensionManagementService private extensionManagementService: IExtensionManagementService
) {
this.workspace = contextService.getWorkspace();
extensionManagementService.onDidUninstallExtension(this.onDidUninstallExtension, this, this.disposables);
}
public getExtensions(includeDisabled: boolean = false): TPromise<IExtensionDescription[]> {
......@@ -163,6 +168,14 @@ export class ExtensionsRuntimeService implements IExtensionsRuntimeService {
}
}
private onDidUninstallExtension({id, error}: DidUninstallExtensionEvent): void {
if (!error) {
id = stripVersion(id);
this.enableExtension(id, StorageScope.WORKSPACE);
this.enableExtension(id, StorageScope.GLOBAL);
}
}
private scanExtensions(): TPromise<IExtensionDescription[]> {
const collector = new MessagesCollector();
const version = pkg.version;
......@@ -226,4 +239,12 @@ export class ExtensionsRuntimeService implements IExtensionsRuntimeService {
}
}
}
dispose(): void {
this.disposables = dispose(this.disposables);
}
}
function stripVersion(id: string): string {
return id.replace(/-\d+\.\d+\.\d+$/, '');
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册