Switch "Install" to "Download" for downloaded extensions (#22498)

This commit is contained in:
Charles Gagnon
2023-03-28 15:35:43 -07:00
committed by GitHub
parent 19a9611407
commit 5c6ea2890a
2 changed files with 25 additions and 3 deletions

View File

@@ -92,4 +92,7 @@ export const outputLineHeightDescription = localize('notebook.outputLineHeight',
export const outputFontSizeDescription = localize('notebook.outputFontSize', "Font size for the output text for notebook cells. When set to 0 `#editor.fontSize#` is used. (for VS Code Notebooks only)");
export const outputFontFamilyDescription = localize('notebook.outputFontFamily', "The font family for the output text for notebook cells. When set to empty, the `#editor.fontFamily#` is used. (for VS Code Notebooks only)");
export const experimentalCustomizationDescription = localize('notebook.editorOptions.experimentalCustomization', 'Settings for code editors used in notebooks. This can be used to customize most editor.* settings. (for VS Code Notebooks only)');
export const download = localize('azuredatastudio.download', 'Download');
export const downloadTooltip = localize('azuredatastudio.downloadTooltip', "Download this extension from an external source");
export const installTooltip = localize('azuredatastudio.installTooltip', "Install this extension");
//#endregion

View File

@@ -268,6 +268,7 @@ export abstract class AbstractInstallAction extends ExtensionAction {
if (this.extension.state === ExtensionState.Uninstalled && await this.extensionsWorkbenchService.canInstall(this.extension)) {
this.enabled = this.installPreReleaseVersion ? this.extension.hasPreReleaseVersion : this.extension.hasReleaseVersion;
this.updateLabel();
this.updateTooltip(); // {{SQL CARBON EDIT}} Update tooltip for download extensions
}
}
}
@@ -360,6 +361,8 @@ export abstract class AbstractInstallAction extends ExtensionAction {
return null;
}
protected abstract updateTooltip(): void; // {{SQL CARBON EDIT}} Update tooltip for download extensions
protected updateLabel(): void {
this.label = this.getLabel();
}
@@ -373,7 +376,7 @@ export abstract class AbstractInstallAction extends ExtensionAction {
if (this.extension?.hasPreReleaseVersion) {
return primary ? localize('install', "Install") : localize('install release version', "Install Release Version");
}
return localize('install', "Install");
return this.extension?.downloadPage ? locConstants.download : localize('install', "Install"); // {{SQL CARBON EDIT}} Update label for download extensions
}
protected getInstallOptions(): InstallOptions {
@@ -403,6 +406,13 @@ export class InstallAction extends AbstractInstallAction {
Event.filter(userDataSyncEnablementService.onDidChangeResourceEnablement, e => e[0] === SyncResource.Extensions))(() => this.update()));
}
// {{SQL CARBON EDIT}} Update tooltip for download extensions
protected updateTooltip(): void {
this.tooltip = this.extension?.downloadPage ?
locConstants.downloadTooltip :
locConstants.installTooltip;
}
override getLabel(primary?: boolean): string {
const baseLabel = super.getLabel(primary);
@@ -456,17 +466,26 @@ export class InstallAndSyncAction extends AbstractInstallAction {
@IExtensionService runtimeExtensionService: IExtensionService,
@IWorkbenchThemeService workbenchThemeService: IWorkbenchThemeService,
@ILabelService labelService: ILabelService,
@IProductService productService: IProductService,
@IProductService private readonly productService: IProductService, // {{SQL CARBON EDIT}} Update label for download extensions
@IUserDataSyncEnablementService private readonly userDataSyncEnablementService: IUserDataSyncEnablementService,
@INotificationService readonly localNotificationService: INotificationService // {{SQL CARBON EDIT}}
) {
super('extensions.installAndSync', installPreReleaseVersion, AbstractInstallAction.Class,
extensionsWorkbenchService, instantiationService, runtimeExtensionService, workbenchThemeService, labelService, localNotificationService);
this.tooltip = localize({ key: 'install everywhere tooltip', comment: ['Placeholder is the name of the product. Eg: Azure Data Studio or Azure Data Studio - Insiders'] }, "Install this extension in all your synced {0} instances", productService.nameLong);
// {{SQL CARBON EDIT}} Update tooltip for download extensions - this is done in updateTooltip below
// this.tooltip = localize({ key: 'install everywhere tooltip', comment: ['Placeholder is the name of the product. Eg: Azure Data Studio or Azure Data Studio - Insiders'] }, "Install this extension in all your synced {0} instances", productService.nameLong);
this.updateTooltip();
this._register(Event.any(userDataSyncEnablementService.onDidChangeEnablement,
Event.filter(userDataSyncEnablementService.onDidChangeResourceEnablement, e => e[0] === SyncResource.Extensions))(() => this.update()));
}
// {{SQL CARBON EDIT}} Update tooltip for download extensions
protected updateTooltip(): void {
this.tooltip = this.extension?.downloadPage ?
locConstants.downloadTooltip :
localize({ key: 'install everywhere tooltip', comment: ['Placeholder is the name of the product. Eg: Azure Data Studio or Azure Data Studio - Insiders'] }, "Install this extension in all your synced {0} instances", this.productService.nameLong)
}
protected override async computeAndUpdateEnablement(): Promise<void> {
await super.computeAndUpdateEnablement();
if (this.enabled) {