mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-30 00:30:29 -04:00
Merge from vscode a5cf1da01d5db3d2557132be8d30f89c38019f6c (#8525)
* Merge from vscode a5cf1da01d5db3d2557132be8d30f89c38019f6c * remove files we don't want * fix hygiene * update distro * update distro * fix hygiene * fix strict nulls * distro * distro * fix tests * fix tests * add another edit * fix viewlet icon * fix azure dialog * fix some padding * fix more padding issues
This commit is contained in:
@@ -16,7 +16,7 @@ import { dispose, Disposable } from 'vs/base/common/lifecycle';
|
||||
// {{SQL CARBON EDIT}}
|
||||
import { IExtension, ExtensionState, IExtensionsWorkbenchService, VIEWLET_ID, IExtensionsViewlet, AutoUpdateConfigurationKey, IExtensionContainer, EXTENSIONS_CONFIG } from 'vs/workbench/contrib/extensions/common/extensions';
|
||||
import { ExtensionsConfigurationInitialContent } from 'vs/workbench/contrib/extensions/common/extensionsFileTemplate';
|
||||
import { ExtensionsLabel, IGalleryExtension, IExtensionGalleryService, INSTALL_ERROR_MALICIOUS, INSTALL_ERROR_INCOMPATIBLE, IGalleryExtensionVersion, ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { ExtensionsLabel, IGalleryExtension, IExtensionGalleryService, INSTALL_ERROR_MALICIOUS, INSTALL_ERROR_INCOMPATIBLE, IGalleryExtensionVersion, ILocalExtension, INSTALL_ERROR_NOT_SUPPORTED } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionEnablementService, EnablementState, IExtensionManagementServerService, IExtensionTipsService, IExtensionRecommendation, IExtensionsConfigContent, IExtensionManagementServer } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { ExtensionType, ExtensionIdentifier, IExtensionDescription, IExtensionManifest, isLanguagePackExtension, ExtensionsPolicy, ExtensionsPolicyKey } from 'vs/platform/extensions/common/extensions'; // {{SQL CARBON EDIT}}
|
||||
@@ -55,12 +55,12 @@ 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 { isUIExtension } from 'vs/workbench/services/extensions/common/extensionsUtil';
|
||||
import { prefersExecuteOnUI, prefersExecuteOnWorkspace } from 'vs/workbench/services/extensions/common/extensionsUtil';
|
||||
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { IFileDialogService, IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { IProgressService, ProgressLocation } from 'vs/platform/progress/common/progress';
|
||||
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; // {{SQL CARBON EDIT}}
|
||||
@@ -76,31 +76,37 @@ export function toExtensionDescription(local: ILocalExtension): IExtensionDescri
|
||||
};
|
||||
}
|
||||
|
||||
const promptDownloadManually = (extension: IGalleryExtension | undefined, message: string, error: Error,
|
||||
instantiationService: IInstantiationService, notificationService: INotificationService, openerService: IOpenerService, productService: IProductService) => {
|
||||
if (!extension || error.name === INSTALL_ERROR_INCOMPATIBLE || error.name === INSTALL_ERROR_MALICIOUS || !productService.extensionsGallery) {
|
||||
return Promise.reject(error);
|
||||
} else {
|
||||
const downloadUrl = (extension.assets.downloadPage && extension.assets.downloadPage.uri) || extension.assets.download.uri; // {{SQL CARBON EDIT}} Use the URI directly since we don't have a marketplace hosting the packages
|
||||
notificationService.prompt(Severity.Error, message, [{
|
||||
label: localize('download', "Download Manually"),
|
||||
run: () => openerService.open(URI.parse(downloadUrl)).then(() => {
|
||||
notificationService.prompt(
|
||||
Severity.Info,
|
||||
localize('install vsix', 'Once downloaded, please manually install the downloaded VSIX of \'{0}\'.', extension.identifier.id),
|
||||
[{
|
||||
label: InstallVSIXAction.LABEL,
|
||||
run: () => {
|
||||
const action = instantiationService.createInstance(InstallVSIXAction, InstallVSIXAction.ID, InstallVSIXAction.LABEL);
|
||||
action.run();
|
||||
action.dispose();
|
||||
}
|
||||
}]
|
||||
);
|
||||
})
|
||||
}]);
|
||||
return Promise.resolve();
|
||||
}
|
||||
const promptDownloadManually = (extension: IGalleryExtension | undefined, message: string, error: Error, instantiationService: IInstantiationService): Promise<any> => {
|
||||
return instantiationService.invokeFunction(accessor => {
|
||||
const productService = accessor.get(IProductService);
|
||||
const openerService = accessor.get(IOpenerService);
|
||||
const notificationService = accessor.get(INotificationService);
|
||||
const dialogService = accessor.get(IDialogService);
|
||||
const erorrsToShows = [INSTALL_ERROR_INCOMPATIBLE, INSTALL_ERROR_MALICIOUS, INSTALL_ERROR_NOT_SUPPORTED];
|
||||
if (!extension || erorrsToShows.indexOf(error.name) !== -1 || !productService.extensionsGallery) {
|
||||
return dialogService.show(Severity.Error, error.message, []);
|
||||
} else {
|
||||
const downloadUrl = (extension.assets.downloadPage && extension.assets.downloadPage.uri) || extension.assets.download.uri; // {{SQL CARBON EDIT}} Use the URI directly since we don't have a marketplace hosting the packages
|
||||
notificationService.prompt(Severity.Error, message, [{
|
||||
label: localize('download', "Download Manually"),
|
||||
run: () => openerService.open(URI.parse(downloadUrl)).then(() => {
|
||||
notificationService.prompt(
|
||||
Severity.Info,
|
||||
localize('install vsix', 'Once downloaded, please manually install the downloaded VSIX of \'{0}\'.', extension.identifier.id),
|
||||
[{
|
||||
label: InstallVSIXAction.LABEL,
|
||||
run: () => {
|
||||
const action = instantiationService.createInstance(InstallVSIXAction, InstallVSIXAction.ID, InstallVSIXAction.LABEL);
|
||||
action.run();
|
||||
action.dispose();
|
||||
}
|
||||
}]
|
||||
);
|
||||
})
|
||||
}]);
|
||||
return Promise.resolve();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function getRelativeDateLabel(date: Date): string {
|
||||
@@ -138,9 +144,9 @@ function getRelativeDateLabel(date: Date): string {
|
||||
}
|
||||
|
||||
export abstract class ExtensionAction extends Action implements IExtensionContainer {
|
||||
private _extension: IExtension;
|
||||
get extension(): IExtension { return this._extension; }
|
||||
set extension(extension: IExtension) { this._extension = extension; this.update(); }
|
||||
private _extension: IExtension | null = null;
|
||||
get extension(): IExtension | null { return this._extension; }
|
||||
set extension(extension: IExtension | null) { this._extension = extension; this.update(); }
|
||||
abstract update(): void;
|
||||
}
|
||||
|
||||
@@ -153,7 +159,7 @@ export class InstallAction extends ExtensionAction {
|
||||
private static readonly InstallingClass = 'extension-action install installing';
|
||||
|
||||
|
||||
private _manifest: IExtensionManifest | null;
|
||||
private _manifest: IExtensionManifest | null = null;
|
||||
set manifest(manifest: IExtensionManifest) {
|
||||
this._manifest = manifest;
|
||||
this.updateLabel();
|
||||
@@ -163,7 +169,6 @@ export class InstallAction extends ExtensionAction {
|
||||
@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,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@@ -196,12 +201,15 @@ export class InstallAction extends ExtensionAction {
|
||||
}
|
||||
|
||||
private updateLabel(): void {
|
||||
if (!this.extension) {
|
||||
return;
|
||||
}
|
||||
if (this.extension.state === ExtensionState.Installing) {
|
||||
this.label = InstallAction.INSTALLING_LABEL;
|
||||
this.tooltip = InstallAction.INSTALLING_LABEL;
|
||||
} else {
|
||||
if (this._manifest && this.extensionManagementServerService.localExtensionManagementServer && this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
if (isUIExtension(this._manifest, this.productService, this.configurationService)) {
|
||||
if (prefersExecuteOnUI(this._manifest, this.productService, this.configurationService)) {
|
||||
this.label = `${InstallAction.INSTALL_LABEL} ${localize('locally', "Locally")}`;
|
||||
this.tooltip = `${InstallAction.INSTALL_LABEL} ${localize('locally', "Locally")}`;
|
||||
} else {
|
||||
@@ -217,6 +225,9 @@ export class InstallAction extends ExtensionAction {
|
||||
}
|
||||
|
||||
async run(): Promise<any> {
|
||||
if (!this.extension) {
|
||||
return;
|
||||
}
|
||||
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));
|
||||
@@ -263,7 +274,7 @@ export class InstallAction extends ExtensionAction {
|
||||
|
||||
console.error(err);
|
||||
|
||||
return promptDownloadManually(extension.gallery, localize('failedToInstall', "Failed to install \'{0}\'.", extension.identifier.id), err, this.instantiationService, this.notificationService, this.openerService, this.productService);
|
||||
return promptDownloadManually(extension.gallery, localize('failedToInstall', "Failed to install \'{0}\'.", extension.identifier.id), err, this.instantiationService);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -315,7 +326,7 @@ export abstract class InstallInOtherServerAction extends ExtensionAction {
|
||||
// disabled by extension kind or it is a language pack extension
|
||||
&& (this.extension.enablementState === EnablementState.DisabledByExtensionKind || isLanguagePackExtension(this.extension.local.manifest))
|
||||
) {
|
||||
const extensionInOtherServer = this.extensionsWorkbenchService.installed.filter(e => areSameExtensions(e.identifier, this.extension.identifier) && e.server === this.server)[0];
|
||||
const extensionInOtherServer = this.extensionsWorkbenchService.installed.filter(e => areSameExtensions(e.identifier, this.extension!.identifier) && e.server === this.server)[0];
|
||||
if (extensionInOtherServer) {
|
||||
// Getting installed in other server
|
||||
if (extensionInOtherServer.state === ExtensionState.Installing && !extensionInOtherServer.local) {
|
||||
@@ -332,6 +343,9 @@ export abstract class InstallInOtherServerAction extends ExtensionAction {
|
||||
}
|
||||
|
||||
async run(): Promise<void> {
|
||||
if (!this.extension) {
|
||||
return;
|
||||
}
|
||||
if (this.server) {
|
||||
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));
|
||||
@@ -424,12 +438,14 @@ export class UninstallAction extends ExtensionAction {
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
async run(): Promise<any> {
|
||||
if (!this.extension) {
|
||||
return;
|
||||
}
|
||||
alert(localize('uninstallExtensionStart', "Uninstalling extension {0} started.", this.extension.displayName));
|
||||
|
||||
return this.extensionsWorkbenchService.uninstall(this.extension).then(() => {
|
||||
// {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
|
||||
alert(localize('uninstallExtensionComplete', "Please reload Azure Data Studio to complete the uninstallation of the extension {0}.", this.extension.displayName));
|
||||
alert(localize('uninstallExtensionComplete', "Please reload Azure Data Studio to complete the uninstallation of the extension {0}.", this.extension!.displayName)); // {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -510,8 +526,6 @@ export class UpdateAction extends ExtensionAction {
|
||||
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@INotificationService private readonly notificationService: INotificationService,
|
||||
@IOpenerService private readonly openerService: IOpenerService,
|
||||
@IProductService private readonly productService: IProductService
|
||||
) {
|
||||
super(`extensions.update`, '', UpdateAction.DisabledClass, false);
|
||||
this.update();
|
||||
@@ -540,14 +554,17 @@ export class UpdateAction extends ExtensionAction {
|
||||
this.label = this.extension.outdated ? this.getUpdateLabel(this.extension.latestVersion) : this.getUpdateLabel();
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
async run(): Promise<any> {
|
||||
if (!this.extension) {
|
||||
return;
|
||||
}
|
||||
alert(localize('updateExtensionStart', "Updating extension {0} to version {1} started.", this.extension.displayName, this.extension.latestVersion));
|
||||
return this.install(this.extension);
|
||||
}
|
||||
|
||||
private install(extension: IExtension): Promise<void> {
|
||||
return this.extensionsWorkbenchService.install(extension).then(() => {
|
||||
alert(localize('updateExtensionComplete', "Updating extension {0} to version {1} completed.", this.extension.displayName, this.extension.latestVersion));
|
||||
alert(localize('updateExtensionComplete', "Updating extension {0} to version {1} completed.", extension.displayName, extension.latestVersion));
|
||||
}, err => {
|
||||
if (!extension.gallery) {
|
||||
return this.notificationService.error(err);
|
||||
@@ -562,7 +579,7 @@ export class UpdateAction extends ExtensionAction {
|
||||
|
||||
console.error(err);
|
||||
|
||||
return promptDownloadManually(extension.gallery, localize('failedToUpdate', "Failed to update \'{0}\'.", extension.identifier.id), err, this.instantiationService, this.notificationService, this.openerService, this.productService);
|
||||
return promptDownloadManually(extension.gallery, localize('failedToUpdate', "Failed to update \'{0}\'.", extension.identifier.id), err, this.instantiationService);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -577,8 +594,6 @@ interface IExtensionActionViewItemOptions extends IActionViewItemOptions {
|
||||
|
||||
export class ExtensionActionViewItem extends ActionViewItem {
|
||||
|
||||
protected options: IExtensionActionViewItemOptions;
|
||||
|
||||
constructor(context: any, action: IAction, options: IExtensionActionViewItemOptions = {}) {
|
||||
super(context, action, options);
|
||||
}
|
||||
@@ -586,14 +601,14 @@ export class ExtensionActionViewItem extends ActionViewItem {
|
||||
updateEnabled(): void {
|
||||
super.updateEnabled();
|
||||
|
||||
if (this.label && this.options.tabOnlyOnFocus && this.getAction().enabled && !this._hasFocus) {
|
||||
if (this.label && (<IExtensionActionViewItemOptions>this.options).tabOnlyOnFocus && this.getAction().enabled && !this._hasFocus) {
|
||||
DOM.removeTabIndexAndUpdateFocus(this.label);
|
||||
}
|
||||
}
|
||||
|
||||
private _hasFocus: boolean;
|
||||
private _hasFocus: boolean = false;
|
||||
setFocus(value: boolean): void {
|
||||
if (!this.options.tabOnlyOnFocus || this._hasFocus === value) {
|
||||
if (!(<IExtensionActionViewItemOptions>this.options).tabOnlyOnFocus || this._hasFocus === value) {
|
||||
return;
|
||||
}
|
||||
this._hasFocus = value;
|
||||
@@ -620,7 +635,7 @@ export abstract class ExtensionDropDownAction extends ExtensionAction {
|
||||
super(id, label, cssClass, enabled);
|
||||
}
|
||||
|
||||
private _actionViewItem: DropDownMenuActionViewItem;
|
||||
private _actionViewItem: DropDownMenuActionViewItem | null = null;
|
||||
createActionViewItem(): DropDownMenuActionViewItem {
|
||||
this._actionViewItem = this.instantiationService.createInstance(DropDownMenuActionViewItem, this, this.tabOnlyOnFocus);
|
||||
return this._actionViewItem;
|
||||
@@ -669,7 +684,7 @@ export class DropDownMenuActionViewItem extends ExtensionActionViewItem {
|
||||
export class ManageExtensionAction extends ExtensionDropDownAction {
|
||||
|
||||
static readonly ID = 'extensions.manage';
|
||||
private static readonly Class = 'extension-action manage';
|
||||
private static readonly Class = 'extension-action manage codicon-gear';
|
||||
private static readonly HideManageExtensionClass = `${ManageExtensionAction.Class} hide`;
|
||||
|
||||
constructor(
|
||||
@@ -712,13 +727,14 @@ export class ManageExtensionAction extends ExtensionDropDownAction {
|
||||
groups.push([this.instantiationService.createInstance(UninstallAction)]);
|
||||
groups.push([this.instantiationService.createInstance(InstallAnotherVersionAction)]);
|
||||
|
||||
const extensionActions: ExtensionAction[] = [this.instantiationService.createInstance(ExtensionInfoAction)];
|
||||
if (this.extension.local && this.extension.local.manifest.contributes && this.extension.local.manifest.contributes.configuration) {
|
||||
extensionActions.push(this.instantiationService.createInstance(ExtensionSettingsAction));
|
||||
if (this.extension) {
|
||||
const extensionActions: ExtensionAction[] = [this.instantiationService.createInstance(ExtensionInfoAction)];
|
||||
if (this.extension.local && this.extension.local.manifest.contributes && this.extension.local.manifest.contributes.configuration) {
|
||||
extensionActions.push(this.instantiationService.createInstance(ExtensionSettingsAction));
|
||||
}
|
||||
groups.push(extensionActions);
|
||||
}
|
||||
|
||||
groups.push(extensionActions);
|
||||
|
||||
groups.forEach(group => group.forEach(extensionAction => extensionAction.extension = this.extension));
|
||||
|
||||
return groups;
|
||||
@@ -754,15 +770,13 @@ export class InstallAnotherVersionAction extends ExtensionAction {
|
||||
@IQuickInputService private readonly quickInputService: IQuickInputService,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@INotificationService private readonly notificationService: INotificationService,
|
||||
@IOpenerService private readonly openerService: IOpenerService,
|
||||
@IProductService private readonly productService: IProductService
|
||||
) {
|
||||
super(InstallAnotherVersionAction.ID, InstallAnotherVersionAction.LABEL);
|
||||
this.update();
|
||||
}
|
||||
|
||||
update(): void {
|
||||
this.enabled = this.extension && !!this.extension.gallery;
|
||||
this.enabled = !!this.extension && !!this.extension.gallery;
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
@@ -772,19 +786,19 @@ export class InstallAnotherVersionAction extends ExtensionAction {
|
||||
return this.quickInputService.pick(this.getVersionEntries(), { placeHolder: localize('selectVersion', "Select Version to Install"), matchOnDetail: true })
|
||||
.then(pick => {
|
||||
if (pick) {
|
||||
if (this.extension.version === pick.id) {
|
||||
if (this.extension!.version === pick.id) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
const promise: Promise<any> = pick.latest ? this.extensionsWorkbenchService.install(this.extension) : this.extensionsWorkbenchService.installVersion(this.extension, pick.id);
|
||||
const promise: Promise<any> = pick.latest ? this.extensionsWorkbenchService.install(this.extension!) : this.extensionsWorkbenchService.installVersion(this.extension!, pick.id);
|
||||
return promise
|
||||
.then(null, err => {
|
||||
if (!this.extension.gallery) {
|
||||
if (!this.extension!.gallery) {
|
||||
return this.notificationService.error(err);
|
||||
}
|
||||
|
||||
console.error(err);
|
||||
|
||||
return promptDownloadManually(this.extension.gallery, localize('failedToInstall', "Failed to install \'{0}\'.", this.extension.identifier.id), err, this.instantiationService, this.notificationService, this.openerService, this.productService);
|
||||
return promptDownloadManually(this.extension!.gallery, localize('failedToInstall', "Failed to install \'{0}\'.", this.extension!.identifier.id), err, this.instantiationService);
|
||||
});
|
||||
}
|
||||
return null;
|
||||
@@ -792,8 +806,8 @@ export class InstallAnotherVersionAction extends ExtensionAction {
|
||||
}
|
||||
|
||||
private getVersionEntries(): Promise<(IQuickPickItem & { latest: boolean, id: string })[]> {
|
||||
return this.extensionGalleryService.getAllVersions(this.extension.gallery!, true)
|
||||
.then(allVersions => allVersions.map((v, i) => ({ id: v.version, label: v.version, description: `${getRelativeDateLabel(new Date(Date.parse(v.date)))}${v.version === this.extension.version ? ` (${localize('current', "Current")})` : ''}`, latest: i === 0 })));
|
||||
return this.extensionGalleryService.getAllVersions(this.extension!.gallery!, true)
|
||||
.then(allVersions => allVersions.map((v, i) => ({ id: v.version, label: v.version, description: `${getRelativeDateLabel(new Date(Date.parse(v.date)))}${v.version === this.extension!.version ? ` (${localize('current', "Current")})` : ''}`, latest: i === 0 })));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -813,7 +827,10 @@ export class ExtensionInfoAction extends ExtensionAction {
|
||||
this.enabled = !!this.extension;
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
async run(): Promise<any> {
|
||||
if (!this.extension) {
|
||||
return;
|
||||
}
|
||||
|
||||
const name = localize('extensionInfoName', 'Name: {0}', this.extension.displayName);
|
||||
const id = localize('extensionInfoId', 'Id: {0}', this.extension.identifier.id);
|
||||
@@ -843,7 +860,11 @@ export class ExtensionSettingsAction extends ExtensionAction {
|
||||
update(): void {
|
||||
this.enabled = !!this.extension;
|
||||
}
|
||||
run(): Promise<any> {
|
||||
|
||||
async run(): Promise<any> {
|
||||
if (!this.extension) {
|
||||
return;
|
||||
}
|
||||
this.preferencesService.openSettings(false, `@ext:${this.extension.identifier.id}`);
|
||||
return Promise.resolve();
|
||||
}
|
||||
@@ -871,7 +892,10 @@ export class EnableForWorkspaceAction extends ExtensionAction {
|
||||
}
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
async run(): Promise<any> {
|
||||
if (!this.extension) {
|
||||
return;
|
||||
}
|
||||
return this.extensionsWorkbenchService.setEnablement(this.extension, EnablementState.EnabledWorkspace);
|
||||
}
|
||||
}
|
||||
@@ -898,7 +922,10 @@ export class EnableGloballyAction extends ExtensionAction {
|
||||
}
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
async run(): Promise<any> {
|
||||
if (!this.extension) {
|
||||
return;
|
||||
}
|
||||
return this.extensionsWorkbenchService.setEnablement(this.extension, EnablementState.EnabledGlobally);
|
||||
}
|
||||
}
|
||||
@@ -919,14 +946,17 @@ export class DisableForWorkspaceAction extends ExtensionAction {
|
||||
|
||||
update(): void {
|
||||
this.enabled = false;
|
||||
if (this.extension && this.extension.local && this.runningExtensions.some(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension.identifier) && this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY)) {
|
||||
if (this.extension && this.extension.local && this.runningExtensions.some(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension!.identifier) && this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY)) {
|
||||
this.enabled = this.extension.state === ExtensionState.Installed
|
||||
&& (this.extension.enablementState === EnablementState.EnabledGlobally || this.extension.enablementState === EnablementState.EnabledWorkspace)
|
||||
&& this.extensionEnablementService.canChangeEnablement(this.extension.local);
|
||||
}
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
async run(): Promise<any> {
|
||||
if (!this.extension) {
|
||||
return;
|
||||
}
|
||||
return this.extensionsWorkbenchService.setEnablement(this.extension, EnablementState.DisabledWorkspace);
|
||||
}
|
||||
}
|
||||
@@ -946,14 +976,17 @@ export class DisableGloballyAction extends ExtensionAction {
|
||||
|
||||
update(): void {
|
||||
this.enabled = false;
|
||||
if (this.extension && this.extension.local && this.runningExtensions.some(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension.identifier))) {
|
||||
if (this.extension && this.extension.local && this.runningExtensions.some(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension!.identifier))) {
|
||||
this.enabled = this.extension.state === ExtensionState.Installed
|
||||
&& (this.extension.enablementState === EnablementState.EnabledGlobally || this.extension.enablementState === EnablementState.EnabledWorkspace)
|
||||
&& this.extensionEnablementService.canChangeEnablement(this.extension.local);
|
||||
}
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
async run(): Promise<any> {
|
||||
if (!this.extension) {
|
||||
return;
|
||||
}
|
||||
return this.extensionsWorkbenchService.setEnablement(this.extension, EnablementState.DisabledGlobally);
|
||||
}
|
||||
}
|
||||
@@ -1038,6 +1071,7 @@ export class CheckForUpdatesAction extends Action {
|
||||
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@IExtensionEnablementService private readonly extensionEnablementService: IExtensionEnablementService,
|
||||
@IViewletService private readonly viewletService: IViewletService,
|
||||
@IDialogService private readonly dialogService: IDialogService,
|
||||
@INotificationService private readonly notificationService: INotificationService
|
||||
) {
|
||||
super(id, label, '', true);
|
||||
@@ -1046,7 +1080,7 @@ export class CheckForUpdatesAction extends Action {
|
||||
private checkUpdatesAndNotify(): void {
|
||||
const outdated = this.extensionsWorkbenchService.outdated;
|
||||
if (!outdated.length) {
|
||||
this.notificationService.info(localize('noUpdatesAvailable', "All extensions are up to date."));
|
||||
this.dialogService.show(Severity.Info, localize('noUpdatesAvailable', "All extensions are up to date."), [localize('ok', "OK")]);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1138,8 +1172,6 @@ export class UpdateAllAction extends Action {
|
||||
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@INotificationService private readonly notificationService: INotificationService,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@IOpenerService private readonly openerService: IOpenerService,
|
||||
@IProductService private readonly productService: IProductService
|
||||
) {
|
||||
super(id, label, '', false);
|
||||
|
||||
@@ -1163,7 +1195,7 @@ export class UpdateAllAction extends Action {
|
||||
|
||||
console.error(err);
|
||||
|
||||
return promptDownloadManually(extension.gallery, localize('failedToUpdate', "Failed to update \'{0}\'.", extension.identifier.id), err, this.instantiationService, this.notificationService, this.openerService, this.productService);
|
||||
return promptDownloadManually(extension.gallery, localize('failedToUpdate', "Failed to update \'{0}\'.", extension.identifier.id), err, this.instantiationService);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1181,7 +1213,9 @@ export class ReloadAction extends ExtensionAction {
|
||||
@IHostService private readonly hostService: IHostService,
|
||||
@IExtensionService private readonly extensionService: IExtensionService,
|
||||
@IExtensionEnablementService private readonly extensionEnablementService: IExtensionEnablementService,
|
||||
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService
|
||||
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService,
|
||||
@IProductService private readonly productService: IProductService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
) {
|
||||
super('extensions.reload', localize('reloadAction', "Reload"), ReloadAction.DisabledClass, false);
|
||||
this._register(this.extensionService.onDidChangeExtensions(this.updateRunningExtensions, this));
|
||||
@@ -1210,11 +1244,11 @@ export class ReloadAction extends ExtensionAction {
|
||||
}
|
||||
|
||||
private computeReloadState(): void {
|
||||
if (!this._runningExtensions) {
|
||||
if (!this._runningExtensions || !this.extension) {
|
||||
return;
|
||||
}
|
||||
const isUninstalled = this.extension.state === ExtensionState.Uninstalled;
|
||||
const runningExtension = this._runningExtensions.filter(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension.identifier))[0];
|
||||
const runningExtension = this._runningExtensions.filter(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension!.identifier))[0];
|
||||
const isSameExtensionRunning = runningExtension && this.extension.server === this.extensionManagementServerService.getExtensionManagementServer(runningExtension.extensionLocation);
|
||||
|
||||
if (isUninstalled) {
|
||||
@@ -1233,16 +1267,37 @@ export class ReloadAction extends ExtensionAction {
|
||||
// Extension is running
|
||||
if (runningExtension) {
|
||||
if (isEnabled) {
|
||||
if (!this.extensionService.canAddExtension(toExtensionDescription(this.extension.local))) {
|
||||
if (isSameExtensionRunning) {
|
||||
if (this.extension.version !== runningExtension.version) {
|
||||
// No Reload is required if extension can run without reload
|
||||
if (this.extensionService.canAddExtension(toExtensionDescription(this.extension.local))) {
|
||||
return;
|
||||
}
|
||||
if (isSameExtensionRunning) {
|
||||
// Different version of same extension is running. Requires reload to run the current version
|
||||
if (this.extension.version !== runningExtension.version) {
|
||||
this.enabled = true;
|
||||
this.label = localize('reloadRequired', "Reload Required");
|
||||
this.tooltip = localize('postUpdateTooltip', "Please reload Azure Data Studio to enable the updated extension."); // {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
|
||||
}
|
||||
} else {
|
||||
const runningExtensionServer = this.extensionManagementServerService.getExtensionManagementServer(runningExtension.extensionLocation);
|
||||
if (this.extension.server === this.extensionManagementServerService.localExtensionManagementServer && runningExtensionServer === this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
// This extension prefers to run on UI/Local side but is running in remote
|
||||
if (prefersExecuteOnUI(this.extension.local!.manifest, this.productService, this.configurationService)) {
|
||||
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.");
|
||||
this.tooltip = localize('postEnableTooltip', "Please reload Azure Data Studio to enable this extension."); // {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
|
||||
}
|
||||
}
|
||||
if (this.extension.server === this.extensionManagementServerService.remoteExtensionManagementServer && runningExtensionServer === this.extensionManagementServerService.localExtensionManagementServer) {
|
||||
// This extension prefers to run on Workspace/Remote side but is running in local
|
||||
if (prefersExecuteOnWorkspace(this.extension.local!.manifest, this.productService, this.configurationService)) {
|
||||
this.enabled = true;
|
||||
this.label = localize('reloadRequired', "Reload Required");
|
||||
this.tooltip = localize('postEnableTooltip', "Please reload Azure Data Studio to enable this extension."); // {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
if (isSameExtensionRunning) {
|
||||
this.enabled = true;
|
||||
@@ -1265,7 +1320,7 @@ export class ReloadAction extends ExtensionAction {
|
||||
|
||||
const otherServer = this.extension.server ? this.extension.server === this.extensionManagementServerService.localExtensionManagementServer ? this.extensionManagementServerService.remoteExtensionManagementServer : this.extensionManagementServerService.localExtensionManagementServer : null;
|
||||
if (otherServer && this.extension.enablementState === EnablementState.DisabledByExtensionKind) {
|
||||
const extensionInOtherServer = this.extensionsWorkbenchService.local.filter(e => areSameExtensions(e.identifier, this.extension.identifier) && e.server === otherServer)[0];
|
||||
const extensionInOtherServer = this.extensionsWorkbenchService.local.filter(e => areSameExtensions(e.identifier, this.extension!.identifier) && e.server === otherServer)[0];
|
||||
// Same extension in other server exists and
|
||||
if (extensionInOtherServer && extensionInOtherServer.local && this.extensionEnablementService.isEnabled(extensionInOtherServer.local)) {
|
||||
this.enabled = true;
|
||||
@@ -1323,8 +1378,8 @@ export class SetColorThemeAction extends ExtensionAction {
|
||||
if (!this.enabled) {
|
||||
return;
|
||||
}
|
||||
let extensionThemes = SetColorThemeAction.getColorThemes(this.colorThemes, this.extension);
|
||||
const currentTheme = this.colorThemes.filter(t => t.settingsId === this.configurationService.getValue(COLOR_THEME_SETTING))[0];
|
||||
let extensionThemes = SetColorThemeAction.getColorThemes(this.colorThemes, this.extension!);
|
||||
const currentTheme = this.colorThemes.filter(t => t.settingsId === this.configurationService.getValue(COLOR_THEME_SETTING))[0] || this.workbenchThemeService.getColorTheme();
|
||||
showCurrentTheme = showCurrentTheme || extensionThemes.some(t => t.id === currentTheme.id);
|
||||
if (showCurrentTheme) {
|
||||
extensionThemes = extensionThemes.filter(t => t.id !== currentTheme.id);
|
||||
@@ -1389,7 +1444,7 @@ export class SetFileIconThemeAction extends ExtensionAction {
|
||||
if (!this.enabled) {
|
||||
return;
|
||||
}
|
||||
let extensionThemes = SetFileIconThemeAction.getFileIconThemes(this.fileIconThemes, this.extension);
|
||||
let extensionThemes = SetFileIconThemeAction.getFileIconThemes(this.fileIconThemes, this.extension!);
|
||||
const currentTheme = this.fileIconThemes.filter(t => t.settingsId === this.configurationService.getValue(ICON_THEME_SETTING))[0] || this.workbenchThemeService.getFileIconTheme();
|
||||
showCurrentTheme = showCurrentTheme || extensionThemes.some(t => t.id === currentTheme.id);
|
||||
if (showCurrentTheme) {
|
||||
@@ -1518,7 +1573,7 @@ export class ClearExtensionsInputAction extends Action {
|
||||
value: string,
|
||||
@IViewletService private readonly viewletService: IViewletService
|
||||
) {
|
||||
super(id, label, 'clear-extensions', true);
|
||||
super(id, label, 'codicon-clear-all', true);
|
||||
this.onSearchChange(value);
|
||||
this._register(onSearchChange(this.onSearchChange, this));
|
||||
}
|
||||
@@ -1643,9 +1698,7 @@ export class InstallWorkspaceRecommendedExtensionsAction extends Action {
|
||||
label: string = InstallWorkspaceRecommendedExtensionsAction.LABEL,
|
||||
recommendations: IExtensionRecommendation[],
|
||||
@IViewletService private readonly viewletService: IViewletService,
|
||||
@INotificationService private readonly notificationService: INotificationService,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@IOpenerService private readonly openerService: IOpenerService,
|
||||
@IExtensionsWorkbenchService private readonly extensionWorkbenchService: IExtensionsWorkbenchService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService,
|
||||
@@ -1676,7 +1729,7 @@ export class InstallWorkspaceRecommendedExtensionsAction extends Action {
|
||||
private async installExtension(extension: IExtension): Promise<void> {
|
||||
try {
|
||||
if (extension.local && extension.gallery) {
|
||||
if (isUIExtension(extension.local.manifest, this.productService, this.configurationService)) {
|
||||
if (prefersExecuteOnUI(extension.local.manifest, this.productService, this.configurationService)) {
|
||||
if (this.extensionManagementServerService.localExtensionManagementServer) {
|
||||
await this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.installFromGallery(extension.gallery);
|
||||
return;
|
||||
@@ -1689,7 +1742,7 @@ export class InstallWorkspaceRecommendedExtensionsAction extends Action {
|
||||
await this.extensionWorkbenchService.install(extension);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return promptDownloadManually(extension.gallery, localize('failedToInstall', "Failed to install \'{0}\'.", extension.identifier.id), err, this.instantiationService, this.notificationService, this.openerService, this.productService);
|
||||
return promptDownloadManually(extension.gallery, localize('failedToInstall', "Failed to install \'{0}\'.", extension.identifier.id), err, this.instantiationService);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1704,11 +1757,8 @@ export class InstallRecommendedExtensionAction extends Action {
|
||||
constructor(
|
||||
extensionId: string,
|
||||
@IViewletService private readonly viewletService: IViewletService,
|
||||
@INotificationService private readonly notificationService: INotificationService,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@IOpenerService private readonly openerService: IOpenerService,
|
||||
@IExtensionsWorkbenchService private readonly extensionWorkbenchService: IExtensionsWorkbenchService,
|
||||
@IProductService private readonly productService: IProductService
|
||||
) {
|
||||
super(InstallRecommendedExtensionAction.ID, InstallRecommendedExtensionAction.LABEL, undefined, false);
|
||||
this.extensionId = extensionId;
|
||||
@@ -1727,7 +1777,7 @@ export class InstallRecommendedExtensionAction extends Action {
|
||||
return this.extensionWorkbenchService.install(extension)
|
||||
.then(() => null, err => {
|
||||
console.error(err);
|
||||
return promptDownloadManually(extension.gallery, localize('failedToInstall', "Failed to install \'{0}\'.", extension.identifier.id), err, this.instantiationService, this.notificationService, this.openerService, this.productService);
|
||||
return promptDownloadManually(extension.gallery, localize('failedToInstall', "Failed to install \'{0}\'.", extension.identifier.id), err, this.instantiationService);
|
||||
});
|
||||
}
|
||||
return null;
|
||||
@@ -1742,9 +1792,8 @@ export class IgnoreExtensionRecommendationAction extends Action {
|
||||
|
||||
private static readonly Class = 'extension-action ignore';
|
||||
|
||||
extension: IExtension;
|
||||
|
||||
constructor(
|
||||
private readonly extension: IExtension,
|
||||
@IExtensionTipsService private readonly extensionsTipsService: IExtensionTipsService,
|
||||
) {
|
||||
super(IgnoreExtensionRecommendationAction.ID, 'Ignore Recommendation');
|
||||
@@ -1766,9 +1815,8 @@ export class UndoIgnoreExtensionRecommendationAction extends Action {
|
||||
|
||||
private static readonly Class = 'extension-action undo-ignore';
|
||||
|
||||
extension: IExtension;
|
||||
|
||||
constructor(
|
||||
private readonly extension: IExtension,
|
||||
@IExtensionTipsService private readonly extensionsTipsService: IExtensionTipsService,
|
||||
) {
|
||||
super(UndoIgnoreExtensionRecommendationAction.ID, 'Undo');
|
||||
@@ -2124,7 +2172,7 @@ export abstract class AbstractConfigureRecommendedExtensionsAction extends Actio
|
||||
protected getWorkspaceFolderExtensionsConfigContent(extensionsFileResource: URI): Promise<IExtensionsConfigContent> {
|
||||
return Promise.resolve(this.fileService.readFile(extensionsFileResource))
|
||||
.then(content => {
|
||||
return (<IExtensionsConfigContent>json.parse(content.value.toString()));
|
||||
return (<IExtensionsConfigContent>json.parse(content.value.toString()) || {}) as IExtensionsConfigContent; // {{SQL CARBON EDIT}} strict-null-check
|
||||
}, err => ({ recommendations: [], unwantedRecommendations: [] }));
|
||||
}
|
||||
|
||||
@@ -2412,9 +2460,9 @@ export class StatusLabelAction extends Action implements IExtensionContainer {
|
||||
private status: ExtensionState | null = null;
|
||||
private enablementState: EnablementState | null = null;
|
||||
|
||||
private _extension: IExtension;
|
||||
get extension(): IExtension { return this._extension; }
|
||||
set extension(extension: IExtension) {
|
||||
private _extension: IExtension | null = null;
|
||||
get extension(): IExtension | null { return this._extension; }
|
||||
set extension(extension: IExtension | null) {
|
||||
if (!(this._extension && extension && areSameExtensions(this._extension.identifier, extension.identifier))) {
|
||||
// Different extension. Reset
|
||||
this.initialStatus = null;
|
||||
@@ -2455,21 +2503,21 @@ export class StatusLabelAction extends Action implements IExtensionContainer {
|
||||
|
||||
const runningExtensions = await this.extensionService.getExtensions();
|
||||
const canAddExtension = () => {
|
||||
const runningExtension = runningExtensions.filter(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension.identifier))[0];
|
||||
if (this.extension.local) {
|
||||
if (runningExtension && this.extension.version === runningExtension.version) {
|
||||
const runningExtension = runningExtensions.filter(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension!.identifier))[0];
|
||||
if (this.extension!.local) {
|
||||
if (runningExtension && this.extension!.version === runningExtension.version) {
|
||||
return true;
|
||||
}
|
||||
return this.extensionService.canAddExtension(toExtensionDescription(this.extension.local));
|
||||
return this.extensionService.canAddExtension(toExtensionDescription(this.extension!.local));
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const canRemoveExtension = () => {
|
||||
if (this.extension.local) {
|
||||
if (runningExtensions.every(e => !(areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension.identifier) && this.extension.server === this.extensionManagementServerService.getExtensionManagementServer(e.extensionLocation)))) {
|
||||
if (this.extension!.local) {
|
||||
if (runningExtensions.every(e => !(areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension!.identifier) && this.extension!.server === this.extensionManagementServerService.getExtensionManagementServer(e.extensionLocation)))) {
|
||||
return true;
|
||||
}
|
||||
return this.extensionService.canRemoveExtension(toExtensionDescription(this.extension.local));
|
||||
return this.extensionService.canRemoveExtension(toExtensionDescription(this.extension!.local));
|
||||
}
|
||||
return false;
|
||||
};
|
||||
@@ -2572,7 +2620,7 @@ export class ExtensionToolTipAction extends ExtensionAction {
|
||||
return this.warningAction.tooltip;
|
||||
}
|
||||
if (this.extension && this.extension.local && this.extension.state === ExtensionState.Installed && this._runningExtensions) {
|
||||
const isRunning = this._runningExtensions.some(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension.identifier));
|
||||
const isRunning = this._runningExtensions.some(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension!.identifier));
|
||||
const isEnabled = this.extensionEnablementService.isEnabled(this.extension.local);
|
||||
|
||||
if (isEnabled && isRunning) {
|
||||
@@ -2609,8 +2657,8 @@ export class ExtensionToolTipAction extends ExtensionAction {
|
||||
export class SystemDisabledWarningAction extends ExtensionAction {
|
||||
|
||||
private static readonly CLASS = 'system-disable';
|
||||
private static readonly WARNING_CLASS = `${SystemDisabledWarningAction.CLASS} warning`;
|
||||
private static readonly INFO_CLASS = `${SystemDisabledWarningAction.CLASS} info`;
|
||||
private static readonly WARNING_CLASS = `${SystemDisabledWarningAction.CLASS} codicon-warning`;
|
||||
private static readonly INFO_CLASS = `${SystemDisabledWarningAction.CLASS} codicon-info`;
|
||||
|
||||
updateWhenCounterExtensionChanges: boolean = true;
|
||||
private _runningExtensions: IExtensionDescription[] | null = null;
|
||||
@@ -2620,7 +2668,8 @@ export class SystemDisabledWarningAction extends ExtensionAction {
|
||||
@ILabelService private readonly labelService: ILabelService,
|
||||
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@IExtensionService private readonly extensionService: IExtensionService,
|
||||
@IExtensionEnablementService private readonly extensionEnablementService: IExtensionEnablementService,
|
||||
@IProductService private readonly productService: IProductService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
) {
|
||||
super('extensions.install', '', `${SystemDisabledWarningAction.CLASS} hide`, false);
|
||||
this._register(this.labelService.onDidChangeFormatters(() => this.update(), this));
|
||||
@@ -2641,37 +2690,48 @@ export class SystemDisabledWarningAction extends ExtensionAction {
|
||||
!this.extension.local ||
|
||||
!this.extension.server ||
|
||||
!this._runningExtensions ||
|
||||
!(this.extensionManagementServerService.localExtensionManagementServer && this.extensionManagementServerService.remoteExtensionManagementServer) ||
|
||||
this.extension.state !== ExtensionState.Installed
|
||||
) {
|
||||
return;
|
||||
}
|
||||
if (isLanguagePackExtension(this.extension.local.manifest)) {
|
||||
if (!this.extensionsWorkbenchService.installed.some(e => areSameExtensions(e.identifier, this.extension.identifier) && e.server !== this.extension.server)) {
|
||||
this.class = `${SystemDisabledWarningAction.INFO_CLASS}`;
|
||||
this.tooltip = this.extension.server === this.extensionManagementServerService.localExtensionManagementServer
|
||||
? localize('Install language pack also in remote server', "Install the language pack extension on '{0}' to enable it also there.", this.extensionManagementServerService.remoteExtensionManagementServer.label)
|
||||
: localize('Install language pack also locally', "Install the language pack extension locally to enable it also there.");
|
||||
if (this.extensionManagementServerService.localExtensionManagementServer && this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
if (isLanguagePackExtension(this.extension.local.manifest)) {
|
||||
if (!this.extensionsWorkbenchService.installed.some(e => areSameExtensions(e.identifier, this.extension!.identifier) && e.server !== this.extension!.server)) {
|
||||
this.class = `${SystemDisabledWarningAction.INFO_CLASS}`;
|
||||
this.tooltip = this.extension.server === this.extensionManagementServerService.localExtensionManagementServer
|
||||
? localize('Install language pack also in remote server', "Install the language pack extension on '{0}' to enable it also there.", this.extensionManagementServerService.remoteExtensionManagementServer.label)
|
||||
: localize('Install language pack also locally', "Install the language pack extension locally to enable it also there.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
const runningExtension = this._runningExtensions.filter(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension.identifier))[0];
|
||||
if (!runningExtension && this.extension.enablementState === EnablementState.DisabledByExtensionKind) {
|
||||
this.class = `${SystemDisabledWarningAction.WARNING_CLASS}`;
|
||||
const server = this.extensionManagementServerService.localExtensionManagementServer === this.extension.server ? this.extensionManagementServerService.remoteExtensionManagementServer : this.extensionManagementServerService.localExtensionManagementServer;
|
||||
this.tooltip = localize('Install in other server to enable', "Install the extension on '{0}' to enable.", server.label);
|
||||
return;
|
||||
if (this.extension.enablementState === EnablementState.DisabledByExtensionKind) {
|
||||
if (!this.extensionsWorkbenchService.installed.some(e => areSameExtensions(e.identifier, this.extension!.identifier) && e.server !== this.extension!.server)) {
|
||||
const server = this.extensionManagementServerService.localExtensionManagementServer === this.extension.server ? this.extensionManagementServerService.remoteExtensionManagementServer : this.extensionManagementServerService.localExtensionManagementServer;
|
||||
this.class = `${SystemDisabledWarningAction.WARNING_CLASS}`;
|
||||
if (server) {
|
||||
this.tooltip = localize('Install in other server to enable', "Install the extension on '{0}' to enable.", server.label);
|
||||
} else {
|
||||
this.tooltip = localize('disabled because of extension kind', "This extension cannot be enabled in the remote server.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (this.extensionEnablementService.isEnabled(this.extension.local)) {
|
||||
if (this.extensionManagementServerService.localExtensionManagementServer && this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
const runningExtension = this._runningExtensions.filter(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension!.identifier))[0];
|
||||
const runningExtensionServer = runningExtension ? this.extensionManagementServerService.getExtensionManagementServer(runningExtension.extensionLocation) : null;
|
||||
if (this.extension.server === this.extensionManagementServerService.localExtensionManagementServer && runningExtensionServer === this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
this.class = `${SystemDisabledWarningAction.INFO_CLASS}`;
|
||||
this.tooltip = localize('disabled locally', "Extension is enabled on '{0}' and disabled locally.", this.extensionManagementServerService.remoteExtensionManagementServer.label);
|
||||
if (prefersExecuteOnWorkspace(this.extension.local!.manifest, this.productService, this.configurationService)) {
|
||||
this.class = `${SystemDisabledWarningAction.INFO_CLASS}`;
|
||||
this.tooltip = localize('disabled locally', "Extension is enabled on '{0}' and disabled locally.", this.extensionManagementServerService.remoteExtensionManagementServer.label);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (this.extension.server === this.extensionManagementServerService.remoteExtensionManagementServer && runningExtensionServer === this.extensionManagementServerService.localExtensionManagementServer) {
|
||||
this.class = `${SystemDisabledWarningAction.INFO_CLASS}`;
|
||||
this.tooltip = localize('disabled remotely', "Extension is enabled locally and disabled on '{0}'.", this.extensionManagementServerService.remoteExtensionManagementServer.label);
|
||||
if (prefersExecuteOnUI(this.extension.local!.manifest, this.productService, this.configurationService)) {
|
||||
this.class = `${SystemDisabledWarningAction.INFO_CLASS}`;
|
||||
this.tooltip = localize('disabled remotely', "Extension is enabled locally and disabled on '{0}'.", this.extensionManagementServerService.remoteExtensionManagementServer.label);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user