mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-30 08:40:29 -04:00
Merge from vscode 31e03b8ffbb218a87e3941f2b63a249f061fe0e4 (#4986)
This commit is contained in:
@@ -7,7 +7,7 @@ import { IViewlet } from 'vs/workbench/common/viewlet';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IPager } from 'vs/base/common/paging';
|
||||
import { IQueryOptions, EnablementState, ILocalExtension, IGalleryExtension, IExtensionIdentifier } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IQueryOptions, EnablementState, ILocalExtension, IGalleryExtension, IExtensionIdentifier, IExtensionManagementServer } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IViewContainersRegistry, ViewContainer, Extensions as ViewContainerExtensions } from 'vs/workbench/common/views';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
@@ -32,40 +32,41 @@ export const enum ExtensionState {
|
||||
}
|
||||
|
||||
export interface IExtension {
|
||||
type?: ExtensionType;
|
||||
state: ExtensionState;
|
||||
name: string;
|
||||
displayName: string;
|
||||
identifier: IExtensionIdentifier;
|
||||
publisher: string;
|
||||
publisherDisplayName: string;
|
||||
version: string;
|
||||
latestVersion: string;
|
||||
description: string;
|
||||
url?: string;
|
||||
readonly type?: ExtensionType;
|
||||
readonly state: ExtensionState;
|
||||
readonly name: string;
|
||||
readonly displayName: string;
|
||||
readonly identifier: IExtensionIdentifier;
|
||||
readonly publisher: string;
|
||||
readonly publisherDisplayName: string;
|
||||
readonly version: string;
|
||||
readonly latestVersion: string;
|
||||
readonly description: string;
|
||||
readonly url?: string;
|
||||
// {{SQL CARBON EDIT}}
|
||||
downloadPage: string;
|
||||
repository?: string;
|
||||
iconUrl: string;
|
||||
iconUrlFallback: string;
|
||||
licenseUrl?: string;
|
||||
installCount?: number;
|
||||
rating?: number;
|
||||
ratingCount?: number;
|
||||
outdated: boolean;
|
||||
enablementState: EnablementState;
|
||||
dependencies: string[];
|
||||
extensionPack: string[];
|
||||
telemetryData: any;
|
||||
preview: boolean;
|
||||
readonly downloadPage?: string;
|
||||
readonly repository?: string;
|
||||
readonly iconUrl: string;
|
||||
readonly iconUrlFallback: string;
|
||||
readonly licenseUrl?: string;
|
||||
readonly installCount?: number;
|
||||
readonly rating?: number;
|
||||
readonly ratingCount?: number;
|
||||
readonly outdated: boolean;
|
||||
readonly enablementState: EnablementState;
|
||||
readonly dependencies: string[];
|
||||
readonly extensionPack: string[];
|
||||
readonly telemetryData: any;
|
||||
readonly preview: boolean;
|
||||
getManifest(token: CancellationToken): Promise<IExtensionManifest | null>;
|
||||
getReadme(token: CancellationToken): Promise<string>;
|
||||
hasReadme(): boolean;
|
||||
getChangelog(token: CancellationToken): Promise<string>;
|
||||
hasChangelog(): boolean;
|
||||
local?: ILocalExtension;
|
||||
readonly server?: IExtensionManagementServer;
|
||||
readonly local?: ILocalExtension;
|
||||
gallery?: IGalleryExtension;
|
||||
isMalicious: boolean;
|
||||
readonly isMalicious: boolean;
|
||||
}
|
||||
|
||||
export interface IExtensionDependencies {
|
||||
@@ -84,7 +85,8 @@ export interface IExtensionsWorkbenchService {
|
||||
_serviceBrand: any;
|
||||
onChange: Event<IExtension | undefined>;
|
||||
local: IExtension[];
|
||||
queryLocal(): Promise<IExtension[]>;
|
||||
outdated: IExtension[];
|
||||
queryLocal(server?: IExtensionManagementServer): Promise<IExtension[]>;
|
||||
queryGallery(token: CancellationToken): Promise<IPager<IExtension>>;
|
||||
queryGallery(options: IQueryOptions, token: CancellationToken): Promise<IPager<IExtension>>;
|
||||
canInstall(extension: IExtension): boolean;
|
||||
@@ -128,6 +130,7 @@ export enum ExtensionsPolicy {
|
||||
|
||||
export interface IExtensionContainer {
|
||||
extension: IExtension | null;
|
||||
updateWhenCounterExtensionChanges?: boolean;
|
||||
update(): void;
|
||||
}
|
||||
|
||||
@@ -149,7 +152,11 @@ export class ExtensionContainers extends Disposable {
|
||||
for (const container of this.containers) {
|
||||
if (extension && container.extension) {
|
||||
if (areSameExtensions(container.extension.identifier, extension.identifier)) {
|
||||
container.extension = extension;
|
||||
if (!container.extension.server || container.extension.server === extension.server) {
|
||||
container.extension = extension;
|
||||
} else if (container.updateWhenCounterExtensionChanges) {
|
||||
container.update();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
container.update();
|
||||
|
||||
@@ -28,7 +28,7 @@ import { IExtensionsWorkbenchService, IExtensionsViewlet, VIEWLET_ID, IExtension
|
||||
import { RatingsWidget, InstallCountWidget, RemoteBadgeWidget } from 'vs/workbench/contrib/extensions/electron-browser/extensionsWidgets';
|
||||
import { EditorOptions } from 'vs/workbench/common/editor';
|
||||
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { CombinedInstallAction, UpdateAction, ExtensionEditorDropDownAction, ReloadAction, MaliciousStatusLabelAction, IgnoreExtensionRecommendationAction, UndoIgnoreExtensionRecommendationAction, EnableDropDownAction, DisableDropDownAction, StatusLabelAction, SetFileIconThemeAction, SetColorThemeAction } from 'vs/workbench/contrib/extensions/electron-browser/extensionsActions';
|
||||
import { CombinedInstallAction, UpdateAction, ExtensionEditorDropDownAction, ReloadAction, MaliciousStatusLabelAction, IgnoreExtensionRecommendationAction, UndoIgnoreExtensionRecommendationAction, EnableDropDownAction, DisableDropDownAction, StatusLabelAction, SetFileIconThemeAction, SetColorThemeAction, RemoteInstallAction, SystemDisabledLabelAction, SystemDisabledWarningAction } from 'vs/workbench/contrib/extensions/electron-browser/extensionsActions';
|
||||
import { WebviewElement } from 'vs/workbench/contrib/webview/electron-browser/webviewElement';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
|
||||
@@ -215,6 +215,8 @@ export class ExtensionEditor extends BaseEditor {
|
||||
|
||||
createEditor(parent: HTMLElement): void {
|
||||
const root = append(parent, $('.extension-editor'));
|
||||
root.tabIndex = 0; // this is required for the focus tracker on the editor
|
||||
root.style.outline = 'none';
|
||||
this.header = append(root, $('.header'));
|
||||
|
||||
this.iconContainer = append(this.header, $('.icon-container'));
|
||||
@@ -380,6 +382,8 @@ export class ExtensionEditor extends BaseEditor {
|
||||
// this.instantiationService.createInstance(RatingsWidget, this.rating, false)
|
||||
];
|
||||
const reloadAction = this.instantiationService.createInstance(ReloadAction);
|
||||
const combinedInstallAction = this.instantiationService.createInstance(CombinedInstallAction);
|
||||
const systemDisabledWarningAction = this.instantiationService.createInstance(SystemDisabledWarningAction);
|
||||
const actions = [
|
||||
reloadAction,
|
||||
this.instantiationService.createInstance(StatusLabelAction),
|
||||
@@ -388,7 +392,10 @@ export class ExtensionEditor extends BaseEditor {
|
||||
this.instantiationService.createInstance(SetFileIconThemeAction, fileIconThemes),
|
||||
this.instantiationService.createInstance(EnableDropDownAction),
|
||||
this.instantiationService.createInstance(DisableDropDownAction, runningExtensions),
|
||||
this.instantiationService.createInstance(CombinedInstallAction),
|
||||
this.instantiationService.createInstance(RemoteInstallAction),
|
||||
combinedInstallAction,
|
||||
systemDisabledWarningAction,
|
||||
this.instantiationService.createInstance(SystemDisabledLabelAction, systemDisabledWarningAction),
|
||||
this.instantiationService.createInstance(MaliciousStatusLabelAction, true),
|
||||
];
|
||||
const extensionContainers: ExtensionContainers = this.instantiationService.createInstance(ExtensionContainers, [...actions, ...widgets]);
|
||||
@@ -410,6 +417,9 @@ export class ExtensionEditor extends BaseEditor {
|
||||
this.extensionManifest.get()
|
||||
.promise
|
||||
.then(manifest => {
|
||||
if (manifest) {
|
||||
combinedInstallAction.manifest = manifest;
|
||||
}
|
||||
if (extension.extensionPack.length) {
|
||||
this.navbar.push(NavbarSection.ExtensionPack, localize('extensionPack', "Extension Pack"), localize('extensionsPack', "Set of extensions that can be installed together"));
|
||||
}
|
||||
@@ -543,19 +553,20 @@ export class ExtensionEditor extends BaseEditor {
|
||||
.then(renderBody)
|
||||
.then(removeEmbeddedSVGs)
|
||||
.then(body => {
|
||||
const wbeviewElement = this.instantiationService.createInstance(WebviewElement,
|
||||
const webviewElement = this.instantiationService.createInstance(WebviewElement,
|
||||
{
|
||||
enableFindWidget: true,
|
||||
},
|
||||
{
|
||||
svgWhiteList: this.extensionsWorkbenchService.allowedBadgeProviders
|
||||
});
|
||||
wbeviewElement.mountTo(this.content);
|
||||
const removeLayoutParticipant = arrays.insert(this.layoutParticipants, wbeviewElement);
|
||||
webviewElement.mountTo(this.content);
|
||||
this.contentDisposables.push(webviewElement.onDidFocus(() => this.fireOnDidFocus()));
|
||||
const removeLayoutParticipant = arrays.insert(this.layoutParticipants, webviewElement);
|
||||
this.contentDisposables.push(toDisposable(removeLayoutParticipant));
|
||||
wbeviewElement.contents = body;
|
||||
webviewElement.contents = body;
|
||||
|
||||
wbeviewElement.onDidClickLink(link => {
|
||||
this.contentDisposables.push(webviewElement.onDidClickLink(link => {
|
||||
if (!link) {
|
||||
return;
|
||||
}
|
||||
@@ -563,9 +574,9 @@ export class ExtensionEditor extends BaseEditor {
|
||||
if (['http', 'https', 'mailto'].indexOf(link.scheme) >= 0 || (link.scheme === 'command' && link.path === ShowCurrentReleaseNotesAction.ID)) {
|
||||
this.openerService.open(link);
|
||||
}
|
||||
}, null, this.contentDisposables);
|
||||
this.contentDisposables.push(wbeviewElement);
|
||||
return wbeviewElement;
|
||||
}, null, this.contentDisposables));
|
||||
this.contentDisposables.push(webviewElement);
|
||||
return webviewElement;
|
||||
})
|
||||
.then(undefined, () => {
|
||||
const p = append(this.content, $('p.nocontent'));
|
||||
|
||||
@@ -16,9 +16,9 @@ import { IDisposable, dispose, Disposable } from 'vs/base/common/lifecycle';
|
||||
// {{SQL CARBON EDIT}}
|
||||
import { IExtension, ExtensionState, IExtensionsWorkbenchService, VIEWLET_ID, IExtensionsViewlet, AutoUpdateConfigurationKey, IExtensionContainer, EXTENSIONS_CONFIG, ExtensionsPolicy, ExtensionsPolicyKey } from 'vs/workbench/contrib/extensions/common/extensions';
|
||||
import { ExtensionsConfigurationInitialContent } from 'vs/workbench/contrib/extensions/common/extensionsFileTemplate';
|
||||
import { IExtensionEnablementService, IExtensionTipsService, EnablementState, ExtensionsLabel, IExtensionRecommendation, IGalleryExtension, IExtensionsConfigContent, IExtensionGalleryService, INSTALL_ERROR_MALICIOUS, INSTALL_ERROR_INCOMPATIBLE, IGalleryExtensionVersion, ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionEnablementService, IExtensionTipsService, EnablementState, ExtensionsLabel, IExtensionRecommendation, IGalleryExtension, IExtensionsConfigContent, IExtensionGalleryService, INSTALL_ERROR_MALICIOUS, INSTALL_ERROR_INCOMPATIBLE, IGalleryExtensionVersion, ILocalExtension, IExtensionManagementServerService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { ExtensionType, ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { ExtensionType, ExtensionIdentifier, IExtensionDescription, IExtensionManifest } from 'vs/platform/extensions/common/extensions';
|
||||
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ShowViewletAction } from 'vs/workbench/browser/viewlet';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
@@ -56,6 +56,11 @@ import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/la
|
||||
import { alert } from 'vs/base/browser/ui/aria/aria';
|
||||
import { coalesce } from 'vs/base/common/arrays';
|
||||
import { IWorkbenchThemeService, COLOR_THEME_SETTING, ICON_THEME_SETTING, IFileIconTheme, IColorTheme } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
|
||||
import { isUIExtension } from 'vs/workbench/services/extensions/node/extensionsUtil';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
@@ -145,16 +150,29 @@ export class InstallAction extends ExtensionAction {
|
||||
private static readonly Class = 'extension-action prominent install';
|
||||
private static readonly InstallingClass = 'extension-action install installing';
|
||||
|
||||
private disposables: IDisposable[] = [];
|
||||
|
||||
private _manifest: IExtensionManifest | null;
|
||||
set manifest(manifest: IExtensionManifest) {
|
||||
this._manifest = manifest;
|
||||
this.updateLabel();
|
||||
}
|
||||
|
||||
constructor(
|
||||
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@INotificationService private readonly notificationService: INotificationService,
|
||||
@IOpenerService private readonly openerService: IOpenerService,
|
||||
@IExtensionService private readonly runtimeExtensionService: IExtensionService,
|
||||
@IWorkbenchThemeService private readonly workbenchThemeService: IWorkbenchThemeService
|
||||
@IWorkbenchThemeService private readonly workbenchThemeService: IWorkbenchThemeService,
|
||||
@IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@ILabelService private readonly labelService: ILabelService,
|
||||
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService,
|
||||
) {
|
||||
super(`extensions.install`, InstallAction.INSTALL_LABEL, InstallAction.Class, false);
|
||||
this.update();
|
||||
this.labelService.onDidChangeFormatters(() => this.updateLabel(), this, this.disposables);
|
||||
}
|
||||
|
||||
update(): void {
|
||||
@@ -166,15 +184,28 @@ export class InstallAction extends ExtensionAction {
|
||||
}
|
||||
|
||||
this.enabled = this.extensionsWorkbenchService.canInstall(this.extension) && this.extension.state === ExtensionState.Uninstalled;
|
||||
this.class = this.extension.state === ExtensionState.Installing ? InstallAction.InstallingClass : InstallAction.Class;
|
||||
this.updateLabel();
|
||||
}
|
||||
|
||||
private updateLabel(): void {
|
||||
if (this.extension.state === ExtensionState.Installing) {
|
||||
this.label = InstallAction.INSTALLING_LABEL;
|
||||
this.class = InstallAction.InstallingClass;
|
||||
this.tooltip = InstallAction.INSTALLING_LABEL;
|
||||
} else {
|
||||
this.label = InstallAction.INSTALL_LABEL;
|
||||
this.class = InstallAction.Class;
|
||||
this.tooltip = InstallAction.INSTALL_LABEL;
|
||||
if (this._manifest && this.workbenchEnvironmentService.configuration.remoteAuthority) {
|
||||
if (isUIExtension(this._manifest, this.configurationService)) {
|
||||
this.label = `${InstallAction.INSTALL_LABEL} (${this.extensionManagementServerService.localExtensionManagementServer.label})`;
|
||||
this.tooltip = `${InstallAction.INSTALL_LABEL} (${this.extensionManagementServerService.localExtensionManagementServer.label})`;
|
||||
} else {
|
||||
const host = this.labelService.getHostLabel(REMOTE_HOST_SCHEME, this.workbenchEnvironmentService.configuration.remoteAuthority) || localize('remote', "Remote");
|
||||
this.label = `${InstallAction.INSTALL_LABEL} (${host})`;
|
||||
this.tooltip = `${InstallAction.INSTALL_LABEL} (${host})`;
|
||||
}
|
||||
} else {
|
||||
this.label = InstallAction.INSTALL_LABEL;
|
||||
this.tooltip = InstallAction.INSTALL_LABEL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,7 +216,8 @@ export class InstallAction extends ExtensionAction {
|
||||
|
||||
const extension = await this.install(this.extension);
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
alert(localize('installExtensionComplete', "Installing extension {0} is completed. Please reload Azure Data Studio to enable it.", this.extension.displayName));
|
||||
|
||||
// Add extension object check since ADS third party extensions will be directed to a download page
|
||||
// and the extension object will be undefined.
|
||||
if (extension && extension.local) {
|
||||
@@ -246,6 +278,93 @@ export class InstallAction extends ExtensionAction {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this.disposables = dispose(this.disposables);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
export class RemoteInstallAction extends ExtensionAction {
|
||||
|
||||
private static INSTALL_LABEL = localize('install', "Install");
|
||||
private static INSTALLING_LABEL = localize('installing', "Installing");
|
||||
|
||||
private static readonly Class = 'extension-action prominent install';
|
||||
private static readonly InstallingClass = 'extension-action install installing';
|
||||
|
||||
updateWhenCounterExtensionChanges: boolean = true;
|
||||
private disposables: IDisposable[] = [];
|
||||
private installing: boolean = false;
|
||||
|
||||
constructor(
|
||||
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@ILabelService private readonly labelService: ILabelService,
|
||||
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
|
||||
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
) {
|
||||
super(`extensions.remoteinstall`, RemoteInstallAction.INSTALL_LABEL, RemoteInstallAction.Class, false);
|
||||
this.labelService.onDidChangeFormatters(() => this.updateLabel(), this, this.disposables);
|
||||
this.updateLabel();
|
||||
this.update();
|
||||
}
|
||||
|
||||
private updateLabel(): void {
|
||||
if (this.installing) {
|
||||
this.label = RemoteInstallAction.INSTALLING_LABEL;
|
||||
return;
|
||||
}
|
||||
const remoteAuthority = this.environmentService.configuration.remoteAuthority;
|
||||
if (remoteAuthority) {
|
||||
const host = this.labelService.getHostLabel(REMOTE_HOST_SCHEME, this.environmentService.configuration.remoteAuthority) || localize('remote', "Remote");
|
||||
this.label = `${RemoteInstallAction.INSTALL_LABEL} (${host})`;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
update(): void {
|
||||
this.enabled = false;
|
||||
this.class = RemoteInstallAction.Class;
|
||||
if (this.installing) {
|
||||
this.enabled = true;
|
||||
this.class = RemoteInstallAction.InstallingClass;
|
||||
this.updateLabel();
|
||||
return;
|
||||
}
|
||||
if (this.environmentService.configuration.remoteAuthority
|
||||
// Installed User Extension
|
||||
&& this.extension && this.extension.local && this.extension.type === ExtensionType.User && this.extension.state === ExtensionState.Installed
|
||||
// Local Workspace Extension
|
||||
&& this.extension.server === this.extensionManagementServerService.localExtensionManagementServer && !isUIExtension(this.extension.local.manifest, this.configurationService)
|
||||
// Extension does not exist in remote
|
||||
&& !this.extensionsWorkbenchService.local.some(e => areSameExtensions(e.identifier, this.extension.identifier) && e.server === this.extensionManagementServerService.remoteExtensionManagementServer)
|
||||
&& this.extensionsWorkbenchService.canInstall(this.extension)
|
||||
) {
|
||||
this.enabled = true;
|
||||
this.updateLabel();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
async run(): Promise<void> {
|
||||
if (this.extensionManagementServerService.remoteExtensionManagementServer && !this.installing) {
|
||||
this.installing = true;
|
||||
this.update();
|
||||
this.extensionsWorkbenchService.open(this.extension);
|
||||
alert(localize('installExtensionStart', "Installing extension {0} started. An editor is now open with more details on this extension", this.extension.displayName));
|
||||
if (this.extension.gallery) {
|
||||
await this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.installFromGallery(this.extension.gallery);
|
||||
this.installing = false;
|
||||
this.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this.disposables = dispose(this.disposables);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
export class UninstallAction extends ExtensionAction {
|
||||
@@ -281,19 +400,12 @@ export class UninstallAction extends ExtensionAction {
|
||||
this.label = UninstallAction.UninstallLabel;
|
||||
this.class = UninstallAction.UninstallClass;
|
||||
|
||||
const installedExtensions = this.extensionsWorkbenchService.local.filter(e => areSameExtensions(e.identifier, this.extension.identifier));
|
||||
|
||||
if (!installedExtensions.length) {
|
||||
this.enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (state !== ExtensionState.Installed) {
|
||||
this.enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (installedExtensions[0].type !== ExtensionType.User) {
|
||||
if (this.extension.type !== ExtensionType.User) {
|
||||
this.enabled = false;
|
||||
return;
|
||||
}
|
||||
@@ -330,6 +442,8 @@ export class CombinedInstallAction extends ExtensionAction {
|
||||
this.update();
|
||||
}
|
||||
|
||||
set manifest(manifiest: IExtensionManifest) { this.installAction.manifest = manifiest; this.update(); }
|
||||
|
||||
update(): void {
|
||||
this.installAction.extension = this.extension;
|
||||
this.uninstallAction.extension = this.extension;
|
||||
@@ -901,36 +1015,32 @@ export class CheckForUpdatesAction extends Action {
|
||||
}
|
||||
|
||||
private checkUpdatesAndNotify(): void {
|
||||
this.extensionsWorkbenchService.queryLocal().then(
|
||||
extensions => {
|
||||
const outdatedExtensions = extensions.filter(ext => ext.outdated === true);
|
||||
if (!outdatedExtensions.length) {
|
||||
this.notificationService.info(localize('noUpdatesAvailable', "All Extensions are up to date."));
|
||||
return;
|
||||
}
|
||||
const outdated = this.extensionsWorkbenchService.outdated;
|
||||
if (!outdated.length) {
|
||||
this.notificationService.info(localize('noUpdatesAvailable', "All Extensions are up to date."));
|
||||
return;
|
||||
}
|
||||
|
||||
let msgAvailableExtensions = outdatedExtensions.length === 1 ? localize('singleUpdateAvailable', "An extension update is available.") : localize('updatesAvailable', "{0} extension updates are available.", outdatedExtensions.length);
|
||||
let msgAvailableExtensions = outdated.length === 1 ? localize('singleUpdateAvailable', "An extension update is available.") : localize('updatesAvailable', "{0} extension updates are available.", outdated.length);
|
||||
|
||||
const disabledExtensionsCount = outdatedExtensions.filter(ext => ext.enablementState === EnablementState.Disabled || ext.enablementState === EnablementState.WorkspaceDisabled).length;
|
||||
if (disabledExtensionsCount) {
|
||||
if (outdatedExtensions.length === 1) {
|
||||
msgAvailableExtensions = localize('singleDisabledUpdateAvailable', "An update to an extension which is disabled is available.");
|
||||
} else if (disabledExtensionsCount === 1) {
|
||||
msgAvailableExtensions = localize('updatesAvailableOneDisabled', "{0} extension updates are available. One of them is for a disabled extension.", outdatedExtensions.length);
|
||||
} else if (disabledExtensionsCount === outdatedExtensions.length) {
|
||||
msgAvailableExtensions = localize('updatesAvailableAllDisabled', "{0} extension updates are available. All of them are for disabled extensions.", outdatedExtensions.length);
|
||||
} else {
|
||||
msgAvailableExtensions = localize('updatesAvailableIncludingDisabled', "{0} extension updates are available. {1} of them are for disabled extensions.", outdatedExtensions.length, disabledExtensionsCount);
|
||||
}
|
||||
}
|
||||
|
||||
this.viewletService.openViewlet(VIEWLET_ID, true)
|
||||
.then(viewlet => viewlet as IExtensionsViewlet)
|
||||
.then(viewlet => viewlet.search(''));
|
||||
|
||||
this.notificationService.info(msgAvailableExtensions);
|
||||
const disabledExtensionsCount = outdated.filter(ext => ext.enablementState === EnablementState.Disabled || ext.enablementState === EnablementState.WorkspaceDisabled).length;
|
||||
if (disabledExtensionsCount) {
|
||||
if (outdated.length === 1) {
|
||||
msgAvailableExtensions = localize('singleDisabledUpdateAvailable', "An update to an extension which is disabled is available.");
|
||||
} else if (disabledExtensionsCount === 1) {
|
||||
msgAvailableExtensions = localize('updatesAvailableOneDisabled', "{0} extension updates are available. One of them is for a disabled extension.", outdated.length);
|
||||
} else if (disabledExtensionsCount === outdated.length) {
|
||||
msgAvailableExtensions = localize('updatesAvailableAllDisabled', "{0} extension updates are available. All of them are for disabled extensions.", outdated.length);
|
||||
} else {
|
||||
msgAvailableExtensions = localize('updatesAvailableIncludingDisabled', "{0} extension updates are available. {1} of them are for disabled extensions.", outdated.length, disabledExtensionsCount);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
this.viewletService.openViewlet(VIEWLET_ID, true)
|
||||
.then(viewlet => viewlet as IExtensionsViewlet)
|
||||
.then(viewlet => viewlet.search(''));
|
||||
|
||||
this.notificationService.info(msgAvailableExtensions);
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
@@ -1009,16 +1119,12 @@ export class UpdateAllAction extends Action {
|
||||
this.update();
|
||||
}
|
||||
|
||||
private get outdated(): IExtension[] {
|
||||
return this.extensionsWorkbenchService.local.filter(e => e.outdated && e.state !== ExtensionState.Installing);
|
||||
}
|
||||
|
||||
private update(): void {
|
||||
this.enabled = this.outdated.length > 0;
|
||||
this.enabled = this.extensionsWorkbenchService.outdated.length > 0;
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
return Promise.all(this.outdated.map(e => this.install(e)));
|
||||
return Promise.all(this.extensionsWorkbenchService.outdated.map(e => this.install(e)));
|
||||
}
|
||||
|
||||
private install(extension: IExtension): Promise<any> {
|
||||
@@ -1044,16 +1150,18 @@ export class ReloadAction extends ExtensionAction {
|
||||
private static readonly EnabledClass = 'extension-action reload';
|
||||
private static readonly DisabledClass = `${ReloadAction.EnabledClass} disabled`;
|
||||
|
||||
updateWhenCounterExtensionChanges: boolean = true;
|
||||
private disposables: IDisposable[] = [];
|
||||
private _runningExtensions: IExtensionDescription[] = [];
|
||||
private get runningExtensions(): IExtensionDescription[] { return this._runningExtensions; }
|
||||
private set runningExtensions(runningExtensions: IExtensionDescription[]) { this._runningExtensions = runningExtensions; this.update(); }
|
||||
private _runningExtensions: IExtensionDescription[] | null = null;
|
||||
|
||||
constructor(
|
||||
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@IWindowService private readonly windowService: IWindowService,
|
||||
@IExtensionService private readonly extensionService: IExtensionService,
|
||||
@IExtensionEnablementService private readonly extensionEnablementService: IExtensionEnablementService
|
||||
@IExtensionEnablementService private readonly extensionEnablementService: IExtensionEnablementService,
|
||||
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService,
|
||||
@IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService
|
||||
) {
|
||||
super('extensions.reload', localize('reloadAction', "Reload"), ReloadAction.DisabledClass, false);
|
||||
this.extensionService.onDidChangeExtensions(this.updateRunningExtensions, this, this.disposables);
|
||||
@@ -1061,81 +1169,90 @@ export class ReloadAction extends ExtensionAction {
|
||||
}
|
||||
|
||||
private updateRunningExtensions(): void {
|
||||
this.extensionService.getExtensions().then(runningExtensions => this.runningExtensions = runningExtensions);
|
||||
this.extensionService.getExtensions().then(runningExtensions => { this._runningExtensions = runningExtensions; this.update(); });
|
||||
}
|
||||
|
||||
update(): void {
|
||||
this.enabled = false;
|
||||
this.tooltip = '';
|
||||
if (!this.extension) {
|
||||
if (!this.extension || !this._runningExtensions) {
|
||||
return;
|
||||
}
|
||||
const state = this.extension.state;
|
||||
if (state === ExtensionState.Installing || state === ExtensionState.Uninstalling) {
|
||||
return;
|
||||
}
|
||||
const installed = this.extensionsWorkbenchService.local.filter(e => areSameExtensions(e.identifier, this.extension.identifier))[0];
|
||||
const local = this.extension.local || (installed && installed.local);
|
||||
if (local && local.manifest && local.manifest.contributes && local.manifest.contributes.localizations && local.manifest.contributes.localizations.length > 0) {
|
||||
if (this.extension.local && this.extension.local.manifest && this.extension.local.manifest.contributes && this.extension.local.manifest.contributes.localizations && this.extension.local.manifest.contributes.localizations.length > 0) {
|
||||
return;
|
||||
}
|
||||
this.computeReloadState(installed);
|
||||
this.computeReloadState();
|
||||
this.class = this.enabled ? ReloadAction.EnabledClass : ReloadAction.DisabledClass;
|
||||
}
|
||||
|
||||
private computeReloadState(installed: IExtension): void {
|
||||
private computeReloadState(): void {
|
||||
if (!this._runningExtensions) {
|
||||
return;
|
||||
}
|
||||
const isUninstalled = this.extension.state === ExtensionState.Uninstalled;
|
||||
const isDisabled = this.extension.local ? !this.extensionEnablementService.isEnabled(this.extension.local) : false;
|
||||
const isEnabled = this.extension.local ? this.extensionEnablementService.isEnabled(this.extension.local) : false;
|
||||
const runningExtension = this.runningExtensions.filter(e => areSameExtensions({ id: e.identifier.value }, this.extension.identifier))[0];
|
||||
const runningExtension = this._runningExtensions.filter(e => areSameExtensions({ id: e.identifier.value }, this.extension.identifier))[0];
|
||||
|
||||
if (installed && installed.local) {
|
||||
if (isUninstalled) {
|
||||
if (runningExtension) {
|
||||
const isDifferentVersionRunning = this.extension.version !== runningExtension.version;
|
||||
if (isDifferentVersionRunning && !isDisabled) {
|
||||
if (!(this.extension.local && this.extensionService.canAddExtension(toExtensionDescription(this.extension.local)))) {
|
||||
// Requires reload to run the updated extension
|
||||
this.enabled = true;
|
||||
this.label = localize('reloadRequired', "Reload Required");
|
||||
// {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
|
||||
this.tooltip = localize('postUpdateTooltip', "Please reload Azure Data Studio to complete the updating of this extension.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (isDisabled) {
|
||||
// Requires reload to disable the extension
|
||||
this.enabled = true;
|
||||
this.label = localize('reloadRequired', "Reload Required");
|
||||
// {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
|
||||
this.tooltip = localize('postDisableTooltip', "Please reload Azure Data Studio to complete the disabling of this extension.");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!isDisabled && !(this.extension.local && this.extensionService.canAddExtension(toExtensionDescription(this.extension.local)))) {
|
||||
this.enabled = true;
|
||||
if (isEnabled) {
|
||||
this.label = localize('reloadRequired', "Reload Required");
|
||||
// {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
|
||||
this.tooltip = localize('postEnableTooltip', "Please reload Azure Data Studio to complete the enabling of this extension.");
|
||||
} else {
|
||||
this.label = localize('reloadRequired', "Reload Required");
|
||||
// {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
|
||||
this.tooltip = localize('postInstallTooltip', "Please reload Azure Data Studio to complete the installation of this extension.");
|
||||
alert(localize('installExtensionComplete', "Installing extension {0} is completed. Please reload Azure Data Studio to enable it.", this.extension.displayName));
|
||||
}
|
||||
}
|
||||
this.enabled = true;
|
||||
this.label = localize('reloadRequired', "Reload Required");
|
||||
// {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
|
||||
this.tooltip = localize('postUninstallTooltip', "Please reload Azure Data Studio to complete the uninstallation of this extension.");
|
||||
alert(localize('uninstallExtensionComplete', "Please reload Azure Data Studio to complete the uninstallation of the extension {0}.", this.extension.displayName));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (isUninstalled && runningExtension) {
|
||||
// Requires reload to deactivate the extension
|
||||
this.enabled = true;
|
||||
this.label = localize('reloadRequired', "Reload Required");
|
||||
// {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
|
||||
this.tooltip = localize('postUninstallTooltip', "Please reload Azure Data Studio to complete the uninstallation of this extension.");
|
||||
alert(localize('uninstallExtensionComplete', "Please reload Azure Data Studio to complete the uninstallation of the extension {0}.", this.extension.displayName));
|
||||
return;
|
||||
if (this.extension.local) {
|
||||
const isEnabled = this.extensionEnablementService.isEnabled(this.extension.local);
|
||||
if (runningExtension) {
|
||||
// Extension is running
|
||||
const isSameExtensionRunning = this.extension.server === this.extensionManagementServerService.getExtensionManagementServer(runningExtension.extensionLocation);
|
||||
const isSameVersionRunning = isSameExtensionRunning && this.extension.version === runningExtension.version;
|
||||
if (isEnabled) {
|
||||
if (!isSameVersionRunning && !this.extensionService.canAddExtension(toExtensionDescription(this.extension.local))) {
|
||||
this.enabled = true;
|
||||
this.label = localize('reloadRequired', "Reload Required");
|
||||
// {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
|
||||
this.tooltip = localize('postUpdateTooltip', "Please reload Azure Data Studio to enable the updated extension.");
|
||||
}
|
||||
} else {
|
||||
if (isSameExtensionRunning) {
|
||||
this.enabled = true;
|
||||
this.label = localize('reloadRequired', "Reload Required");
|
||||
// {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
|
||||
this.tooltip = localize('postDisableTooltip', "Please reload Azure Data Studio to disable this extension.");
|
||||
}
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
// Extension is not running
|
||||
if (isEnabled && !this.extensionService.canAddExtension(toExtensionDescription(this.extension.local))) {
|
||||
this.enabled = true;
|
||||
this.label = localize('reloadRequired', "Reload Required");
|
||||
// {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
|
||||
this.tooltip = localize('postEnableTooltip', "Please reload Azure Data Studio to enable this extension.");
|
||||
return;
|
||||
}
|
||||
if (this.workbenchEnvironmentService.configuration.remoteAuthority
|
||||
// Local Workspace Extension
|
||||
&& this.extension.server === this.extensionManagementServerService.localExtensionManagementServer && !isUIExtension(this.extension.local.manifest, this.configurationService)
|
||||
) {
|
||||
const remoteExtension = this.extensionsWorkbenchService.local.filter(e => areSameExtensions(e.identifier, this.extension.identifier) && e.server === this.extensionManagementServerService.remoteExtensionManagementServer)[0];
|
||||
// Extension exist in remote and enabled
|
||||
if (remoteExtension && remoteExtension.local && this.extensionEnablementService.isEnabled(remoteExtension.local)) {
|
||||
this.enabled = true;
|
||||
this.label = localize('reloadRequired', "Reload Required");
|
||||
// {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
|
||||
this.tooltip = localize('postEnableTooltip', "Please reload Azure Data Studio to enable this extension.");
|
||||
alert(localize('installExtensionComplete', "Installing extension {0} is completed. Please reload Azure Data Studio to enable it.", this.extension.displayName));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1394,10 +1511,11 @@ export class ClearExtensionsInputAction extends Action {
|
||||
id: string,
|
||||
label: string,
|
||||
onSearchChange: Event<string>,
|
||||
value: string,
|
||||
@IViewletService private readonly viewletService: IViewletService
|
||||
) {
|
||||
super(id, label, 'clear-extensions', true);
|
||||
this.enabled = false;
|
||||
this.onSearchChange(value);
|
||||
onSearchChange(this.onSearchChange, this, this.disposables);
|
||||
}
|
||||
|
||||
@@ -1893,6 +2011,7 @@ export abstract class AbstractConfigureRecommendedExtensionsAction extends Actio
|
||||
label: string,
|
||||
@IWorkspaceContextService protected contextService: IWorkspaceContextService,
|
||||
@IFileService private readonly fileService: IFileService,
|
||||
@ITextFileService private readonly textFileService: ITextFileService,
|
||||
@IEditorService protected editorService: IEditorService,
|
||||
@IJSONEditingService private readonly jsonEditingService: IJSONEditingService,
|
||||
@ITextModelService private readonly textModelResolverService: ITextModelService
|
||||
@@ -2041,7 +2160,7 @@ export abstract class AbstractConfigureRecommendedExtensionsAction extends Actio
|
||||
return Promise.resolve(this.fileService.resolveContent(extensionsFileResource)).then(content => {
|
||||
return { created: false, extensionsFileResource, content: content.value };
|
||||
}, err => {
|
||||
return this.fileService.updateContent(extensionsFileResource, ExtensionsConfigurationInitialContent).then(() => {
|
||||
return this.textFileService.write(extensionsFileResource, ExtensionsConfigurationInitialContent).then(() => {
|
||||
return { created: true, extensionsFileResource, content: ExtensionsConfigurationInitialContent };
|
||||
});
|
||||
});
|
||||
@@ -2059,12 +2178,13 @@ export class ConfigureWorkspaceRecommendedExtensionsAction extends AbstractConfi
|
||||
id: string,
|
||||
label: string,
|
||||
@IFileService fileService: IFileService,
|
||||
@ITextFileService textFileService: ITextFileService,
|
||||
@IWorkspaceContextService contextService: IWorkspaceContextService,
|
||||
@IEditorService editorService: IEditorService,
|
||||
@IJSONEditingService jsonEditingService: IJSONEditingService,
|
||||
@ITextModelService textModelResolverService: ITextModelService
|
||||
) {
|
||||
super(id, label, contextService, fileService, editorService, jsonEditingService, textModelResolverService);
|
||||
super(id, label, contextService, fileService, textFileService, editorService, jsonEditingService, textModelResolverService);
|
||||
this.contextService.onDidChangeWorkbenchState(() => this.update(), this, this.disposables);
|
||||
this.update();
|
||||
}
|
||||
@@ -2100,13 +2220,14 @@ export class ConfigureWorkspaceFolderRecommendedExtensionsAction extends Abstrac
|
||||
id: string,
|
||||
label: string,
|
||||
@IFileService fileService: IFileService,
|
||||
@ITextFileService textFileService: ITextFileService,
|
||||
@IWorkspaceContextService contextService: IWorkspaceContextService,
|
||||
@IEditorService editorService: IEditorService,
|
||||
@IJSONEditingService jsonEditingService: IJSONEditingService,
|
||||
@ITextModelService textModelResolverService: ITextModelService,
|
||||
@ICommandService private readonly commandService: ICommandService
|
||||
) {
|
||||
super(id, label, contextService, fileService, editorService, jsonEditingService, textModelResolverService);
|
||||
super(id, label, contextService, fileService, textFileService, editorService, jsonEditingService, textModelResolverService);
|
||||
this.contextService.onDidChangeWorkspaceFolders(() => this.update(), this, this.disposables);
|
||||
this.update();
|
||||
}
|
||||
@@ -2145,6 +2266,7 @@ export class AddToWorkspaceFolderRecommendationsAction extends AbstractConfigure
|
||||
id: string,
|
||||
label: string,
|
||||
@IFileService fileService: IFileService,
|
||||
@ITextFileService textFileService: ITextFileService,
|
||||
@IWorkspaceContextService contextService: IWorkspaceContextService,
|
||||
@IEditorService editorService: IEditorService,
|
||||
@IJSONEditingService jsonEditingService: IJSONEditingService,
|
||||
@@ -2152,7 +2274,7 @@ export class AddToWorkspaceFolderRecommendationsAction extends AbstractConfigure
|
||||
@ICommandService private readonly commandService: ICommandService,
|
||||
@INotificationService private readonly notificationService: INotificationService
|
||||
) {
|
||||
super(id, label, contextService, fileService, editorService, jsonEditingService, textModelResolverService);
|
||||
super(id, label, contextService, fileService, textFileService, editorService, jsonEditingService, textModelResolverService);
|
||||
}
|
||||
|
||||
run(shouldRecommend: boolean): Promise<void> {
|
||||
@@ -2228,13 +2350,14 @@ export class AddToWorkspaceRecommendationsAction extends AbstractConfigureRecomm
|
||||
id: string,
|
||||
label: string,
|
||||
@IFileService fileService: IFileService,
|
||||
@ITextFileService textFileService: ITextFileService,
|
||||
@IWorkspaceContextService contextService: IWorkspaceContextService,
|
||||
@IEditorService editorService: IEditorService,
|
||||
@IJSONEditingService jsonEditingService: IJSONEditingService,
|
||||
@ITextModelService textModelResolverService: ITextModelService,
|
||||
@INotificationService private readonly notificationService: INotificationService
|
||||
) {
|
||||
super(id, label, contextService, fileService, editorService, jsonEditingService, textModelResolverService);
|
||||
super(id, label, contextService, fileService, textFileService, editorService, jsonEditingService, textModelResolverService);
|
||||
}
|
||||
|
||||
run(shouldRecommend: boolean): Promise<void> {
|
||||
@@ -2410,6 +2533,103 @@ export class MaliciousStatusLabelAction extends ExtensionAction {
|
||||
}
|
||||
}
|
||||
|
||||
export class SystemDisabledLabelAction extends ExtensionAction {
|
||||
|
||||
private static readonly Class = 'disable-status';
|
||||
|
||||
updateWhenCounterExtensionChanges: boolean = true;
|
||||
private disposables: IDisposable[] = [];
|
||||
|
||||
constructor(
|
||||
private readonly warningAction: SystemDisabledWarningAction,
|
||||
) {
|
||||
super('extensions.systemDisabledLabel', warningAction.tooltip, `${SystemDisabledLabelAction.Class} hide`, false);
|
||||
warningAction.onDidChange(() => this.update(), this, this.disposables);
|
||||
}
|
||||
|
||||
update(): void {
|
||||
this.enabled = this.warningAction.enabled;
|
||||
if (this.enabled) {
|
||||
this.class = SystemDisabledLabelAction.Class;
|
||||
this.label = this.warningAction.tooltip;
|
||||
} else {
|
||||
this.class = `${SystemDisabledLabelAction.Class} hide`;
|
||||
this.label = '';
|
||||
}
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
dispose(this.disposables);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
export class SystemDisabledWarningAction extends ExtensionAction {
|
||||
|
||||
private static readonly Class = 'disable-warning';
|
||||
|
||||
updateWhenCounterExtensionChanges: boolean = true;
|
||||
private disposables: IDisposable[] = [];
|
||||
private _runningExtensions: IExtensionDescription[] | null = null;
|
||||
|
||||
constructor(
|
||||
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@ILabelService private readonly labelService: ILabelService,
|
||||
@IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService,
|
||||
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@IExtensionService private readonly extensionService: IExtensionService,
|
||||
) {
|
||||
super('extensions.install', '', `${SystemDisabledWarningAction.Class} hide`, false);
|
||||
this.labelService.onDidChangeFormatters(() => this.update(), this, this.disposables);
|
||||
this.extensionService.onDidChangeExtensions(this.updateRunningExtensions, this, this.disposables);
|
||||
this.updateRunningExtensions();
|
||||
this.update();
|
||||
}
|
||||
|
||||
private updateRunningExtensions(): void {
|
||||
this.extensionService.getExtensions().then(runningExtensions => { this._runningExtensions = runningExtensions; this.update(); });
|
||||
}
|
||||
|
||||
update(): void {
|
||||
this.enabled = false;
|
||||
this.class = `${SystemDisabledWarningAction.Class} hide`;
|
||||
this.tooltip = '';
|
||||
if (this.extension && this.extension.local && this._runningExtensions) {
|
||||
if (
|
||||
// Remote Window
|
||||
this.workbenchEnvironmentService.configuration.remoteAuthority
|
||||
// Local Workspace Extension
|
||||
&& this.extension.server === this.extensionManagementServerService.localExtensionManagementServer && !isUIExtension(this.extension.local.manifest, this.configurationService)
|
||||
// Extension does not exist in remote
|
||||
&& !this.extensionsWorkbenchService.local.some(e => areSameExtensions(e.identifier, this.extension.identifier) && e.server === this.extensionManagementServerService.remoteExtensionManagementServer)
|
||||
) {
|
||||
this.enabled = true;
|
||||
this.class = `${SystemDisabledWarningAction.Class}`;
|
||||
const host = this.labelService.getHostLabel(REMOTE_HOST_SCHEME, this.workbenchEnvironmentService.configuration.remoteAuthority) || localize('remote', "Remote");
|
||||
this.tooltip = localize('disabled workspace Extension', "This extension is disabled because it cannot run in a window connected to the remote server.", host, host);
|
||||
if (this.extensionsWorkbenchService.canInstall(this.extension)) {
|
||||
this.tooltip = `${this.tooltip} ${localize('Install in remote server', "Install it in '{0}' server to enable.", host)}`;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
dispose(this.disposables);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
export class DisableAllAction extends Action {
|
||||
|
||||
static readonly ID = 'workbench.extensions.action.disableAll';
|
||||
|
||||
@@ -12,8 +12,8 @@ import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list';
|
||||
import { IPagedRenderer } from 'vs/base/browser/ui/list/listPaging';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { domEvent } from 'vs/base/browser/event';
|
||||
import { IExtension, IExtensionsWorkbenchService, ExtensionContainers } from 'vs/workbench/contrib/extensions/common/extensions';
|
||||
import { InstallAction, UpdateAction, ManageExtensionAction, ReloadAction, MaliciousStatusLabelAction, ExtensionActionItem, StatusLabelAction } from 'vs/workbench/contrib/extensions/electron-browser/extensionsActions';
|
||||
import { IExtension, ExtensionContainers, ExtensionState, IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions';
|
||||
import { InstallAction, UpdateAction, ManageExtensionAction, ReloadAction, MaliciousStatusLabelAction, ExtensionActionItem, StatusLabelAction, RemoteInstallAction, SystemDisabledWarningAction } from 'vs/workbench/contrib/extensions/electron-browser/extensionsActions';
|
||||
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { Label, RatingsWidget, InstallCountWidget, RecommendationWidget, RemoteBadgeWidget } from 'vs/workbench/contrib/extensions/electron-browser/extensionsWidgets';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
@@ -54,9 +54,9 @@ export class Renderer implements IPagedRenderer<IExtension, ITemplateData> {
|
||||
private extensionViewState: IExtensionsViewState,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@INotificationService private readonly notificationService: INotificationService,
|
||||
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@IExtensionService private readonly extensionService: IExtensionService,
|
||||
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService
|
||||
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService,
|
||||
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService
|
||||
) { }
|
||||
|
||||
get templateId() { return 'extension'; }
|
||||
@@ -100,7 +100,9 @@ export class Renderer implements IPagedRenderer<IExtension, ITemplateData> {
|
||||
this.instantiationService.createInstance(UpdateAction),
|
||||
this.instantiationService.createInstance(ReloadAction),
|
||||
this.instantiationService.createInstance(InstallAction),
|
||||
this.instantiationService.createInstance(RemoteInstallAction),
|
||||
this.instantiationService.createInstance(MaliciousStatusLabelAction, false),
|
||||
this.instantiationService.createInstance(SystemDisabledWarningAction),
|
||||
this.instantiationService.createInstance(ManageExtensionAction)
|
||||
];
|
||||
const extensionContainers: ExtensionContainers = this.instantiationService.createInstance(ExtensionContainers, [...actions, ...widgets]);
|
||||
@@ -136,23 +138,18 @@ export class Renderer implements IPagedRenderer<IExtension, ITemplateData> {
|
||||
renderElement(extension: IExtension, index: number, data: ITemplateData): void {
|
||||
removeClass(data.element, 'loading');
|
||||
|
||||
if (extension.state !== ExtensionState.Uninstalled && !extension.server) {
|
||||
// Get the extension if it is installed and has no server information
|
||||
extension = this.extensionsWorkbenchService.local.filter(e => e.server === extension.server && areSameExtensions(e.identifier, extension.identifier))[0] || extension;
|
||||
}
|
||||
|
||||
data.extensionDisposables = dispose(data.extensionDisposables);
|
||||
|
||||
const updateEnablement = async () => {
|
||||
const runningExtensions = await this.extensionService.getExtensions();
|
||||
const installed = this.extensionsWorkbenchService.local.filter(e => areSameExtensions(e.identifier, extension.identifier))[0];
|
||||
if (installed && installed.local) {
|
||||
const installedExtensionServer = this.extensionManagementServerService.getExtensionManagementServer(installed.local.location);
|
||||
const isSameExtensionRunning = runningExtensions.some(e => {
|
||||
if (!areSameExtensions({ id: e.identifier.value }, extension.identifier)) {
|
||||
return false;
|
||||
}
|
||||
const runningExtensionServer = this.extensionManagementServerService.getExtensionManagementServer(e.extensionLocation);
|
||||
if (!installedExtensionServer || !runningExtensionServer) {
|
||||
return false;
|
||||
}
|
||||
return installedExtensionServer.authority === runningExtensionServer.authority;
|
||||
});
|
||||
if (extension.local) {
|
||||
const runningExtension = runningExtensions.filter(e => areSameExtensions({ id: e.identifier.value }, extension.identifier))[0];
|
||||
const isSameExtensionRunning = runningExtension && extension.server === this.extensionManagementServerService.getExtensionManagementServer(runningExtension.extensionLocation);
|
||||
toggleClass(data.root, 'disabled', !isSameExtensionRunning);
|
||||
} else {
|
||||
removeClass(data.root, 'disabled');
|
||||
|
||||
@@ -24,9 +24,9 @@ import {
|
||||
ShowOutdatedExtensionsAction, ClearExtensionsInputAction, ChangeSortAction, UpdateAllAction, CheckForUpdatesAction, DisableAllAction, EnableAllAction,
|
||||
EnableAutoUpdateAction, DisableAutoUpdateAction, ShowBuiltInExtensionsAction, InstallVSIXAction
|
||||
} from 'vs/workbench/contrib/extensions/electron-browser/extensionsActions';
|
||||
import { IExtensionManagementService, IExtensionManagementServerService, IExtensionManagementServer, EnablementState } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionManagementService, IExtensionManagementServerService, IExtensionManagementServer, IExtensionEnablementService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { ExtensionsInput } from 'vs/workbench/contrib/extensions/common/extensionsInput';
|
||||
import { ExtensionsListView, EnabledExtensionsView, DisabledExtensionsView, RecommendedExtensionsView, WorkspaceRecommendedExtensionsView, BuiltInExtensionsView, BuiltInThemesExtensionsView, BuiltInBasicsExtensionsView, GroupByServerExtensionsView, DefaultRecommendedExtensionsView } from './extensionsViews';
|
||||
import { ExtensionsListView, EnabledExtensionsView, DisabledExtensionsView, RecommendedExtensionsView, WorkspaceRecommendedExtensionsView, BuiltInExtensionsView, BuiltInThemesExtensionsView, BuiltInBasicsExtensionsView, ServerExtensionsView, DefaultRecommendedExtensionsView } from './extensionsViews';
|
||||
import { OpenGlobalSettingsAction } from 'vs/workbench/contrib/preferences/browser/preferencesActions';
|
||||
import { IProgressService2, ProgressLocation } from 'vs/platform/progress/common/progress';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
@@ -35,7 +35,6 @@ import { IActivityService, ProgressBadge, NumberBadge } from 'vs/workbench/servi
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IViewsRegistry, IViewDescriptor, Extensions } from 'vs/workbench/common/views';
|
||||
import { ViewContainerViewlet } from 'vs/workbench/browser/parts/views/viewsViewlet';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
|
||||
import { IContextKeyService, ContextKeyExpr, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
@@ -54,6 +53,8 @@ import { createErrorWithActions } from 'vs/base/common/errorsWithActions';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { ExtensionType } from 'vs/platform/extensions/common/extensions';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { RemoteAuthorityContext as RemoteAuthorityContext } from 'vs/workbench/common/contextkeys';
|
||||
import { ViewContainerViewlet } from 'vs/workbench/browser/parts/views/viewsViewlet';
|
||||
|
||||
interface SearchInputEvent extends Event {
|
||||
target: HTMLInputElement;
|
||||
@@ -61,12 +62,13 @@ interface SearchInputEvent extends Event {
|
||||
}
|
||||
|
||||
const NonEmptyWorkspaceContext = new RawContextKey<boolean>('nonEmptyWorkspace', false);
|
||||
const SearchExtensionsContext = new RawContextKey<boolean>('searchExtensions', false);
|
||||
const DefaultViewsContext = new RawContextKey<boolean>('defaultExtensionViews', true);
|
||||
const SearchMarketplaceExtensionsContext = new RawContextKey<boolean>('searchMarketplaceExtensions', false);
|
||||
const SearchServerExtensionsContext = new RawContextKey<boolean>('searchServerExtensions', false);
|
||||
const HasInstalledExtensionsContext = new RawContextKey<boolean>('hasInstalledExtensions', true);
|
||||
const SearchBuiltInExtensionsContext = new RawContextKey<boolean>('searchBuiltInExtensions', false);
|
||||
const RecommendedExtensionsContext = new RawContextKey<boolean>('recommendedExtensions', false);
|
||||
const DefaultRecommendedExtensionsContext = new RawContextKey<boolean>('defaultRecommendedExtensions', false);
|
||||
const GroupByServersContext = new RawContextKey<boolean>('groupByServersContext', false);
|
||||
const viewIdNameMappings: { [id: string]: string } = {
|
||||
'extensions.listView': localize('marketPlace', "Marketplace"),
|
||||
'extensions.enabledExtensionList': localize('enabledExtensions', "Enabled"),
|
||||
@@ -92,10 +94,10 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
|
||||
private registerViews(): void {
|
||||
let viewDescriptors: IViewDescriptor[] = [];
|
||||
viewDescriptors.push(this.createMarketPlaceExtensionsListViewDescriptor());
|
||||
viewDescriptors.push(this.createEnabledExtensionsListViewDescriptor());
|
||||
viewDescriptors.push(this.createDisabledExtensionsListViewDescriptor());
|
||||
viewDescriptors.push(this.createDefaultEnabledExtensionsListViewDescriptor());
|
||||
viewDescriptors.push(this.createDefaultDisabledExtensionsListViewDescriptor());
|
||||
// {{SQL CARBON EDIT}}
|
||||
// viewDescriptors.push(this.createPopularExtensionsListViewDescriptor());
|
||||
// viewDescriptors.push(this.createDefaultPopularExtensionsListViewDescriptor());
|
||||
viewDescriptors.push(this.createBuiltInExtensionsListViewDescriptor());
|
||||
viewDescriptors.push(this.createBuiltInBasicsExtensionsListViewDescriptor());
|
||||
viewDescriptors.push(this.createBuiltInThemesExtensionsListViewDescriptor());
|
||||
@@ -103,8 +105,8 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
|
||||
viewDescriptors.push(this.createOtherRecommendedExtensionsListViewDescriptor());
|
||||
viewDescriptors.push(this.createWorkspaceRecommendedExtensionsListViewDescriptor());
|
||||
|
||||
viewDescriptors.push(...this.createExtensionsViewDescriptorsForServer(this.extensionManagementServerService.localExtensionManagementServer));
|
||||
if (this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
viewDescriptors.push(...this.createExtensionsViewDescriptorsForServer(this.extensionManagementServerService.localExtensionManagementServer));
|
||||
viewDescriptors.push(...this.createExtensionsViewDescriptorsForServer(this.extensionManagementServerService.remoteExtensionManagementServer));
|
||||
}
|
||||
|
||||
@@ -118,20 +120,20 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
|
||||
id,
|
||||
name: viewIdNameMappings[id],
|
||||
ctorDescriptor: { ctor: ExtensionsListView },
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.has('searchExtensions'), ContextKeyExpr.not('searchInstalledExtensions'), ContextKeyExpr.not('searchBuiltInExtensions'), ContextKeyExpr.not('recommendedExtensions'), ContextKeyExpr.not('groupByServersContext')),
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.has('searchMarketplaceExtensions')),
|
||||
weight: 100
|
||||
};
|
||||
}
|
||||
|
||||
// Separate view for enabled extensions required as we need to show enabled, disabled and recommended sections
|
||||
// in the default view when there is no search text, but user has installed extensions.
|
||||
private createEnabledExtensionsListViewDescriptor(): IViewDescriptor {
|
||||
private createDefaultEnabledExtensionsListViewDescriptor(): IViewDescriptor {
|
||||
const id = 'extensions.enabledExtensionList';
|
||||
return {
|
||||
id,
|
||||
name: viewIdNameMappings[id],
|
||||
ctorDescriptor: { ctor: EnabledExtensionsView },
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.not('searchExtensions'), ContextKeyExpr.has('hasInstalledExtensions')),
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.has('defaultExtensionViews'), ContextKeyExpr.has('hasInstalledExtensions'), RemoteAuthorityContext.isEqualTo('')),
|
||||
weight: 40,
|
||||
canToggleVisibility: true,
|
||||
order: 1
|
||||
@@ -140,13 +142,13 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
|
||||
|
||||
// Separate view for disabled extensions required as we need to show enabled, disabled and recommended sections
|
||||
// in the default view when there is no search text, but user has installed extensions.
|
||||
private createDisabledExtensionsListViewDescriptor(): IViewDescriptor {
|
||||
private createDefaultDisabledExtensionsListViewDescriptor(): IViewDescriptor {
|
||||
const id = 'extensions.disabledExtensionList';
|
||||
return {
|
||||
id,
|
||||
name: viewIdNameMappings[id],
|
||||
ctorDescriptor: { ctor: DisabledExtensionsView },
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.not('searchExtensions'), ContextKeyExpr.has('hasInstalledExtensions')),
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.has('defaultExtensionViews'), ContextKeyExpr.has('hasInstalledExtensions'), RemoteAuthorityContext.isEqualTo('')),
|
||||
weight: 10,
|
||||
canToggleVisibility: true,
|
||||
order: 3,
|
||||
@@ -154,28 +156,36 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
|
||||
};
|
||||
}
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
// // Separate view for popular extensions required as we need to show popular and recommended sections
|
||||
// // in the default view when there is no search text, and user has no installed extensions.
|
||||
// private createPopularExtensionsListViewDescriptor(): IViewDescriptor {
|
||||
// const id = 'extensions.popularExtensionsList';
|
||||
// return {
|
||||
// id,
|
||||
// name: viewIdNameMappings[id],
|
||||
// ctorDescriptor: { ctor: ExtensionsListView },
|
||||
// when: ContextKeyExpr.and(ContextKeyExpr.not('searchExtensions'), ContextKeyExpr.not('hasInstalledExtensions')),
|
||||
// weight: 60,
|
||||
// order: 1
|
||||
// };
|
||||
// }
|
||||
/* // {{SQL CARBON EDIT}}
|
||||
// Separate view for popular extensions required as we need to show popular and recommended sections
|
||||
// in the default view when there is no search text, and user has no installed extensions.
|
||||
private createDefaultPopularExtensionsListViewDescriptor(): IViewDescriptor {
|
||||
const id = 'extensions.popularExtensionsList';
|
||||
return {
|
||||
id,
|
||||
name: viewIdNameMappings[id],
|
||||
ctorDescriptor: { ctor: ExtensionsListView },
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.has('defaultExtensionViews'), ContextKeyExpr.not('hasInstalledExtensions')),
|
||||
weight: 60,
|
||||
order: 1
|
||||
};
|
||||
}
|
||||
*/
|
||||
|
||||
private createExtensionsViewDescriptorsForServer(server: IExtensionManagementServer): IViewDescriptor[] {
|
||||
return [{
|
||||
id: `server.extensionsList.${server.authority}`,
|
||||
id: `extensions.${server.authority}.installed`,
|
||||
name: server.label,
|
||||
ctorDescriptor: { ctor: GroupByServerExtensionsView },
|
||||
when: ContextKeyExpr.has('groupByServersContext'),
|
||||
ctorDescriptor: { ctor: ServerExtensionsView, arguments: [server] },
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.has('searchServerExtensions')),
|
||||
weight: 100
|
||||
}, {
|
||||
id: `extensions.${server.authority}.default`,
|
||||
name: server.label,
|
||||
ctorDescriptor: { ctor: ServerExtensionsView, arguments: [server] },
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.has('defaultExtensionViews'), ContextKeyExpr.has('hasInstalledExtensions'), RemoteAuthorityContext.notEqualsTo('')),
|
||||
weight: 40,
|
||||
order: 1
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -188,7 +198,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
|
||||
id,
|
||||
name: viewIdNameMappings[id],
|
||||
ctorDescriptor: { ctor: DefaultRecommendedExtensionsView },
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.not('searchExtensions'), ContextKeyExpr.has('defaultRecommendedExtensions')),
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.has('defaultExtensionViews'), ContextKeyExpr.has('defaultRecommendedExtensions')),
|
||||
weight: 40,
|
||||
order: 2,
|
||||
canToggleVisibility: true
|
||||
@@ -266,10 +276,11 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio
|
||||
|
||||
private onSearchChange: EventOf<string>;
|
||||
private nonEmptyWorkspaceContextKey: IContextKey<boolean>;
|
||||
private searchExtensionsContextKey: IContextKey<boolean>;
|
||||
private defaultViewsContextKey: IContextKey<boolean>;
|
||||
private searchMarketplaceExtensionsContextKey: IContextKey<boolean>;
|
||||
private searchServerExtensionsContextKey: IContextKey<boolean>;
|
||||
private hasInstalledExtensionsContextKey: IContextKey<boolean>;
|
||||
private searchBuiltInExtensionsContextKey: IContextKey<boolean>;
|
||||
private groupByServersContextKey: IContextKey<boolean>;
|
||||
private recommendedExtensionsContextKey: IContextKey<boolean>;
|
||||
private defaultRecommendedExtensionsContextKey: IContextKey<boolean>;
|
||||
|
||||
@@ -304,11 +315,12 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio
|
||||
|
||||
this.searchDelayer = new Delayer(500);
|
||||
this.nonEmptyWorkspaceContextKey = NonEmptyWorkspaceContext.bindTo(contextKeyService);
|
||||
this.searchExtensionsContextKey = SearchExtensionsContext.bindTo(contextKeyService);
|
||||
this.defaultViewsContextKey = DefaultViewsContext.bindTo(contextKeyService);
|
||||
this.searchMarketplaceExtensionsContextKey = SearchMarketplaceExtensionsContext.bindTo(contextKeyService);
|
||||
this.searchServerExtensionsContextKey = SearchServerExtensionsContext.bindTo(contextKeyService);
|
||||
this.hasInstalledExtensionsContextKey = HasInstalledExtensionsContext.bindTo(contextKeyService);
|
||||
this.searchBuiltInExtensionsContextKey = SearchBuiltInExtensionsContext.bindTo(contextKeyService);
|
||||
this.recommendedExtensionsContextKey = RecommendedExtensionsContext.bindTo(contextKeyService);
|
||||
this.groupByServersContextKey = GroupByServersContext.bindTo(contextKeyService);
|
||||
this.defaultRecommendedExtensionsContextKey = DefaultRecommendedExtensionsContext.bindTo(contextKeyService);
|
||||
this.defaultRecommendedExtensionsContextKey.set(!this.configurationService.getValue<boolean>(ShowRecommendationsOnlyOnDemandKey));
|
||||
this.disposables.push(this.viewletService.onDidViewletOpen(this.onViewletOpen, this, this.disposables));
|
||||
@@ -393,7 +405,7 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio
|
||||
getActions(): IAction[] {
|
||||
if (!this.primaryActions) {
|
||||
this.primaryActions = [
|
||||
this.instantiationService.createInstance(ClearExtensionsInputAction, ClearExtensionsInputAction.ID, ClearExtensionsInputAction.LABEL, this.onSearchChange)
|
||||
this.instantiationService.createInstance(ClearExtensionsInputAction, ClearExtensionsInputAction.ID, ClearExtensionsInputAction.LABEL, this.onSearchChange, this.searchBox.getValue())
|
||||
];
|
||||
}
|
||||
return this.primaryActions;
|
||||
@@ -455,19 +467,20 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio
|
||||
|
||||
private doSearch(): Promise<void> {
|
||||
const value = this.normalizedQuery();
|
||||
this.searchExtensionsContextKey.set(!!value);
|
||||
this.searchBuiltInExtensionsContextKey.set(ExtensionsListView.isBuiltInExtensionsQuery(value));
|
||||
this.groupByServersContextKey.set(ExtensionsListView.isGroupByServersExtensionsQuery(value));
|
||||
this.recommendedExtensionsContextKey.set(ExtensionsListView.isRecommendedExtensionsQuery(value));
|
||||
this.defaultViewsContextKey.set(!value);
|
||||
const isServerExtensionsQuery = ExtensionsListView.isServerExtensionsQuery(value);
|
||||
const isBuiltInExtensionsQuery = ExtensionsListView.isBuiltInExtensionsQuery(value);
|
||||
const isRecommendedExtensionsQuery = ExtensionsListView.isRecommendedExtensionsQuery(value);
|
||||
this.searchServerExtensionsContextKey.set(isServerExtensionsQuery);
|
||||
this.searchBuiltInExtensionsContextKey.set(isBuiltInExtensionsQuery);
|
||||
this.recommendedExtensionsContextKey.set(isRecommendedExtensionsQuery);
|
||||
this.searchMarketplaceExtensionsContextKey.set(!!value && !isServerExtensionsQuery && !isBuiltInExtensionsQuery && !isRecommendedExtensionsQuery);
|
||||
this.nonEmptyWorkspaceContextKey.set(this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY);
|
||||
|
||||
if (value) {
|
||||
return this.progress(Promise.all(this.panels.map(view =>
|
||||
(<ExtensionsListView>view).show(this.normalizedQuery())
|
||||
.then(model => this.alertSearchResult(model.length, view.id))
|
||||
))).then(() => undefined);
|
||||
}
|
||||
return Promise.resolve();
|
||||
return this.progress(Promise.all(this.panels.map(view =>
|
||||
(<ExtensionsListView>view).show(this.normalizedQuery())
|
||||
.then(model => this.alertSearchResult(model.length, view.id))
|
||||
))).then(() => undefined);
|
||||
}
|
||||
|
||||
protected onDidAddViews(added: IAddedViewDescriptorRef[]): ViewletPanel[] {
|
||||
@@ -565,7 +578,8 @@ export class StatusUpdater implements IWorkbenchContribution {
|
||||
|
||||
constructor(
|
||||
@IActivityService private readonly activityService: IActivityService,
|
||||
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService
|
||||
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@IExtensionEnablementService private readonly extensionEnablementService: IExtensionEnablementService
|
||||
) {
|
||||
extensionsWorkbenchService.onChange(this.onServiceChange, this, this.disposables);
|
||||
}
|
||||
@@ -579,7 +593,7 @@ export class StatusUpdater implements IWorkbenchContribution {
|
||||
return;
|
||||
}
|
||||
|
||||
const outdated = this.extensionsWorkbenchService.local.reduce((r, e) => r + (e.outdated && e.enablementState !== EnablementState.Disabled && e.enablementState !== EnablementState.WorkspaceDisabled ? 1 : 0), 0);
|
||||
const outdated = this.extensionsWorkbenchService.outdated.reduce((r, e) => r + (this.extensionEnablementService.isEnabled(e.local!) ? 1 : 0), 0);
|
||||
if (outdated > 0) {
|
||||
const badge = new NumberBadge(outdated, n => localize('outdatedExtensions', '{0} Outdated Extensions', n));
|
||||
this.badgeHandle = this.activityService.showActivity(VIEWLET_ID, badge, 'extensions-badge count-badge');
|
||||
|
||||
@@ -9,7 +9,7 @@ import { assign } from 'vs/base/common/objects';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { isPromiseCanceledError } from 'vs/base/common/errors';
|
||||
import { PagedModel, IPagedModel, IPager, DelayedPagedModel } from 'vs/base/common/paging';
|
||||
import { SortBy, SortOrder, IQueryOptions, IExtensionTipsService, IExtensionRecommendation } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { SortBy, SortOrder, IQueryOptions, IExtensionTipsService, IExtensionRecommendation, IExtensionManagementServer } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
@@ -45,6 +45,9 @@ import { ExtensionType } from 'vs/platform/extensions/common/extensions';
|
||||
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import { CancelablePromise, createCancelablePromise } from 'vs/base/common/async';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
|
||||
|
||||
class ExtensionsViewState extends Disposable implements IExtensionsViewState {
|
||||
|
||||
@@ -63,8 +66,13 @@ class ExtensionsViewState extends Disposable implements IExtensionsViewState {
|
||||
}
|
||||
}
|
||||
|
||||
export interface ExtensionsListViewOptions extends IViewletViewOptions {
|
||||
server?: IExtensionManagementServer;
|
||||
}
|
||||
|
||||
export class ExtensionsListView extends ViewletPanel {
|
||||
|
||||
private readonly server: IExtensionManagementServer | undefined;
|
||||
private messageBox: HTMLElement;
|
||||
private extensionsList: HTMLElement;
|
||||
private badge: CountBadge;
|
||||
@@ -73,7 +81,7 @@ export class ExtensionsListView extends ViewletPanel {
|
||||
private queryRequest: { query: string, request: CancelablePromise<IPagedModel<IExtension>> } | null;
|
||||
|
||||
constructor(
|
||||
private options: IViewletViewOptions,
|
||||
options: ExtensionsListViewOptions,
|
||||
@INotificationService protected notificationService: INotificationService,
|
||||
@IKeybindingService keybindingService: IKeybindingService,
|
||||
@IContextMenuService contextMenuService: IContextMenuService,
|
||||
@@ -91,6 +99,7 @@ export class ExtensionsListView extends ViewletPanel {
|
||||
@IWorkbenchThemeService private readonly workbenchThemeService: IWorkbenchThemeService
|
||||
) {
|
||||
super({ ...(options as IViewletPanelOptions), ariaHeaderLabel: options.title }, keybindingService, contextMenuService, configurationService);
|
||||
this.server = options.server;
|
||||
}
|
||||
|
||||
protected renderHeader(container: HTMLElement): void {
|
||||
@@ -98,7 +107,7 @@ export class ExtensionsListView extends ViewletPanel {
|
||||
}
|
||||
|
||||
renderHeaderTitle(container: HTMLElement): void {
|
||||
super.renderHeaderTitle(container, this.options.title);
|
||||
super.renderHeaderTitle(container, this.title);
|
||||
|
||||
this.badgeContainer = append(container, $('.count-badge-wrapper'));
|
||||
this.badge = new CountBadge(this.badgeContainer);
|
||||
@@ -233,7 +242,7 @@ export class ExtensionsListView extends ViewletPanel {
|
||||
|
||||
private async queryByIds(ids: string[], options: IQueryOptions, token: CancellationToken): Promise<IPagedModel<IExtension>> {
|
||||
const idsSet: Set<string> = ids.reduce((result, id) => { result.add(id.toLowerCase()); return result; }, new Set<string>());
|
||||
const result = (await this.extensionsWorkbenchService.queryLocal())
|
||||
const result = (await this.extensionsWorkbenchService.queryLocal(this.server))
|
||||
.filter(e => idsSet.has(e.identifier.id.toLowerCase()));
|
||||
|
||||
if (result.length) {
|
||||
@@ -261,7 +270,7 @@ export class ExtensionsListView extends ViewletPanel {
|
||||
}
|
||||
|
||||
value = value.replace(/@builtin/g, '').replace(/@sort:(\w+)(-\w*)?/g, '').trim().toLowerCase();
|
||||
let result = await this.extensionsWorkbenchService.queryLocal();
|
||||
let result = await this.extensionsWorkbenchService.queryLocal(this.server);
|
||||
|
||||
result = result
|
||||
.filter(e => e.type === ExtensionType.System && (e.name.toLowerCase().indexOf(value) > -1 || e.displayName.toLowerCase().indexOf(value) > -1));
|
||||
@@ -313,7 +322,7 @@ export class ExtensionsListView extends ViewletPanel {
|
||||
// Show installed extensions
|
||||
value = value.replace(/@installed/g, '').replace(/@sort:(\w+)(-\w*)?/g, '').trim().toLowerCase();
|
||||
|
||||
let result = await this.extensionsWorkbenchService.queryLocal();
|
||||
let result = await this.extensionsWorkbenchService.queryLocal(this.server);
|
||||
|
||||
result = result
|
||||
.filter(e => e.type === ExtensionType.User
|
||||
@@ -327,7 +336,7 @@ export class ExtensionsListView extends ViewletPanel {
|
||||
if (/@outdated/i.test(value)) {
|
||||
value = value.replace(/@outdated/g, '').replace(/@sort:(\w+)(-\w*)?/g, '').trim().toLowerCase();
|
||||
|
||||
const local = await this.extensionsWorkbenchService.queryLocal();
|
||||
const local = await this.extensionsWorkbenchService.queryLocal(this.server);
|
||||
const result = local
|
||||
.sort((e1, e2) => e1.displayName.localeCompare(e2.displayName))
|
||||
.filter(extension => extension.outdated
|
||||
@@ -340,7 +349,7 @@ export class ExtensionsListView extends ViewletPanel {
|
||||
if (/@disabled/i.test(value)) {
|
||||
value = value.replace(/@disabled/g, '').replace(/@sort:(\w+)(-\w*)?/g, '').trim().toLowerCase();
|
||||
|
||||
const local = await this.extensionsWorkbenchService.queryLocal();
|
||||
const local = await this.extensionsWorkbenchService.queryLocal(this.server);
|
||||
const runningExtensions = await this.extensionService.getExtensions();
|
||||
|
||||
const result = local
|
||||
@@ -355,7 +364,7 @@ export class ExtensionsListView extends ViewletPanel {
|
||||
if (/@enabled/i.test(value)) {
|
||||
value = value ? value.replace(/@enabled/g, '').replace(/@sort:(\w+)(-\w*)?/g, '').trim().toLowerCase() : '';
|
||||
|
||||
const local = (await this.extensionsWorkbenchService.queryLocal()).filter(e => e.type === ExtensionType.User);
|
||||
const local = (await this.extensionsWorkbenchService.queryLocal(this.server)).filter(e => e.type === ExtensionType.User);
|
||||
const runningExtensions = await this.extensionService.getExtensions();
|
||||
|
||||
const result = local
|
||||
@@ -485,7 +494,7 @@ export class ExtensionsListView extends ViewletPanel {
|
||||
private getAllRecommendationsModel(query: Query, options: IQueryOptions, token: CancellationToken): Promise<IPagedModel<IExtension>> {
|
||||
const value = query.value.replace(/@recommended:all/g, '').replace(/@recommended/g, '').trim().toLowerCase();
|
||||
|
||||
return this.extensionsWorkbenchService.queryLocal()
|
||||
return this.extensionsWorkbenchService.queryLocal(this.server)
|
||||
.then(result => result.filter(e => e.type === ExtensionType.User))
|
||||
.then(local => {
|
||||
const fileBasedRecommendations = this.tipsService.getFileBasedRecommendations();
|
||||
@@ -540,7 +549,7 @@ export class ExtensionsListView extends ViewletPanel {
|
||||
private getRecommendationsModel(query: Query, options: IQueryOptions, token: CancellationToken): Promise<IPagedModel<IExtension>> {
|
||||
const value = query.value.replace(/@recommended/g, '').trim().toLowerCase();
|
||||
|
||||
return this.extensionsWorkbenchService.queryLocal()
|
||||
return this.extensionsWorkbenchService.queryLocal(this.server)
|
||||
.then(result => result.filter(e => e.type === ExtensionType.User))
|
||||
.then(local => {
|
||||
let fileBasedRecommendations = this.tipsService.getFileBasedRecommendations();
|
||||
@@ -780,8 +789,8 @@ export class ExtensionsListView extends ViewletPanel {
|
||||
return /@installed|@outdated|@enabled|@disabled/i.test(query);
|
||||
}
|
||||
|
||||
static isGroupByServersExtensionsQuery(query: string): boolean {
|
||||
return !!Query.parse(query).groupBy;
|
||||
static isServerExtensionsQuery(query: string): boolean {
|
||||
return /@installed|@outdated/i.test(query);
|
||||
}
|
||||
|
||||
static isRecommendedExtensionsQuery(query: string): boolean {
|
||||
@@ -818,10 +827,40 @@ export class ExtensionsListView extends ViewletPanel {
|
||||
}
|
||||
}
|
||||
|
||||
export class GroupByServerExtensionsView extends ExtensionsListView {
|
||||
function getServerLabel(server: IExtensionManagementServer, labelService: ILabelService, workbenchEnvironmentService: IWorkbenchEnvironmentService): string {
|
||||
return workbenchEnvironmentService.configuration.remoteAuthority === server.authority ? labelService.getHostLabel(REMOTE_HOST_SCHEME, server.authority) || server.label : server.label;
|
||||
}
|
||||
|
||||
export class ServerExtensionsView extends ExtensionsListView {
|
||||
|
||||
constructor(
|
||||
server: IExtensionManagementServer,
|
||||
options: ExtensionsListViewOptions,
|
||||
@INotificationService notificationService: INotificationService,
|
||||
@IKeybindingService keybindingService: IKeybindingService,
|
||||
@IContextMenuService contextMenuService: IContextMenuService,
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IExtensionService extensionService: IExtensionService,
|
||||
@IEditorService editorService: IEditorService,
|
||||
@IExtensionTipsService tipsService: IExtensionTipsService,
|
||||
@IModeService modeService: IModeService,
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@IWorkspaceContextService contextService: IWorkspaceContextService,
|
||||
@IExperimentService experimentService: IExperimentService,
|
||||
@IWorkbenchThemeService workbenchThemeService: IWorkbenchThemeService,
|
||||
@IExtensionsWorkbenchService extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@ILabelService labelService: ILabelService,
|
||||
@IWorkbenchEnvironmentService workbenchEnvironmentService: IWorkbenchEnvironmentService
|
||||
) {
|
||||
options.title = getServerLabel(server, labelService, workbenchEnvironmentService);
|
||||
options.server = server;
|
||||
super(options, notificationService, keybindingService, contextMenuService, instantiationService, themeService, extensionService, extensionsWorkbenchService, editorService, tipsService, modeService, telemetryService, configurationService, contextService, experimentService, workbenchThemeService);
|
||||
this.disposables.push(labelService.onDidChangeFormatters(() => this.updateTitle(getServerLabel(server, labelService, workbenchEnvironmentService))));
|
||||
}
|
||||
|
||||
async show(query: string): Promise<IPagedModel<IExtension>> {
|
||||
query = query.replace(/@group:server/g, '').trim();
|
||||
query = query ? query : '@installed';
|
||||
if (!ExtensionsListView.isInstalledExtensionsQuery(query) && !ExtensionsListView.isBuiltInExtensionsQuery(query)) {
|
||||
query = query += ' @installed';
|
||||
|
||||
@@ -16,7 +16,7 @@ import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService';
|
||||
import { STATUS_BAR_HOST_NAME_BACKGROUND, STATUS_BAR_FOREGROUND, STATUS_BAR_NO_FOLDER_FOREGROUND } from 'vs/workbench/common/theme';
|
||||
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
|
||||
import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
|
||||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
|
||||
export abstract class ExtensionWidget extends Disposable implements IExtensionContainer {
|
||||
private _extension: IExtension;
|
||||
@@ -205,7 +205,7 @@ export class RemoteBadgeWidget extends ExtensionWidget {
|
||||
@IThemeService private readonly themeService: IThemeService,
|
||||
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService,
|
||||
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
|
||||
@IWindowService private readonly windowService: IWindowService
|
||||
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService
|
||||
) {
|
||||
super();
|
||||
this.render();
|
||||
@@ -222,11 +222,10 @@ export class RemoteBadgeWidget extends ExtensionWidget {
|
||||
|
||||
render(): void {
|
||||
this.clear();
|
||||
if (!this.extension || !this.extension.local) {
|
||||
if (!this.extension || !this.extension.local || !this.extension.server) {
|
||||
return;
|
||||
}
|
||||
const server = this.extensionManagementServerService.getExtensionManagementServer(this.extension.local.location);
|
||||
if (server === this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
if (this.extension.server === this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
this.element = append(this.parent, $('div.extension-remote-badge'));
|
||||
append(this.element, $('span.octicon.octicon-file-symlink-directory'));
|
||||
|
||||
@@ -245,7 +244,7 @@ export class RemoteBadgeWidget extends ExtensionWidget {
|
||||
|
||||
const updateTitle = () => {
|
||||
if (this.element) {
|
||||
this.element.title = localize('remote extension title', "Extension in {0}", this.labelService.getHostLabel(REMOTE_HOST_SCHEME, this.windowService.getConfiguration().remoteAuthority));
|
||||
this.element.title = localize('remote extension title', "Extension in {0}", this.labelService.getHostLabel(REMOTE_HOST_SCHEME, this.environmentService.configuration.remoteAuthority));
|
||||
}
|
||||
};
|
||||
this.labelService.onDidChangeFormatters(() => updateTitle(), this, this.disposables);
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
.monaco-action-bar .action-item.disabled .action-label.extension-action.extension-editor-dropdown-action,
|
||||
.monaco-action-bar .action-item.disabled .action-label.extension-action.reload,
|
||||
.monaco-action-bar .action-item.disabled .action-label.disable-status.hide,
|
||||
.monaco-action-bar .action-item.disabled .action-label.disable-warning.hide,
|
||||
.monaco-action-bar .action-item.disabled .action-label.extension-status-label.hide,
|
||||
.monaco-action-bar .action-item.disabled .action-label.malicious-status.not-malicious {
|
||||
display: none;
|
||||
@@ -61,6 +62,29 @@
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.extension-editor > .header > .details > .actions > .monaco-action-bar > .actions-container > .action-item > .action-label.disable-status {
|
||||
margin-left: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.extension-editor > .header > .details > .actions > .monaco-action-bar > .actions-container > .action-item > .action-label.disable-warning,
|
||||
.extensions-viewlet>.extensions .extension>.details>.footer>.monaco-action-bar .action-item .action-label.disable-warning {
|
||||
cursor: default;
|
||||
margin: 0.1em;
|
||||
}
|
||||
|
||||
.monaco-action-bar .action-item .action-label.disable-warning.icon {
|
||||
opacity: 1;
|
||||
height: 18px;
|
||||
width: 10px;
|
||||
background: url('status-warning.svg') center center no-repeat;
|
||||
margin-top: 0.15em
|
||||
}
|
||||
|
||||
.vs-dark .monaco-action-bar .action-item .action-label.disable-warning.icon {
|
||||
background: url('status-warning-inverse.svg') center center no-repeat;
|
||||
}
|
||||
|
||||
.extension-editor>.header>.details>.actions>.monaco-action-bar .action-item .action-label.extension-status-label,
|
||||
.extension-editor>.header>.details>.actions>.monaco-action-bar .action-item .action-label.disable-status,
|
||||
.extension-editor>.header>.details>.actions>.monaco-action-bar .action-item .action-label.malicious-status {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" height="16" width="16"><path fill="#1E1E1E" d="M7.5 2L2 12l2 2h9l2-2L9.5 2z"/><path d="M9 3H8l-4.5 9 1 1h8l1-1L9 3zm0 9H8v-1h1v1zm0-2H8V6h1v4z" fill="#fc0"/><path d="M9 10H8V6h1v4zm0 1H8v1h1v-1z"/></svg>
|
||||
|
After Width: | Height: | Size: 263 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" enable-background="new 0 0 16 16" height="16" width="16"><path fill="#F6F6F6" d="M7.5 2L2 12l2 2h9l2-2L9.5 2z"/><path d="M9 3H8l-4.5 9 1 1h8l1-1L9 3zm0 9H8v-1h1v1zm0-2H8V6h1v4z" fill="#fc0"/><path d="M9 10H8V6h1v4zm0 1H8v1h1v-1z"/></svg>
|
||||
|
After Width: | Height: | Size: 297 B |
@@ -43,6 +43,7 @@ import { renderOcticons } from 'vs/base/browser/ui/octiconLabel/octiconLabel';
|
||||
import { ExtensionIdentifier, ExtensionType, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
|
||||
import { SlowExtensionAction } from 'vs/workbench/contrib/extensions/electron-browser/extensionsSlowActions';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
|
||||
export const IExtensionHostProfileService = createDecorator<IExtensionHostProfileService>('extensionHostProfileService');
|
||||
export const CONTEXT_PROFILE_SESSION_STATE = new RawContextKey<string>('profileSessionState', 'none');
|
||||
@@ -119,7 +120,7 @@ export class RuntimeExtensionsEditor extends BaseEditor {
|
||||
@IExtensionHostProfileService private readonly _extensionHostProfileService: IExtensionHostProfileService,
|
||||
@IStorageService storageService: IStorageService,
|
||||
@ILabelService private readonly _labelService: ILabelService,
|
||||
@IWindowService private readonly _windowService: IWindowService
|
||||
@IWorkbenchEnvironmentService private readonly _environmentService: IWorkbenchEnvironmentService
|
||||
) {
|
||||
super(RuntimeExtensionsEditor.ID, telemetryService, themeService, storageService);
|
||||
|
||||
@@ -381,7 +382,7 @@ export class RuntimeExtensionsEditor extends BaseEditor {
|
||||
el.innerHTML = renderOcticons(`$(rss) ${element.description.extensionLocation.authority}`);
|
||||
data.msgContainer.appendChild(el);
|
||||
|
||||
const hostLabel = this._labelService.getHostLabel(REMOTE_HOST_SCHEME, this._windowService.getConfiguration().remoteAuthority);
|
||||
const hostLabel = this._labelService.getHostLabel(REMOTE_HOST_SCHEME, this._environmentService.configuration.remoteAuthority);
|
||||
if (hostLabel) {
|
||||
el.innerHTML = renderOcticons(`$(rss) ${hostLabel}`);
|
||||
}
|
||||
|
||||
@@ -9,15 +9,15 @@ import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { index, distinct } from 'vs/base/common/arrays';
|
||||
import { ThrottledDelayer } from 'vs/base/common/async';
|
||||
import { isPromiseCanceledError } from 'vs/base/common/errors';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable, dispose, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IPager, mapPager, singlePagePager } from 'vs/base/common/paging';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
// {{SQL CARBON EDIT}}
|
||||
import {
|
||||
IExtensionManagementService, IExtensionGalleryService, ILocalExtension, IGalleryExtension, IQueryOptions,
|
||||
InstallExtensionEvent, DidInstallExtensionEvent, DidUninstallExtensionEvent, IExtensionEnablementService, IExtensionIdentifier, EnablementState, IExtensionManagementServerService, INSTALL_ERROR_INCOMPATIBLE
|
||||
InstallExtensionEvent, DidInstallExtensionEvent, DidUninstallExtensionEvent, IExtensionEnablementService, IExtensionIdentifier, EnablementState, IExtensionManagementServerService, IExtensionManagementServer, INSTALL_ERROR_INCOMPATIBLE
|
||||
} from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { getGalleryExtensionTelemetryData, getLocalExtensionTelemetryData, areSameExtensions, getMaliciousExtensionsSet } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { getGalleryExtensionTelemetryData, getLocalExtensionTelemetryData, areSameExtensions, getMaliciousExtensionsSet, groupByExtension } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
@@ -37,7 +37,6 @@ import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { IExtensionManifest, ExtensionType, ExtensionIdentifierWithVersion, IExtension as IPlatformExtension } from 'vs/platform/extensions/common/extensions';
|
||||
import { isUIExtension } from 'vs/workbench/services/extensions/node/extensionsUtil';
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
import { isEngineValid } from 'vs/platform/extensions/node/extensionValidator';
|
||||
@@ -55,6 +54,7 @@ class Extension implements IExtension {
|
||||
constructor(
|
||||
private galleryService: IExtensionGalleryService,
|
||||
private stateProvider: IExtensionStateProvider<ExtensionState>,
|
||||
public readonly server: IExtensionManagementServer | undefined,
|
||||
public local: ILocalExtension | undefined,
|
||||
public gallery: IGalleryExtension | undefined,
|
||||
private telemetryService: ITelemetryService,
|
||||
@@ -370,14 +370,179 @@ class ExtensionDependencies implements IExtensionDependencies {
|
||||
}
|
||||
}
|
||||
|
||||
export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService, IURLHandler {
|
||||
class Extensions extends Disposable {
|
||||
|
||||
private static readonly SyncPeriod = 1000 * 60 * 60 * 12; // 12 hours
|
||||
_serviceBrand: any;
|
||||
private stateProvider: IExtensionStateProvider<ExtensionState>;
|
||||
private readonly _onChange: Emitter<Extension | undefined> = new Emitter<Extension | undefined>();
|
||||
get onChange(): Event<Extension | undefined> { return this._onChange.event; }
|
||||
|
||||
private readonly stateProvider: IExtensionStateProvider<ExtensionState>;
|
||||
private installing: Extension[] = [];
|
||||
private uninstalling: Extension[] = [];
|
||||
private installed: Extension[] = [];
|
||||
|
||||
constructor(
|
||||
private readonly server: IExtensionManagementServer,
|
||||
@IExtensionGalleryService private readonly galleryService: IExtensionGalleryService,
|
||||
@ITelemetryService private readonly telemetryService: ITelemetryService,
|
||||
@ILogService private readonly logService: ILogService,
|
||||
@IFileService private readonly fileService: IFileService,
|
||||
@IExtensionEnablementService private readonly extensionEnablementService: IExtensionEnablementService
|
||||
) {
|
||||
super();
|
||||
this.stateProvider = ext => this.getExtensionState(ext);
|
||||
this._register(server.extensionManagementService.onInstallExtension(e => this.onInstallExtension(e)));
|
||||
this._register(server.extensionManagementService.onDidInstallExtension(e => this.onDidInstallExtension(e)));
|
||||
this._register(server.extensionManagementService.onUninstallExtension(e => this.onUninstallExtension(e)));
|
||||
this._register(server.extensionManagementService.onDidUninstallExtension(e => this.onDidUninstallExtension(e)));
|
||||
this._register(extensionEnablementService.onEnablementChanged(e => this.onEnablementChanged(e)));
|
||||
}
|
||||
|
||||
get local(): IExtension[] {
|
||||
const installing = this.installing
|
||||
.filter(e => !this.installed.some(installed => areSameExtensions(installed.identifier, e.identifier)))
|
||||
.map(e => e);
|
||||
|
||||
return [...this.installed, ...installing];
|
||||
}
|
||||
|
||||
async queryInstalled(): Promise<IExtension[]> {
|
||||
const installed = await this.server.extensionManagementService.getInstalled();
|
||||
const byId = index(this.installed, e => e.identifier.id);
|
||||
this.installed = installed.map(local => {
|
||||
const extension = byId[local.identifier.id] || new Extension(this.galleryService, this.stateProvider, this.server, local, undefined, this.telemetryService, this.logService, this.fileService);
|
||||
extension.local = local;
|
||||
extension.enablementState = this.extensionEnablementService.getEnablementState(local);
|
||||
return extension;
|
||||
});
|
||||
this._onChange.fire(undefined);
|
||||
return this.local;
|
||||
}
|
||||
|
||||
async syncLocalWithGalleryExtension(gallery: IGalleryExtension, maliciousExtensionSet: Set<string>): Promise<boolean> {
|
||||
const extension = this.getInstalledExtensionMatchingGallery(gallery);
|
||||
if (!extension) {
|
||||
return false;
|
||||
}
|
||||
if (maliciousExtensionSet.has(extension.identifier.id)) {
|
||||
extension.isMalicious = true;
|
||||
}
|
||||
// Loading the compatible version only there is an engine property
|
||||
// Otherwise falling back to old way so that we will not make many roundtrips
|
||||
const compatible = gallery.properties.engine ? await this.galleryService.getCompatibleExtension(gallery) : gallery;
|
||||
if (!compatible) {
|
||||
return false;
|
||||
}
|
||||
// Sync the local extension with gallery extension if local extension doesnot has metadata
|
||||
if (extension.local) {
|
||||
const local = extension.local.metadata ? extension.local : await this.server.extensionManagementService.updateMetadata(extension.local, { id: compatible.identifier.uuid, publisherDisplayName: compatible.publisherDisplayName, publisherId: compatible.publisherId });
|
||||
extension.local = local;
|
||||
extension.gallery = compatible;
|
||||
this._onChange.fire(extension);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private getInstalledExtensionMatchingGallery(gallery: IGalleryExtension): Extension | null {
|
||||
for (const installed of this.installed) {
|
||||
if (installed.uuid) { // Installed from Gallery
|
||||
if (installed.uuid === gallery.identifier.uuid) {
|
||||
return installed;
|
||||
}
|
||||
} else {
|
||||
if (areSameExtensions(installed.identifier, gallery.identifier)) { // Installed from other sources
|
||||
return installed;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private onInstallExtension(event: InstallExtensionEvent): void {
|
||||
const { gallery } = event;
|
||||
if (gallery) {
|
||||
const extension = this.installed.filter(e => areSameExtensions(e.identifier, gallery.identifier))[0]
|
||||
|| new Extension(this.galleryService, this.stateProvider, this.server, undefined, gallery, this.telemetryService, this.logService, this.fileService);
|
||||
this.installing.push(extension);
|
||||
this._onChange.fire(extension);
|
||||
}
|
||||
}
|
||||
|
||||
private onDidInstallExtension(event: DidInstallExtensionEvent): void {
|
||||
const { local, zipPath, error, gallery } = event;
|
||||
const installingExtension = gallery ? this.installing.filter(e => areSameExtensions(e.identifier, gallery.identifier))[0] : null;
|
||||
this.installing = installingExtension ? this.installing.filter(e => e !== installingExtension) : this.installing;
|
||||
|
||||
let extension: Extension | undefined = installingExtension ? installingExtension : zipPath ? new Extension(this.galleryService, this.stateProvider, this.server, local, undefined, this.telemetryService, this.logService, this.fileService) : undefined;
|
||||
if (extension) {
|
||||
if (local) {
|
||||
const installed = this.installed.filter(e => areSameExtensions(e.identifier, extension!.identifier))[0];
|
||||
if (installed) {
|
||||
extension = installed;
|
||||
} else {
|
||||
this.installed.push(extension);
|
||||
}
|
||||
extension.local = local;
|
||||
if (!extension.gallery) {
|
||||
extension.gallery = gallery;
|
||||
}
|
||||
}
|
||||
}
|
||||
this._onChange.fire(error ? undefined : extension);
|
||||
}
|
||||
|
||||
private onUninstallExtension(identifier: IExtensionIdentifier): void {
|
||||
const extension = this.installed.filter(e => areSameExtensions(e.identifier, identifier))[0];
|
||||
if (extension) {
|
||||
const uninstalling = this.uninstalling.filter(e => areSameExtensions(e.identifier, identifier))[0] || extension;
|
||||
this.uninstalling = [uninstalling, ...this.uninstalling.filter(e => !areSameExtensions(e.identifier, identifier))];
|
||||
this._onChange.fire(uninstalling);
|
||||
}
|
||||
}
|
||||
|
||||
private onDidUninstallExtension({ identifier, error }: DidUninstallExtensionEvent): void {
|
||||
if (!error) {
|
||||
this.installed = this.installed.filter(e => !areSameExtensions(e.identifier, identifier));
|
||||
}
|
||||
const uninstalling = this.uninstalling.filter(e => areSameExtensions(e.identifier, identifier))[0];
|
||||
this.uninstalling = this.uninstalling.filter(e => !areSameExtensions(e.identifier, identifier));
|
||||
if (uninstalling) {
|
||||
this._onChange.fire(uninstalling);
|
||||
}
|
||||
}
|
||||
|
||||
private onEnablementChanged(platformExtensions: IPlatformExtension[]) {
|
||||
const extensions = this.local.filter(e => platformExtensions.some(p => areSameExtensions(e.identifier, p.identifier)));
|
||||
for (const extension of extensions) {
|
||||
if (extension.local) {
|
||||
const enablementState = this.extensionEnablementService.getEnablementState(extension.local);
|
||||
if (enablementState !== extension.enablementState) {
|
||||
(extension as Extension).enablementState = enablementState;
|
||||
this._onChange.fire(extension as Extension);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getExtensionState(extension: Extension): ExtensionState {
|
||||
if (extension.gallery && this.installing.some(e => !!e.gallery && areSameExtensions(e.gallery.identifier, extension.gallery!.identifier))) {
|
||||
return ExtensionState.Installing;
|
||||
}
|
||||
if (this.uninstalling.some(e => areSameExtensions(e.identifier, extension.identifier))) {
|
||||
return ExtensionState.Uninstalling;
|
||||
}
|
||||
const local = this.installed.filter(e => e === extension || (e.gallery && extension.gallery && areSameExtensions(e.gallery.identifier, extension.gallery.identifier)))[0];
|
||||
return local ? ExtensionState.Installed : ExtensionState.Uninstalled;
|
||||
}
|
||||
}
|
||||
|
||||
export class ExtensionsWorkbenchService extends Disposable implements IExtensionsWorkbenchService, IURLHandler {
|
||||
|
||||
private static readonly SyncPeriod = 1000 * 60 * 60 * 12; // 12 hours
|
||||
_serviceBrand: any;
|
||||
|
||||
private readonly localExtensions: Extensions;
|
||||
private readonly remoteExtensions: Extensions | null;
|
||||
private syncDelayer: ThrottledDelayer<void>;
|
||||
private autoUpdateDelayer: ThrottledDelayer<void>;
|
||||
private disposables: IDisposable[] = [];
|
||||
@@ -404,13 +569,15 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
|
||||
@IStorageService private readonly storageService: IStorageService,
|
||||
@IFileService private readonly fileService: IFileService
|
||||
) {
|
||||
this.stateProvider = ext => this.getExtensionState(ext);
|
||||
|
||||
extensionService.onInstallExtension(this.onInstallExtension, this, this.disposables);
|
||||
extensionService.onDidInstallExtension(this.onDidInstallExtension, this, this.disposables);
|
||||
extensionService.onUninstallExtension(this.onUninstallExtension, this, this.disposables);
|
||||
extensionService.onDidUninstallExtension(this.onDidUninstallExtension, this, this.disposables);
|
||||
extensionEnablementService.onEnablementChanged(this.onEnablementChanged, this, this.disposables);
|
||||
super();
|
||||
this.localExtensions = this._register(instantiationService.createInstance(Extensions, extensionManagementServerService.localExtensionManagementServer));
|
||||
this._register(this.localExtensions.onChange(e => this._onChange.fire(e)));
|
||||
if (this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
this.remoteExtensions = this._register(instantiationService.createInstance(Extensions, extensionManagementServerService.remoteExtensionManagementServer));
|
||||
this._register(this.remoteExtensions.onChange(e => this._onChange.fire(e)));
|
||||
} else {
|
||||
this.remoteExtensions = null;
|
||||
}
|
||||
|
||||
this.syncDelayer = new ThrottledDelayer<void>(ExtensionsWorkbenchService.SyncPeriod);
|
||||
this.autoUpdateDelayer = new ThrottledDelayer<void>(1000);
|
||||
@@ -438,29 +605,40 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
|
||||
}
|
||||
|
||||
get local(): IExtension[] {
|
||||
const installing = this.installing
|
||||
.filter(e => !this.installed.some(installed => areSameExtensions(installed.identifier, e.identifier)))
|
||||
.map(e => e);
|
||||
|
||||
return [...this.installed, ...installing];
|
||||
const result = [...this.localExtensions.local];
|
||||
if (!this.remoteExtensions) {
|
||||
return result;
|
||||
}
|
||||
result.push(...this.remoteExtensions.local);
|
||||
const byId = groupByExtension(result, r => r.identifier);
|
||||
return byId.reduce((result, extensions) => { result.push(this.getPrimaryExtension(extensions)); return result; }, []);
|
||||
}
|
||||
|
||||
queryLocal(): Promise<IExtension[]> {
|
||||
return this.extensionService.getInstalled()
|
||||
.then(installed => {
|
||||
if (this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
installed = installed.filter(installed => this.belongsToWindow(installed));
|
||||
}
|
||||
const installedById = index(this.installed, e => e.identifier.id);
|
||||
this.installed = installed.map(local => {
|
||||
const extension = installedById[local.identifier.id] || new Extension(this.galleryService, this.stateProvider, local, undefined, this.telemetryService, this.logService, this.fileService);
|
||||
extension.enablementState = this.extensionEnablementService.getEnablementState(local);
|
||||
return extension;
|
||||
});
|
||||
get outdated(): IExtension[] {
|
||||
const allLocal = [...this.localExtensions.local];
|
||||
if (this.remoteExtensions) {
|
||||
allLocal.push(...this.remoteExtensions.local);
|
||||
}
|
||||
return allLocal.filter(e => e.outdated && e.local && e.state === ExtensionState.Installed);
|
||||
}
|
||||
|
||||
this._onChange.fire(undefined);
|
||||
return this.local;
|
||||
});
|
||||
async queryLocal(server?: IExtensionManagementServer): Promise<IExtension[]> {
|
||||
if (server) {
|
||||
if (this.extensionManagementServerService.localExtensionManagementServer === server) {
|
||||
return this.localExtensions.queryInstalled();
|
||||
}
|
||||
if (this.remoteExtensions && this.extensionManagementServerService.remoteExtensionManagementServer === server) {
|
||||
return this.remoteExtensions.queryInstalled();
|
||||
}
|
||||
}
|
||||
|
||||
await this.localExtensions.queryInstalled();
|
||||
if (this.remoteExtensions) {
|
||||
await Promise.all([this.localExtensions.queryInstalled(), this.remoteExtensions.queryInstalled()]);
|
||||
} else {
|
||||
await this.localExtensions.queryInstalled();
|
||||
}
|
||||
return this.local;
|
||||
}
|
||||
|
||||
queryGallery(token: CancellationToken): Promise<IPager<IExtension>>;
|
||||
@@ -509,50 +687,41 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
|
||||
return Promise.resolve(this.editorService.openEditor(this.instantiationService.createInstance(ExtensionsInput, extension), undefined, sideByside ? SIDE_GROUP : ACTIVE_GROUP));
|
||||
}
|
||||
|
||||
private belongsToWindow(extension: ILocalExtension): boolean {
|
||||
if (!this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
return true;
|
||||
private getPrimaryExtension(extensions: IExtension[]): IExtension {
|
||||
if (extensions.length === 1) {
|
||||
return extensions[0];
|
||||
}
|
||||
const extensionManagementServer = this.extensionManagementServerService.getExtensionManagementServer(extension.location);
|
||||
if (isUIExtension(extension.manifest, this.configurationService)) {
|
||||
if (this.extensionManagementServerService.localExtensionManagementServer === extensionManagementServer) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (this.extensionManagementServerService.remoteExtensionManagementServer === extensionManagementServer) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
const pickRemoteOrFirstExtension = (from: IExtension[]): IExtension => {
|
||||
const remoteExtension = from.filter(e => e.server === this.extensionManagementServerService.remoteExtensionManagementServer)[0];
|
||||
return remoteExtension ? remoteExtension : from[0];
|
||||
};
|
||||
const enabledExtensions = extensions.filter(e => e.local && this.extensionEnablementService.isEnabled(e.local));
|
||||
return enabledExtensions.length === 1 ? enabledExtensions[0] : pickRemoteOrFirstExtension(extensions);
|
||||
}
|
||||
|
||||
private fromGallery(gallery: IGalleryExtension, maliciousExtensionSet: Set<string>): Extension {
|
||||
let result = this.getInstalledExtensionMatchingGallery(gallery);
|
||||
private fromGallery(gallery: IGalleryExtension, maliciousExtensionSet: Set<string>): IExtension {
|
||||
Promise.all([this.localExtensions.syncLocalWithGalleryExtension(gallery, maliciousExtensionSet), this.remoteExtensions ? this.localExtensions.syncLocalWithGalleryExtension(gallery, maliciousExtensionSet) : Promise.resolve(false)])
|
||||
.then(result => {
|
||||
if (result[0] || result[1]) {
|
||||
this.eventuallyAutoUpdateExtensions();
|
||||
}
|
||||
});
|
||||
|
||||
if (result) {
|
||||
// Loading the compatible version only there is an engine property
|
||||
// Otherwise falling back to old way so that we will not make many roundtrips
|
||||
if (gallery.properties.engine) {
|
||||
this.galleryService.getCompatibleExtension(gallery)
|
||||
.then(compatible => compatible ? this.syncLocalWithGalleryExtension(result!, compatible) : null);
|
||||
} else {
|
||||
this.syncLocalWithGalleryExtension(result, gallery);
|
||||
}
|
||||
} else {
|
||||
result = new Extension(this.galleryService, this.stateProvider, undefined, gallery, this.telemetryService, this.logService, this.fileService);
|
||||
const installed = this.getInstalledExtensionMatchingGallery(gallery);
|
||||
if (installed) {
|
||||
return installed;
|
||||
}
|
||||
|
||||
if (maliciousExtensionSet.has(result.identifier.id)) {
|
||||
result.isMalicious = true;
|
||||
const extension = new Extension(this.galleryService, ext => this.getExtensionState(ext), undefined, undefined, gallery, this.telemetryService, this.logService, this.fileService);
|
||||
if (maliciousExtensionSet.has(extension.identifier.id)) {
|
||||
extension.isMalicious = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
return extension;
|
||||
}
|
||||
|
||||
private getInstalledExtensionMatchingGallery(gallery: IGalleryExtension): Extension | null {
|
||||
for (const installed of this.installed) {
|
||||
if (installed.uuid) { // Installed from Gallery
|
||||
if (installed.uuid === gallery.identifier.uuid) {
|
||||
private getInstalledExtensionMatchingGallery(gallery: IGalleryExtension): IExtension | null {
|
||||
for (const installed of this.local) {
|
||||
if (installed.identifier.uuid) { // Installed from Gallery
|
||||
if (installed.identifier.uuid === gallery.identifier.uuid) {
|
||||
return installed;
|
||||
}
|
||||
} else {
|
||||
@@ -564,19 +733,14 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
|
||||
return null;
|
||||
}
|
||||
|
||||
private syncLocalWithGalleryExtension(extension: Extension, gallery: IGalleryExtension) {
|
||||
// Sync the local extension with gallery extension if local extension doesnot has metadata
|
||||
if (extension.local) {
|
||||
(extension.local.metadata ? Promise.resolve(extension.local) : this.extensionService.updateMetadata(extension.local, { id: gallery.identifier.uuid, publisherDisplayName: gallery.publisherDisplayName, publisherId: gallery.publisherId }))
|
||||
.then(local => {
|
||||
extension.local = local;
|
||||
extension.gallery = gallery;
|
||||
this._onChange.fire(extension);
|
||||
this.eventuallyAutoUpdateExtensions();
|
||||
});
|
||||
} else {
|
||||
this._onChange.fire(extension);
|
||||
private getExtensionState(extension: Extension): ExtensionState {
|
||||
if (this.remoteExtensions) {
|
||||
const state = this.remoteExtensions.getExtensionState(extension);
|
||||
if (state !== ExtensionState.Uninstalled) {
|
||||
return state;
|
||||
}
|
||||
}
|
||||
return this.localExtensions.getExtensionState(extension);
|
||||
}
|
||||
|
||||
checkForUpdates(): Promise<void> {
|
||||
@@ -602,10 +766,10 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
|
||||
|
||||
private syncWithGallery(): Promise<void> {
|
||||
const ids: string[] = [], names: string[] = [];
|
||||
for (const installed of this.installed) {
|
||||
for (const installed of this.local) {
|
||||
if (installed.type === ExtensionType.User) {
|
||||
if (installed.uuid) {
|
||||
ids.push(installed.uuid);
|
||||
if (installed.identifier.uuid) {
|
||||
ids.push(installed.identifier.uuid);
|
||||
} else {
|
||||
names.push(installed.identifier.id);
|
||||
}
|
||||
@@ -634,9 +798,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
|
||||
}
|
||||
|
||||
// {{SQL CARBON EDIT}} - Add && !e.downloadPage condition
|
||||
const toUpdate = this.local.filter(e =>
|
||||
e.outdated && e.state !== ExtensionState.Installing
|
||||
&& e.local && !this.isAutoUpdateIgnored(new ExtensionIdentifierWithVersion(e.identifier, e.version)) && !e.downloadPage);
|
||||
const toUpdate = this.outdated.filter(e => !this.isAutoUpdateIgnored(new ExtensionIdentifierWithVersion(e.identifier, e.version)) && !e.downloadPage);
|
||||
return Promise.all(toUpdate.map(e => this.install(e)));
|
||||
}
|
||||
|
||||
@@ -689,7 +851,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
|
||||
// The check is added here because we want to fail fast instead of downloading the VSIX and then fail.
|
||||
if (gallery.properties.engine && (!isEngineValid(gallery.properties.engine, product.vscodeVersion)
|
||||
|| (gallery.properties.azDataEngine && !isEngineValid(gallery.properties.azDataEngine, pkg.version)))) {
|
||||
return Promise.reject(new ExtensionManagementError(nls.localize('incompatible', "Unable to install version '{2}' of extension '{0}' as it is not compatible with Azure Data Studio '{1}'.", extension.gallery!.identifier.id, pkg.version, gallery.version), INSTALL_ERROR_INCOMPATIBLE));
|
||||
return Promise.reject(new ExtensionManagementError(nls.localize('incompatible2', "Unable to install version '{2}' of extension '{0}' as it is not compatible with Azure Data Studio '{1}'.", extension.gallery!.identifier.id, pkg.version, gallery.version), INSTALL_ERROR_INCOMPATIBLE));
|
||||
}
|
||||
|
||||
return this.installWithProgress(async () => {
|
||||
@@ -723,14 +885,14 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
|
||||
}
|
||||
|
||||
uninstall(extension: IExtension): Promise<void> {
|
||||
const ext = extension.local ? extension : this.installed.filter(e => areSameExtensions(e.identifier, extension.identifier))[0];
|
||||
const ext = extension.local ? extension : this.local.filter(e => areSameExtensions(e.identifier, extension.identifier))[0];
|
||||
const toUninstall: ILocalExtension | null = ext && ext.local ? ext.local : null;
|
||||
|
||||
if (!toUninstall) {
|
||||
return Promise.reject(new Error('Missing local'));
|
||||
}
|
||||
|
||||
this.logService.info(`Requested uninstalling the extension ${extension.identifier.id} from window ${this.windowService.getCurrentWindowId()}`);
|
||||
this.logService.info(`Requested uninstalling the extension ${extension.identifier.id} from window ${this.windowService.windowId}`);
|
||||
return this.progressService.withProgress({
|
||||
location: ProgressLocation.Extensions,
|
||||
title: nls.localize('uninstallingExtension', 'Uninstalling extension....'),
|
||||
@@ -765,7 +927,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
|
||||
}
|
||||
|
||||
reinstall(extension: IExtension): Promise<IExtension> {
|
||||
const ext = extension.local ? extension : this.installed.filter(e => areSameExtensions(e.identifier, extension.identifier))[0];
|
||||
const ext = extension.local ? extension : this.local.filter(e => areSameExtensions(e.identifier, extension.identifier))[0];
|
||||
const toReinstall: ILocalExtension | null = ext && ext.local ? ext.local : null;
|
||||
|
||||
if (!toReinstall) {
|
||||
@@ -925,101 +1087,6 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
|
||||
return this._extensionAllowedBadgeProviders;
|
||||
}
|
||||
|
||||
private onInstallExtension(event: InstallExtensionEvent): void {
|
||||
const { gallery } = event;
|
||||
|
||||
if (!gallery) {
|
||||
return;
|
||||
}
|
||||
|
||||
let extension = this.installed.filter(e => areSameExtensions(e.identifier, gallery.identifier))[0];
|
||||
|
||||
if (!extension) {
|
||||
extension = new Extension(this.galleryService, this.stateProvider, undefined, gallery, this.telemetryService, this.logService, this.fileService);
|
||||
}
|
||||
|
||||
this.installing.push(extension);
|
||||
|
||||
this._onChange.fire(extension);
|
||||
}
|
||||
|
||||
private onDidInstallExtension(event: DidInstallExtensionEvent): void {
|
||||
const { local, zipPath, error, gallery } = event;
|
||||
const installingExtension = gallery ? this.installing.filter(e => areSameExtensions(e.identifier, gallery.identifier))[0] : null;
|
||||
this.installing = installingExtension ? this.installing.filter(e => e !== installingExtension) : this.installing;
|
||||
|
||||
if (local && !this.belongsToWindow(local)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let extension: Extension | undefined = installingExtension ? installingExtension : zipPath ? new Extension(this.galleryService, this.stateProvider, local, undefined, this.telemetryService, this.logService, this.fileService) : undefined;
|
||||
if (extension) {
|
||||
if (local) {
|
||||
const installed = this.installed.filter(e => areSameExtensions(e.identifier, extension!.identifier))[0];
|
||||
if (installed) {
|
||||
extension = installed;
|
||||
} else {
|
||||
this.installed.push(extension);
|
||||
}
|
||||
extension.local = local;
|
||||
extension.gallery = gallery;
|
||||
}
|
||||
}
|
||||
this._onChange.fire(error ? undefined : extension);
|
||||
}
|
||||
|
||||
private onUninstallExtension(identifier: IExtensionIdentifier): void {
|
||||
const extension = this.installed.filter(e => areSameExtensions(e.identifier, identifier))[0];
|
||||
if (!extension) {
|
||||
return;
|
||||
}
|
||||
|
||||
const uninstalling = this.uninstalling.filter(e => areSameExtensions(e.identifier, identifier))[0] || extension;
|
||||
this.uninstalling = [uninstalling, ...this.uninstalling.filter(e => !areSameExtensions(e.identifier, identifier))];
|
||||
|
||||
this._onChange.fire(uninstalling);
|
||||
}
|
||||
|
||||
private onDidUninstallExtension({ identifier, error }: DidUninstallExtensionEvent): void {
|
||||
if (!error) {
|
||||
this.installed = this.installed.filter(e => !areSameExtensions(e.identifier, identifier));
|
||||
}
|
||||
|
||||
const uninstalling = this.uninstalling.filter(e => areSameExtensions(e.identifier, identifier))[0];
|
||||
this.uninstalling = this.uninstalling.filter(e => !areSameExtensions(e.identifier, identifier));
|
||||
if (!uninstalling) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._onChange.fire(uninstalling);
|
||||
}
|
||||
|
||||
private onEnablementChanged(platformExtensions: IPlatformExtension[]) {
|
||||
const extensions = this.local.filter(e => platformExtensions.some(p => areSameExtensions(e.identifier, p.identifier)));
|
||||
for (const extension of extensions) {
|
||||
if (extension.local) {
|
||||
const enablementState = this.extensionEnablementService.getEnablementState(extension.local);
|
||||
if (enablementState !== extension.enablementState) {
|
||||
extension.enablementState = enablementState;
|
||||
this._onChange.fire(extension);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private getExtensionState(extension: Extension): ExtensionState {
|
||||
if (extension.gallery && this.installing.some(e => !!e.gallery && areSameExtensions(e.gallery.identifier, extension.gallery!.identifier))) {
|
||||
return ExtensionState.Installing;
|
||||
}
|
||||
|
||||
if (this.uninstalling.some(e => areSameExtensions(e.identifier, extension.identifier))) {
|
||||
return ExtensionState.Uninstalling;
|
||||
}
|
||||
|
||||
const local = this.installed.filter(e => e === extension || (e.gallery && extension.gallery && areSameExtensions(e.gallery.identifier, extension.gallery.identifier)))[0];
|
||||
return local ? ExtensionState.Installed : ExtensionState.Uninstalled;
|
||||
}
|
||||
|
||||
private onError(err: any): void {
|
||||
if (isPromiseCanceledError(err)) {
|
||||
return;
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
import * as assert from 'assert';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions';
|
||||
import { IExtensionsWorkbenchService, ExtensionContainers } from 'vs/workbench/contrib/extensions/common/extensions';
|
||||
import * as ExtensionsActions from 'vs/workbench/contrib/extensions/electron-browser/extensionsActions';
|
||||
import { ExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/node/extensionsWorkbenchService';
|
||||
import {
|
||||
IExtensionManagementService, IExtensionGalleryService, IExtensionEnablementService, IExtensionTipsService, ILocalExtension, IGalleryExtension,
|
||||
DidInstallExtensionEvent, DidUninstallExtensionEvent, InstallExtensionEvent, IExtensionIdentifier, EnablementState, InstallOperation, IExtensionManagementServerService
|
||||
DidInstallExtensionEvent, DidUninstallExtensionEvent, InstallExtensionEvent, IExtensionIdentifier, EnablementState, InstallOperation, IExtensionManagementServerService, IExtensionManagementServer
|
||||
} from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { getGalleryExtensionId } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { ExtensionManagementService } from 'vs/platform/extensionManagement/node/extensionManagementService';
|
||||
@@ -33,12 +33,13 @@ import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { URLService } from 'vs/platform/url/common/urlService';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { ExtensionManagementServerService } from 'vs/workbench/services/extensions/electron-browser/extensionManagementServerService';
|
||||
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
|
||||
import { RemoteAgentService } from 'vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl';
|
||||
import { ExtensionIdentifier, IExtensionContributions, ExtensionType, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { ExtensionManagementServerService } from 'vs/workbench/services/extensions/electron-browser/extensionManagementServerService';
|
||||
|
||||
suite('ExtensionsActions Test', () => {
|
||||
|
||||
@@ -74,9 +75,17 @@ suite('ExtensionsActions Test', () => {
|
||||
instantiationService.stub(IExtensionManagementService, 'onDidUninstallExtension', didUninstallEvent.event);
|
||||
instantiationService.stub(IRemoteAgentService, RemoteAgentService);
|
||||
|
||||
instantiationService.stub(IExtensionManagementServerService, instantiationService.createInstance(ExtensionManagementServerService));
|
||||
instantiationService.stub(IExtensionManagementServerService, new class extends ExtensionManagementServerService {
|
||||
private _localExtensionManagementServer: IExtensionManagementServer = { extensionManagementService: instantiationService.get(IExtensionManagementService), label: 'local', authority: 'vscode-local' };
|
||||
constructor() {
|
||||
super(instantiationService.get(ISharedProcessService), instantiationService.get(IRemoteAgentService));
|
||||
}
|
||||
get localExtensionManagementServer(): IExtensionManagementServer { return this._localExtensionManagementServer; }
|
||||
set localExtensionManagementServer(server: IExtensionManagementServer) { }
|
||||
}());
|
||||
|
||||
instantiationService.stub(IExtensionEnablementService, new TestExtensionEnablementService(instantiationService));
|
||||
instantiationService.stub(ILabelService, { onDidChangeFormatters: new Emitter<void>().event });
|
||||
|
||||
instantiationService.set(IExtensionTipsService, instantiationService.createInstance(ExtensionTipsService));
|
||||
instantiationService.stub(IURLService, URLService);
|
||||
@@ -105,7 +114,7 @@ suite('ExtensionsActions Test', () => {
|
||||
test('Test Install action when state is installed', () => {
|
||||
const workbenchService = instantiationService.get(IExtensionsWorkbenchService);
|
||||
const testObject: ExtensionsActions.InstallAction = instantiationService.createInstance(ExtensionsActions.InstallAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a');
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
return workbenchService.queryLocal()
|
||||
@@ -124,7 +133,7 @@ suite('ExtensionsActions Test', () => {
|
||||
test('Test Install action when state is installing', () => {
|
||||
const workbenchService = instantiationService.get(IExtensionsWorkbenchService);
|
||||
const testObject: ExtensionsActions.InstallAction = instantiationService.createInstance(ExtensionsActions.InstallAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
return workbenchService.queryGallery(CancellationToken.None)
|
||||
@@ -141,7 +150,7 @@ suite('ExtensionsActions Test', () => {
|
||||
test('Test Install action when state is uninstalled', () => {
|
||||
const workbenchService = instantiationService.get(IExtensionsWorkbenchService);
|
||||
const testObject: ExtensionsActions.InstallAction = instantiationService.createInstance(ExtensionsActions.InstallAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
return workbenchService.queryGallery(CancellationToken.None)
|
||||
@@ -154,7 +163,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test Install action when extension is system action', () => {
|
||||
const testObject: ExtensionsActions.InstallAction = instantiationService.createInstance(ExtensionsActions.InstallAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a', {}, { type: ExtensionType.System });
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -169,7 +178,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test Install action when extension doesnot has gallery', () => {
|
||||
const testObject: ExtensionsActions.InstallAction = instantiationService.createInstance(ExtensionsActions.InstallAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a');
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -184,14 +193,14 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Uninstall action is disabled when there is no extension', () => {
|
||||
const testObject: ExtensionsActions.UninstallAction = instantiationService.createInstance(ExtensionsActions.UninstallAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
|
||||
assert.ok(!testObject.enabled);
|
||||
});
|
||||
|
||||
test('Test Uninstall action when state is uninstalling', () => {
|
||||
const testObject: ExtensionsActions.UninstallAction = instantiationService.createInstance(ExtensionsActions.UninstallAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a');
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -207,7 +216,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test Uninstall action when state is installed and is user extension', () => {
|
||||
const testObject: ExtensionsActions.UninstallAction = instantiationService.createInstance(ExtensionsActions.UninstallAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a');
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -222,7 +231,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test Uninstall action when state is installed and is system extension', () => {
|
||||
const testObject: ExtensionsActions.UninstallAction = instantiationService.createInstance(ExtensionsActions.UninstallAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a', {}, { type: ExtensionType.System });
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -237,7 +246,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test Uninstall action when state is installing and is user extension', () => {
|
||||
const testObject: ExtensionsActions.UninstallAction = instantiationService.createInstance(ExtensionsActions.UninstallAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a');
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -254,7 +263,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test Uninstall action after extension is installed', () => {
|
||||
const testObject: ExtensionsActions.UninstallAction = instantiationService.createInstance(ExtensionsActions.UninstallAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
|
||||
@@ -273,7 +282,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test CombinedInstallAction when there is no extension', () => {
|
||||
const testObject: ExtensionsActions.CombinedInstallAction = instantiationService.createInstance(ExtensionsActions.CombinedInstallAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
|
||||
assert.ok(!testObject.enabled);
|
||||
assert.equal('extension-action prominent install no-extension', testObject.class);
|
||||
@@ -281,7 +290,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test CombinedInstallAction when extension is system extension', () => {
|
||||
const testObject: ExtensionsActions.CombinedInstallAction = instantiationService.createInstance(ExtensionsActions.CombinedInstallAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a', {}, { type: ExtensionType.System });
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -296,7 +305,7 @@ suite('ExtensionsActions Test', () => {
|
||||
test('Test CombinedInstallAction when installAction is enabled', () => {
|
||||
const workbenchService = instantiationService.get(IExtensionsWorkbenchService);
|
||||
const testObject: ExtensionsActions.CombinedInstallAction = instantiationService.createInstance(ExtensionsActions.CombinedInstallAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
|
||||
@@ -311,7 +320,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test CombinedInstallAction when unInstallAction is enabled', () => {
|
||||
const testObject: ExtensionsActions.CombinedInstallAction = instantiationService.createInstance(ExtensionsActions.CombinedInstallAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a');
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -326,7 +335,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test CombinedInstallAction when state is installing', () => {
|
||||
const testObject: ExtensionsActions.CombinedInstallAction = instantiationService.createInstance(ExtensionsActions.CombinedInstallAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const workbenchService = instantiationService.get(IExtensionsWorkbenchService);
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
@@ -343,7 +352,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test CombinedInstallAction when state is installing during update', () => {
|
||||
const testObject: ExtensionsActions.CombinedInstallAction = instantiationService.createInstance(ExtensionsActions.CombinedInstallAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a');
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -362,7 +371,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test CombinedInstallAction when state is uninstalling', () => {
|
||||
const testObject: ExtensionsActions.CombinedInstallAction = instantiationService.createInstance(ExtensionsActions.CombinedInstallAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a');
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -378,14 +387,14 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test UpdateAction when there is no extension', () => {
|
||||
const testObject: ExtensionsActions.UpdateAction = instantiationService.createInstance(ExtensionsActions.UpdateAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
|
||||
assert.ok(!testObject.enabled);
|
||||
});
|
||||
|
||||
test('Test UpdateAction when extension is uninstalled', () => {
|
||||
const testObject: ExtensionsActions.UpdateAction = instantiationService.createInstance(ExtensionsActions.UpdateAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const gallery = aGalleryExtension('a', { version: '1.0.0' });
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
|
||||
@@ -397,7 +406,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test UpdateAction when extension is installed and not outdated', () => {
|
||||
const testObject: ExtensionsActions.UpdateAction = instantiationService.createInstance(ExtensionsActions.UpdateAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a', { version: '1.0.0' });
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -412,7 +421,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test UpdateAction when extension is installed outdated and system extension', () => {
|
||||
const testObject: ExtensionsActions.UpdateAction = instantiationService.createInstance(ExtensionsActions.UpdateAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a', { version: '1.0.0' }, { type: ExtensionType.System });
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -427,7 +436,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test UpdateAction when extension is installed outdated and user extension', () => {
|
||||
const testObject: ExtensionsActions.UpdateAction = instantiationService.createInstance(ExtensionsActions.UpdateAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a', { version: '1.0.0' });
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -450,7 +459,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test UpdateAction when extension is installing and outdated and user extension', () => {
|
||||
const testObject: ExtensionsActions.UpdateAction = instantiationService.createInstance(ExtensionsActions.UpdateAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a', { version: '1.0.0' });
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -469,14 +478,14 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test ManageExtensionAction when there is no extension', () => {
|
||||
const testObject: ExtensionsActions.ManageExtensionAction = instantiationService.createInstance(ExtensionsActions.ManageExtensionAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
|
||||
assert.ok(!testObject.enabled);
|
||||
});
|
||||
|
||||
test('Test ManageExtensionAction when extension is installed', () => {
|
||||
const testObject: ExtensionsActions.ManageExtensionAction = instantiationService.createInstance(ExtensionsActions.ManageExtensionAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a');
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -491,7 +500,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test ManageExtensionAction when extension is uninstalled', () => {
|
||||
const testObject: ExtensionsActions.ManageExtensionAction = instantiationService.createInstance(ExtensionsActions.ManageExtensionAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
|
||||
@@ -506,7 +515,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test ManageExtensionAction when extension is installing', () => {
|
||||
const testObject: ExtensionsActions.ManageExtensionAction = instantiationService.createInstance(ExtensionsActions.ManageExtensionAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
|
||||
@@ -523,7 +532,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test ManageExtensionAction when extension is queried from gallery and installed', () => {
|
||||
const testObject: ExtensionsActions.ManageExtensionAction = instantiationService.createInstance(ExtensionsActions.ManageExtensionAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
|
||||
@@ -541,7 +550,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test ManageExtensionAction when extension is system extension', () => {
|
||||
const testObject: ExtensionsActions.ManageExtensionAction = instantiationService.createInstance(ExtensionsActions.ManageExtensionAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a', {}, { type: ExtensionType.System });
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -556,7 +565,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test ManageExtensionAction when extension is uninstalling', () => {
|
||||
const testObject: ExtensionsActions.ManageExtensionAction = instantiationService.createInstance(ExtensionsActions.ManageExtensionAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a');
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -767,7 +776,7 @@ suite('ExtensionsActions Test', () => {
|
||||
.then(page => {
|
||||
const testObject: ExtensionsActions.EnableDropDownAction = instantiationService.createInstance(ExtensionsActions.EnableDropDownAction);
|
||||
testObject.extension = page.firstPage[0];
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
|
||||
installEvent.fire({ identifier: gallery.identifier, gallery });
|
||||
assert.ok(!testObject.enabled);
|
||||
@@ -951,7 +960,7 @@ suite('ExtensionsActions Test', () => {
|
||||
.then(page => {
|
||||
const testObject: ExtensionsActions.DisableDropDownAction = instantiationService.createInstance(ExtensionsActions.DisableDropDownAction, [{ identifier: new ExtensionIdentifier('pub.a'), extensionLocation: URI.file('pub.a') }]);
|
||||
testObject.extension = page.firstPage[0];
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
installEvent.fire({ identifier: gallery.identifier, gallery });
|
||||
assert.ok(!testObject.enabled);
|
||||
});
|
||||
@@ -965,7 +974,7 @@ suite('ExtensionsActions Test', () => {
|
||||
.then(extensions => {
|
||||
const testObject: ExtensionsActions.DisableDropDownAction = instantiationService.createInstance(ExtensionsActions.DisableDropDownAction, [{ identifier: new ExtensionIdentifier('pub.a'), extensionLocation: URI.file('pub.a') }]);
|
||||
testObject.extension = extensions[0];
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
uninstallEvent.fire(local.identifier);
|
||||
assert.ok(!testObject.enabled);
|
||||
});
|
||||
@@ -1046,14 +1055,14 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test ReloadAction when there is no extension', () => {
|
||||
const testObject: ExtensionsActions.ReloadAction = instantiationService.createInstance(ExtensionsActions.ReloadAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
|
||||
assert.ok(!testObject.enabled);
|
||||
});
|
||||
|
||||
test('Test ReloadAction when extension state is installing', () => {
|
||||
const testObject: ExtensionsActions.ReloadAction = instantiationService.createInstance(ExtensionsActions.ReloadAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const workbenchService = instantiationService.get(IExtensionsWorkbenchService);
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
@@ -1068,7 +1077,7 @@ suite('ExtensionsActions Test', () => {
|
||||
|
||||
test('Test ReloadAction when extension state is uninstalling', () => {
|
||||
const testObject: ExtensionsActions.ReloadAction = instantiationService.createInstance(ExtensionsActions.ReloadAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a');
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -1083,7 +1092,7 @@ suite('ExtensionsActions Test', () => {
|
||||
test('Test ReloadAction when extension is newly installed', async () => {
|
||||
instantiationService.stubPromise(IExtensionService, 'getExtensions', [{ identifier: new ExtensionIdentifier('pub.b'), extensionLocation: URI.file('pub.b') }]);
|
||||
const testObject: ExtensionsActions.ReloadAction = instantiationService.createInstance(ExtensionsActions.ReloadAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
|
||||
@@ -1094,7 +1103,7 @@ suite('ExtensionsActions Test', () => {
|
||||
return new Promise(c => {
|
||||
testObject.onDidChange(() => {
|
||||
// {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
|
||||
if (testObject.enabled && testObject.tooltip === 'Please reload Azure Data Studio to complete the installation of this extension.') {
|
||||
if (testObject.enabled && testObject.tooltip === 'Please reload Azure Data Studio to enable this extension.') {
|
||||
c();
|
||||
}
|
||||
});
|
||||
@@ -1106,7 +1115,7 @@ suite('ExtensionsActions Test', () => {
|
||||
test('Test ReloadAction when extension is installed and uninstalled', () => {
|
||||
instantiationService.stubPromise(IExtensionService, 'getExtensions', [{ identifier: new ExtensionIdentifier('pub.b'), extensionLocation: URI.file('pub.b') }]);
|
||||
const testObject: ExtensionsActions.ReloadAction = instantiationService.createInstance(ExtensionsActions.ReloadAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
|
||||
@@ -1123,9 +1132,9 @@ suite('ExtensionsActions Test', () => {
|
||||
});
|
||||
|
||||
test('Test ReloadAction when extension is uninstalled', async () => {
|
||||
instantiationService.stubPromise(IExtensionService, 'getExtensions', [{ identifier: new ExtensionIdentifier('pub.a'), extensionLocation: URI.file('pub.a') }]);
|
||||
instantiationService.stubPromise(IExtensionService, 'getExtensions', [{ identifier: new ExtensionIdentifier('pub.a'), extensionLocation: URI.file('pub.a'), version: '1.0.0' }]);
|
||||
const testObject: ExtensionsActions.ReloadAction = instantiationService.createInstance(ExtensionsActions.ReloadAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a');
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
const extensions = await instantiationService.get(IExtensionsWorkbenchService).queryLocal();
|
||||
@@ -1146,7 +1155,7 @@ suite('ExtensionsActions Test', () => {
|
||||
test('Test ReloadAction when extension is uninstalled and installed', () => {
|
||||
instantiationService.stubPromise(IExtensionService, 'getExtensions', [{ identifier: new ExtensionIdentifier('pub.a'), version: '1.0.0', extensionLocation: URI.file('pub.a') }]);
|
||||
const testObject: ExtensionsActions.ReloadAction = instantiationService.createInstance(ExtensionsActions.ReloadAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a');
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryLocal()
|
||||
@@ -1167,7 +1176,7 @@ suite('ExtensionsActions Test', () => {
|
||||
test('Test ReloadAction when extension is updated while running', async () => {
|
||||
instantiationService.stubPromise(IExtensionService, 'getExtensions', [{ identifier: new ExtensionIdentifier('pub.a'), version: '1.0.1', extensionLocation: URI.file('pub.a') }]);
|
||||
const testObject: ExtensionsActions.ReloadAction = instantiationService.createInstance(ExtensionsActions.ReloadAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a', { version: '1.0.1' });
|
||||
const workbenchService = instantiationService.get(IExtensionsWorkbenchService);
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
@@ -1177,7 +1186,7 @@ suite('ExtensionsActions Test', () => {
|
||||
return new Promise(c => {
|
||||
testObject.onDidChange(() => {
|
||||
// {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
|
||||
if (testObject.enabled && testObject.tooltip === 'Please reload Azure Data Studio to complete the updating of this extension.') {
|
||||
if (testObject.enabled && testObject.tooltip === 'Please reload Azure Data Studio to enable the updated extension.') {
|
||||
c();
|
||||
}
|
||||
});
|
||||
@@ -1193,7 +1202,7 @@ suite('ExtensionsActions Test', () => {
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.Disabled)
|
||||
.then(() => {
|
||||
const testObject: ExtensionsActions.ReloadAction = instantiationService.createInstance(ExtensionsActions.ReloadAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const workbenchService = instantiationService.get(IExtensionsWorkbenchService);
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
return workbenchService.queryLocal()
|
||||
@@ -1212,7 +1221,7 @@ suite('ExtensionsActions Test', () => {
|
||||
test('Test ReloadAction when extension is disabled when running', () => {
|
||||
instantiationService.stubPromise(IExtensionService, 'getExtensions', [{ identifier: new ExtensionIdentifier('pub.a'), extensionLocation: URI.file('pub.a') }]);
|
||||
const testObject: ExtensionsActions.ReloadAction = instantiationService.createInstance(ExtensionsActions.ReloadAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a');
|
||||
const workbenchService = instantiationService.get(IExtensionsWorkbenchService);
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
@@ -1223,7 +1232,7 @@ suite('ExtensionsActions Test', () => {
|
||||
.then(() => {
|
||||
assert.ok(testObject.enabled);
|
||||
// {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
|
||||
assert.equal('Please reload Azure Data Studio to complete the disabling of this extension.', testObject.tooltip);
|
||||
assert.equal('Please reload Azure Data Studio to disable this extension.', testObject.tooltip);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1231,7 +1240,7 @@ suite('ExtensionsActions Test', () => {
|
||||
test('Test ReloadAction when extension enablement is toggled when running', () => {
|
||||
instantiationService.stubPromise(IExtensionService, 'getExtensions', [{ identifier: new ExtensionIdentifier('pub.a'), version: '1.0.0', extensionLocation: URI.file('pub.a') }]);
|
||||
const testObject: ExtensionsActions.ReloadAction = instantiationService.createInstance(ExtensionsActions.ReloadAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a');
|
||||
const workbenchService = instantiationService.get(IExtensionsWorkbenchService);
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
@@ -1250,7 +1259,7 @@ suite('ExtensionsActions Test', () => {
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.Disabled)
|
||||
.then(() => {
|
||||
const testObject: ExtensionsActions.ReloadAction = instantiationService.createInstance(ExtensionsActions.ReloadAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const workbenchService = instantiationService.get(IExtensionsWorkbenchService);
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
return workbenchService.queryLocal()
|
||||
@@ -1261,7 +1270,7 @@ suite('ExtensionsActions Test', () => {
|
||||
.then(() => {
|
||||
assert.ok(testObject.enabled);
|
||||
// {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
|
||||
assert.equal('Please reload Azure Data Studio to complete the enabling of this extension.', testObject.tooltip);
|
||||
assert.equal('Please reload Azure Data Studio to enable this extension.', testObject.tooltip);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1273,7 +1282,7 @@ suite('ExtensionsActions Test', () => {
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.Disabled)
|
||||
.then(() => {
|
||||
const testObject: ExtensionsActions.ReloadAction = instantiationService.createInstance(ExtensionsActions.ReloadAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const workbenchService = instantiationService.get(IExtensionsWorkbenchService);
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
return workbenchService.queryLocal()
|
||||
@@ -1292,7 +1301,7 @@ suite('ExtensionsActions Test', () => {
|
||||
return instantiationService.get(IExtensionEnablementService).setEnablement([local], EnablementState.Disabled)
|
||||
.then(() => {
|
||||
const testObject: ExtensionsActions.ReloadAction = instantiationService.createInstance(ExtensionsActions.ReloadAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const workbenchService = instantiationService.get(IExtensionsWorkbenchService);
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
return workbenchService.queryLocal()
|
||||
@@ -1307,7 +1316,7 @@ suite('ExtensionsActions Test', () => {
|
||||
.then(() => {
|
||||
assert.ok(testObject.enabled);
|
||||
// {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
|
||||
assert.equal('Please reload Azure Data Studio to complete the enabling of this extension.', testObject.tooltip);
|
||||
assert.equal('Please reload Azure Data Studio to enable this extension.', testObject.tooltip);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1317,7 +1326,7 @@ suite('ExtensionsActions Test', () => {
|
||||
test('Test ReloadAction when a localization extension is newly installed', async () => {
|
||||
instantiationService.stubPromise(IExtensionService, 'getExtensions', [{ identifier: new ExtensionIdentifier('pub.b'), extensionLocation: URI.file('pub.b') }]);
|
||||
const testObject: ExtensionsActions.ReloadAction = instantiationService.createInstance(ExtensionsActions.ReloadAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
|
||||
@@ -1333,7 +1342,7 @@ suite('ExtensionsActions Test', () => {
|
||||
test('Test ReloadAction when a localization extension is updated while running', async () => {
|
||||
instantiationService.stubPromise(IExtensionService, 'getExtensions', [{ identifier: new ExtensionIdentifier('pub.a'), version: '1.0.1', extensionLocation: URI.file('pub.a') }]);
|
||||
const testObject: ExtensionsActions.ReloadAction = instantiationService.createInstance(ExtensionsActions.ReloadAction);
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
instantiationService.createInstance(ExtensionContainers, [testObject]);
|
||||
const local = aLocalExtension('a', { version: '1.0.1', contributes: <IExtensionContributions>{ localizations: [{ languageId: 'de', translations: [] }] } });
|
||||
const workbenchService = instantiationService.get(IExtensionsWorkbenchService);
|
||||
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
|
||||
|
||||
@@ -37,7 +37,6 @@ import { SinonStub } from 'sinon';
|
||||
import { IExperimentService, ExperimentService, ExperimentState, ExperimentActionType } from 'vs/workbench/contrib/experiments/node/experimentService';
|
||||
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
|
||||
import { RemoteAgentService } from 'vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl';
|
||||
import { ExtensionManagementServerService } from 'vs/workbench/services/extensions/electron-browser/extensionManagementServerService';
|
||||
import { ExtensionIdentifier, ExtensionType, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
|
||||
|
||||
@@ -90,7 +89,11 @@ suite('ExtensionsListView Tests', () => {
|
||||
instantiationService.stub(IExtensionManagementService, 'onDidUninstallExtension', didUninstallEvent.event);
|
||||
instantiationService.stub(IRemoteAgentService, RemoteAgentService);
|
||||
|
||||
instantiationService.stub(IExtensionManagementServerService, instantiationService.createInstance(ExtensionManagementServerService));
|
||||
instantiationService.stub(IExtensionManagementServerService, <IExtensionManagementServerService>{
|
||||
localExtensionManagementServer: {
|
||||
extensionManagementService: instantiationService.get(IExtensionManagementService)
|
||||
}
|
||||
});
|
||||
|
||||
instantiationService.stub(IExtensionEnablementService, new TestExtensionEnablementService(instantiationService));
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ import { URLService } from 'vs/platform/url/common/urlService';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { ExtensionType } from 'vs/platform/extensions/common/extensions';
|
||||
import { ExtensionManagementServerService } from 'vs/workbench/services/extensions/electron-browser/extensionManagementServerService';
|
||||
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
|
||||
import { RemoteAgentService } from 'vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl';
|
||||
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
|
||||
@@ -77,7 +76,6 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
});
|
||||
|
||||
instantiationService.stub(IRemoteAgentService, RemoteAgentService);
|
||||
instantiationService.stub(IExtensionManagementServerService, instantiationService.createInstance(ExtensionManagementServerService));
|
||||
|
||||
instantiationService.stub(IExtensionManagementService, ExtensionManagementService);
|
||||
instantiationService.stub(IExtensionManagementService, 'onInstallExtension', installEvent.event);
|
||||
@@ -85,6 +83,12 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
instantiationService.stub(IExtensionManagementService, 'onUninstallExtension', uninstallEvent.event);
|
||||
instantiationService.stub(IExtensionManagementService, 'onDidUninstallExtension', didUninstallEvent.event);
|
||||
|
||||
instantiationService.stub(IExtensionManagementServerService, <IExtensionManagementServerService>{
|
||||
localExtensionManagementServer: {
|
||||
extensionManagementService: instantiationService.get(IExtensionManagementService)
|
||||
}
|
||||
});
|
||||
|
||||
instantiationService.stub(IExtensionEnablementService, new TestExtensionEnablementService(instantiationService));
|
||||
|
||||
instantiationService.set(IExtensionTipsService, instantiationService.createInstance(ExtensionTipsService));
|
||||
|
||||
Reference in New Issue
Block a user