提交 7dbd9689 编写于 作者: S Sandeep Somavarapu

Renaming in extensionRuntimeService

上级 d765d6b9
......@@ -72,16 +72,15 @@ export interface IExtensionService {
getExtensionsStatus(): { [id: string]: IExtensionsStatus };
}
export const IExtensionsRuntimeService = createDecorator<IExtensionsRuntimeService>('extensionsRuntimeService');
export const IExtensionRuntimeService = createDecorator<IExtensionRuntimeService>('extensionRuntimeService');
export interface IExtensionsRuntimeService {
export interface IExtensionRuntimeService {
_serviceBrand: any;
/**
* Scans and returns only enabled extensions.
* **NOTE**: This call returns different results based on `setEnablement` calls!
* Returns all extensions enabled for the current VS Code window
*/
getExtensions(): TPromise<IExtensionDescription[]>;
getEnabledExtensions(): TPromise<IExtensionDescription[]>;
/**
* Returns `true` if given extension is disabled, otherwise `false`.
......@@ -91,7 +90,7 @@ export interface IExtensionsRuntimeService {
/**
* Returns `true` if given extension is disabled always, otherwise `false`.
*/
isDisabledAlways(identifier: string): boolean;
isDisabledGlobally(identifier: string): boolean;
/**
* Returns `true` if given extension can be enabled by calling `setEnablement`, otherwise false`.
......
......@@ -7,7 +7,7 @@
import Severity from 'vs/base/common/severity';
import { TPromise } from 'vs/base/common/winjs.base';
import { AbstractExtensionService, ActivatedExtension } from 'vs/platform/extensions/common/abstractExtensionService';
import { IExtensionsRuntimeService, IMessage, IExtensionDescription, IExtensionsStatus } from 'vs/platform/extensions/common/extensions';
import { IExtensionRuntimeService, IMessage, IExtensionDescription, IExtensionsStatus } from 'vs/platform/extensions/common/extensions';
import { ExtensionsRegistry, ExtensionPoint, IExtensionPointUser, ExtensionMessageCollector } from 'vs/platform/extensions/common/extensionsRegistry';
import { IMessageService } from 'vs/platform/message/common/message';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
......@@ -54,7 +54,7 @@ export class MainProcessExtensionService extends AbstractExtensionService<Activa
@IThreadService threadService: IThreadService,
@IMessageService messageService: IMessageService,
@IEnvironmentService private environmentService: IEnvironmentService,
@IExtensionsRuntimeService extensionsRuntimeService: IExtensionsRuntimeService
@IExtensionRuntimeService extensionsRuntimeService: IExtensionRuntimeService
) {
super(false);
this._isDev = !environmentService.isBuilt || !!environmentService.extensionDevelopmentPath;
......@@ -64,7 +64,7 @@ export class MainProcessExtensionService extends AbstractExtensionService<Activa
this._proxy = this._threadService.get(ExtHostContext.ExtHostExtensionService);
this._extensionsStatus = {};
extensionsRuntimeService.getExtensions().then((extensionDescriptions) => this._onExtensionDescriptions(extensionDescriptions));
extensionsRuntimeService.getEnabledExtensions().then((extensionDescriptions) => this._onExtensionDescriptions(extensionDescriptions));
}
private _handleMessage(msg: IMessage) {
......
......@@ -64,7 +64,7 @@ import { IThreadService } from 'vs/workbench/services/thread/common/threadServic
import { ICommandService } from 'vs/platform/commands/common/commands';
import { CommandService } from 'vs/platform/commands/common/commandService';
import { IWorkspaceContextService, IWorkspace } from 'vs/platform/workspace/common/workspace';
import { IExtensionService, IExtensionsRuntimeService } from 'vs/platform/extensions/common/extensions';
import { IExtensionService, IExtensionRuntimeService } from 'vs/platform/extensions/common/extensions';
import { MainThreadModeServiceImpl } from 'vs/editor/common/services/modeServiceImpl';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IUntitledEditorService, UntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
......@@ -82,7 +82,7 @@ import { IURLService } from 'vs/platform/url/common/url';
import { ReloadWindowAction } from 'vs/workbench/electron-browser/actions';
import { WorkspaceConfigurationService } from 'vs/workbench/services/configuration/node/configurationService';
import { ExtensionHostProcessWorker } from 'vs/workbench/services/extensions/electron-browser/extensionHost';
import { ExtensionsRuntimeService } from 'vs/workbench/services/extensions/electron-browser/extensions';
import { ExtensionRuntimeService } from 'vs/workbench/services/extensions/electron-browser/extensionRuntimeService';
// self registering services
import 'vs/platform/opener/browser/opener.contribution';
......@@ -292,8 +292,8 @@ export class WorkbenchShell {
const extensionManagementChannelClient = new ExtensionManagementChannelClient(extensionManagementChannel);
serviceCollection.set(IExtensionManagementService, extensionManagementChannelClient);
const extensionsRuntimeService = instantiationService.createInstance(ExtensionsRuntimeService);
serviceCollection.set(IExtensionsRuntimeService, extensionsRuntimeService);
const extensionsRuntimeService = instantiationService.createInstance(ExtensionRuntimeService);
serviceCollection.set(IExtensionRuntimeService, extensionsRuntimeService);
disposables.add(extensionsRuntimeService);
const extensionHostProcessWorker = instantiationService.createInstance(ExtensionHostProcessWorker);
......
......@@ -29,7 +29,7 @@ import { ExtensionsConfigurationInitialContent } from 'vs/workbench/parts/extens
import { IFileService } from 'vs/platform/files/common/files';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import URI from 'vs/base/common/uri';
import { IExtensionsRuntimeService } from 'vs/platform/extensions/common/extensions';
import { IExtensionRuntimeService } from 'vs/platform/extensions/common/extensions';
import { IWindowService } from 'vs/workbench/services/window/electron-browser/windowService';
const dialog = remote.dialog;
......@@ -357,7 +357,7 @@ export class ManageExtensionAction extends Action {
constructor(
@IWorkspaceContextService private workspaceContextService: IWorkspaceContextService,
@IExtensionsWorkbenchService private extensionsWorkbenchService: IExtensionsWorkbenchService,
@IExtensionsRuntimeService private extensionRuntimeService: IExtensionsRuntimeService,
@IExtensionRuntimeService private extensionRuntimeService: IExtensionRuntimeService,
@IInstantiationService private instantiationService: IInstantiationService
) {
super(ManageExtensionAction.ID);
......@@ -404,7 +404,7 @@ export class EnableForWorkspaceAction extends Action implements IExtensionAction
constructor(label: string,
@IWorkspaceContextService private workspaceContextService: IWorkspaceContextService,
@IExtensionsWorkbenchService private extensionsWorkbenchService: IExtensionsWorkbenchService,
@IExtensionsRuntimeService private extensionsRuntimeService: IExtensionsRuntimeService,
@IExtensionRuntimeService private extensionRuntimeService: IExtensionRuntimeService,
@IInstantiationService private instantiationService: IInstantiationService
) {
super(EnableForWorkspaceAction.ID, label);
......@@ -417,7 +417,7 @@ export class EnableForWorkspaceAction extends Action implements IExtensionAction
this.enabled = false;
if (this.extension && this.workspaceContextService.getWorkspace()) {
this.enabled = this.extension.type !== LocalExtensionType.System && ExtensionState.Disabled === this.extension.state
&& !this.extensionsRuntimeService.isDisabledAlways(this.extension.identifier) && this.extensionsRuntimeService.canEnable(this.extension.identifier);
&& !this.extensionRuntimeService.isDisabledGlobally(this.extension.identifier) && this.extensionRuntimeService.canEnable(this.extension.identifier);
}
}
......@@ -444,7 +444,7 @@ export class EnableGloballyAction extends Action implements IExtensionAction {
constructor(label: string,
@IExtensionsWorkbenchService private extensionsWorkbenchService: IExtensionsWorkbenchService,
@IExtensionsRuntimeService private extensionsRuntimeService: IExtensionsRuntimeService,
@IExtensionRuntimeService private extensionRuntimeService: IExtensionRuntimeService,
@IInstantiationService private instantiationService: IInstantiationService
) {
super(EnableGloballyAction.ID, label);
......@@ -456,7 +456,7 @@ export class EnableGloballyAction extends Action implements IExtensionAction {
private update(): void {
this.enabled = false;
if (this.extension) {
this.enabled = this.extension.type !== LocalExtensionType.System && this.extensionsRuntimeService.isDisabledAlways(this.extension.identifier) && this.extensionsRuntimeService.canEnable(this.extension.identifier);
this.enabled = this.extension.type !== LocalExtensionType.System && this.extensionRuntimeService.isDisabledGlobally(this.extension.identifier) && this.extensionRuntimeService.canEnable(this.extension.identifier);
}
}
......@@ -489,7 +489,7 @@ export class EnableAction extends Action {
constructor(
@IInstantiationService private instantiationService: IInstantiationService,
@IExtensionsWorkbenchService private extensionsWorkbenchService: IExtensionsWorkbenchService,
@IExtensionsRuntimeService private extensionsRuntimeService: IExtensionsRuntimeService
@IExtensionRuntimeService private extensionRuntimeService: IExtensionRuntimeService
) {
super(EnableAction.ID, localize('enableAction', "Enable"), EnableAction.DisabledClass, false);
......@@ -507,7 +507,7 @@ export class EnableAction extends Action {
return;
}
this.enabled = this.extension.type !== LocalExtensionType.System && !this.extension.reload && ExtensionState.Disabled === this.extension.state && this.extensionsRuntimeService.canEnable(this.extension.identifier);
this.enabled = this.extension.type !== LocalExtensionType.System && !this.extension.reload && ExtensionState.Disabled === this.extension.state && this.extensionRuntimeService.canEnable(this.extension.identifier);
this.class = this.enabled ? EnableAction.EnabledClass : EnableAction.DisabledClass;
}
......@@ -682,7 +682,7 @@ export class ReloadAction extends Action {
@IExtensionsWorkbenchService private extensionsWorkbenchService: IExtensionsWorkbenchService,
@IMessageService private messageService: IMessageService,
@IInstantiationService private instantiationService: IInstantiationService,
@IExtensionsRuntimeService private extensionsRuntimeService: IExtensionsRuntimeService
@IExtensionRuntimeService private extensionRuntimeService: IExtensionRuntimeService
) {
super('extensions.reload', localize('reloadAction', "Reload"), ReloadAction.DisabledClass, false);
......@@ -1159,7 +1159,7 @@ export class DisableAllAction extends Action {
constructor(
id: string = DisableAllAction.ID, label: string = DisableAllAction.LABEL,
@IExtensionsWorkbenchService private extensionsWorkbenchService: IExtensionsWorkbenchService,
@IExtensionsRuntimeService private extensionRuntimeService: IExtensionsRuntimeService
@IExtensionRuntimeService private extensionRuntimeService: IExtensionRuntimeService
) {
super(id, label);
this.update();
......@@ -1191,7 +1191,7 @@ export class DisableAllWorkpsaceAction extends Action {
id: string = DisableAllWorkpsaceAction.ID, label: string = DisableAllWorkpsaceAction.LABEL,
@IWorkspaceContextService private workspaceContextService: IWorkspaceContextService,
@IExtensionsWorkbenchService private extensionsWorkbenchService: IExtensionsWorkbenchService,
@IExtensionsRuntimeService private extensionRuntimeService: IExtensionsRuntimeService
@IExtensionRuntimeService private extensionRuntimeService: IExtensionRuntimeService
) {
super(id, label);
this.update();
......@@ -1222,7 +1222,7 @@ export class EnableAllAction extends Action {
constructor(
id: string = EnableAllAction.ID, label: string = EnableAllAction.LABEL,
@IExtensionsWorkbenchService private extensionsWorkbenchService: IExtensionsWorkbenchService,
@IExtensionsRuntimeService private extensionRuntimeService: IExtensionsRuntimeService
@IExtensionRuntimeService private extensionRuntimeService: IExtensionRuntimeService
) {
super(id, label);
this.update();
......@@ -1254,7 +1254,7 @@ export class EnableAllWorkpsaceAction extends Action {
id: string = EnableAllWorkpsaceAction.ID, label: string = EnableAllWorkpsaceAction.LABEL,
@IWorkspaceContextService private workspaceContextService: IWorkspaceContextService,
@IExtensionsWorkbenchService private extensionsWorkbenchService: IExtensionsWorkbenchService,
@IExtensionsRuntimeService private extensionRuntimeService: IExtensionsRuntimeService
@IExtensionRuntimeService private extensionRuntimeService: IExtensionRuntimeService
) {
super(id, label);
this.update();
......@@ -1262,7 +1262,7 @@ export class EnableAllWorkpsaceAction extends Action {
}
private update(): void {
this.enabled = !!this.workspaceContextService.getWorkspace() && this.extensionsWorkbenchService.local.some(e => this.extensionRuntimeService.canEnable(e.identifier) && !this.extensionRuntimeService.isDisabledAlways(e.identifier));
this.enabled = !!this.workspaceContextService.getWorkspace() && this.extensionsWorkbenchService.local.some(e => this.extensionRuntimeService.canEnable(e.identifier) && !this.extensionRuntimeService.isDisabledGlobally(e.identifier));
}
run(): TPromise<any> {
......
......@@ -10,7 +10,7 @@ import 'vs/css!./media/extensionsWidgets';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IExtension, IExtensionsWorkbenchService, ExtensionState } from '../common/extensions';
import { append, $, addClass, toggleClass } from 'vs/base/browser/dom';
import { IExtensionsRuntimeService } from 'vs/platform/extensions/common/extensions';
import { IExtensionRuntimeService } from 'vs/platform/extensions/common/extensions';
export interface IOptions {
extension?: IExtension;
......@@ -52,7 +52,7 @@ export class StatusWidget implements IDisposable {
private container: HTMLElement,
private _extension: IExtension,
@IExtensionsWorkbenchService extensionsWorkbenchService: IExtensionsWorkbenchService,
@IExtensionsRuntimeService private extensionsRuntimeService: IExtensionsRuntimeService
@IExtensionRuntimeService private extensionRuntimeService: IExtensionRuntimeService
) {
this.render();
this.listener = extensionsWorkbenchService.onChange(this.render, this);
......@@ -64,7 +64,7 @@ export class StatusWidget implements IDisposable {
return;
}
this.extensionsRuntimeService.getExtensions().done(extensions => {
this.extensionRuntimeService.getEnabledExtensions().done(extensions => {
const status = append(this.container, $('span.extension-status'));
const state = this.extension.state;
const enabled = state === ExtensionState.Enabled || extensions.some(e => e.id === this.extension.identifier);
......@@ -73,7 +73,7 @@ export class StatusWidget implements IDisposable {
toggleClass(status, 'disabled', disabled || installed);
toggleClass(status, 'active', enabled);
status.title = disabled ? this.extensionsRuntimeService.isDisabledAlways(this.extension.identifier) ? localize('disabled', "Disabled") : localize('disabledWorkspace', "Disabled (Workspace)")
status.title = disabled ? this.extensionRuntimeService.isDisabledGlobally(this.extension.identifier) ? localize('disabled', "Disabled") : localize('disabledWorkspace', "Disabled (Workspace)")
: installed ? localize('installed', "Installed")
: enabled ? localize('enabled', "Enabled") : '';
});
......
......@@ -34,7 +34,7 @@ import { IExtension, IExtensionDependencies, ExtensionState, IExtensionsWorkbenc
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IURLService } from 'vs/platform/url/common/url';
import { ExtensionsInput } from 'vs/workbench/parts/extensions/common/extensionsInput';
import { IExtensionsRuntimeService } from 'vs/platform/extensions/common/extensions';
import { IExtensionRuntimeService } from 'vs/platform/extensions/common/extensions';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
interface IExtensionStateProvider {
......@@ -302,7 +302,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
private autoUpdateDelayer: ThrottledDelayer<void>;
private disposables: IDisposable[] = [];
// TODO: @sandy - Remove these when IExtensionsRuntimeService exposes sync API to get extensions.
// TODO: @sandy - Remove these when IExtensionRuntimeService exposes sync API to get extensions.
private newlyInstalled: Extension[] = [];
private unInstalled: Extension[] = [];
......@@ -318,7 +318,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
@ITelemetryService private telemetryService: ITelemetryService,
@IMessageService private messageService: IMessageService,
@IURLService urlService: IURLService,
@IExtensionsRuntimeService private extensionsRuntimeService: IExtensionsRuntimeService,
@IExtensionRuntimeService private extensionRuntimeService: IExtensionRuntimeService,
@IWorkspaceContextService private workspaceContextService: IWorkspaceContextService,
) {
this.stateProvider = ext => this.getExtensionState(ext);
......@@ -512,14 +512,14 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
private doSetEnablement(extension: IExtension, enable: boolean, workspace: boolean): TPromise<boolean> {
if (workspace) {
return this.extensionsRuntimeService.setEnablement(extension.identifier, enable, workspace);
return this.extensionRuntimeService.setEnablement(extension.identifier, enable, workspace);
}
const globalElablement = this.extensionsRuntimeService.setEnablement(extension.identifier, enable, false);
const globalElablement = this.extensionRuntimeService.setEnablement(extension.identifier, enable, false);
if (!this.workspaceContextService.getWorkspace()) {
return globalElablement;
}
return TPromise.join([globalElablement, this.extensionsRuntimeService.setEnablement(extension.identifier, enable, true)])
return TPromise.join([globalElablement, this.extensionRuntimeService.setEnablement(extension.identifier, enable, true)])
.then(values => values[0] || values[1]);
}
......@@ -632,7 +632,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
if (this.newlyInstalled.some(e => e.gallery && extension.gallery && e.gallery.id === extension.gallery.id)) {
return ExtensionState.Installed;
}
return this.extensionsRuntimeService.isDisabled(extension.identifier) ? ExtensionState.Disabled : ExtensionState.Enabled;
return this.extensionRuntimeService.isDisabled(extension.identifier) ? ExtensionState.Disabled : ExtensionState.Enabled;
}
return ExtensionState.Uninstalled;
......
......@@ -13,7 +13,7 @@ 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 { IExtensionRuntimeService, IExtensionDescription, IMessage } from 'vs/platform/extensions/common/extensions';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { Severity, IMessageService } from 'vs/platform/message/common/message';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
......@@ -24,7 +24,7 @@ const BASE_PATH = paths.normalize(paths.join(DIRNAME, '../../../../../..'));
const BUILTIN_EXTENSIONS_PATH = paths.join(BASE_PATH, 'extensions');
const DISABLED_EXTENSIONS_STORAGE_PATH = 'extensions/disabled';
export class ExtensionsRuntimeService implements IExtensionsRuntimeService {
export class ExtensionRuntimeService implements IExtensionRuntimeService {
_serviceBrand: any;
......@@ -47,7 +47,7 @@ export class ExtensionsRuntimeService implements IExtensionsRuntimeService {
extensionManagementService.onDidUninstallExtension(this.onDidUninstallExtension, this, this.disposables);
}
public getExtensions(): TPromise<IExtensionDescription[]> {
public getEnabledExtensions(): TPromise<IExtensionDescription[]> {
if (!this.installedExtensions) {
this.installedExtensions = this.scanExtensions();
}
......@@ -73,7 +73,7 @@ export class ExtensionsRuntimeService implements IExtensionsRuntimeService {
return this.getDisabledExtensions().indexOf(identifier) !== -1;
}
public isDisabledAlways(identifier: string): boolean {
public isDisabledGlobally(identifier: string): boolean {
return this.globalDisabledExtensions.indexOf(identifier) !== -1;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册