Bring back Show Update Info command.

This commit is contained in:
Dmitriy Vasyura
2026-04-01 19:15:19 -07:00
parent 34d084cc56
commit 7528eb8f7c
3 changed files with 45 additions and 8 deletions

View File

@@ -9,6 +9,8 @@ import { Registry } from '../../../../platform/registry/common/platform.js';
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from '../../../common/contributions.js';
import { Categories } from '../../../../platform/action/common/actionCommonCategories.js';
import { MenuId, registerAction2, Action2 } from '../../../../platform/actions/common/actions.js';
import { ICommandService } from '../../../../platform/commands/common/commands.js';
import { IQuickInputService } from '../../../../platform/quickinput/common/quickInput.js';
import { ProductContribution, UpdateContribution, CONTEXT_UPDATE_STATE, SwitchProductQualityContribution, showReleaseNotesInEditor, DefaultAccountUpdateContribution } from './update.js';
import { UpdateTitleBarContribution } from './updateTitleBarEntry.js';
import { LifecyclePhase } from '../../../services/lifecycle/common/lifecycle.js';
@@ -241,3 +243,25 @@ if (isWindows) {
registerAction2(DeveloperApplyUpdateAction);
}
registerAction2(class ShowUpdateInfoAction extends Action2 {
constructor() {
super({
id: 'update.showUpdateInfo',
title: localize2('showUpdateInfo', "Show Update Info"),
category: Categories.Developer,
f1: true,
precondition: IsWebContext.negate(),
});
}
async run(accessor: ServicesAccessor): Promise<void> {
const commandService = accessor.get(ICommandService);
const quickInputService = accessor.get(IQuickInputService);
const markdown = await quickInputService.input({ prompt: localize('showUpdateInfo.prompt', "Enter markdown to render (leave empty to load from URL)") });
if (markdown === undefined) {
return; // cancelled
}
await commandService.executeCommand('_update.showUpdateInfo', markdown || undefined);
}
});

View File

@@ -13,7 +13,7 @@ import { isWeb } from '../../../../base/common/platform.js';
import { localize } from '../../../../nls.js';
import { IActionViewItemService } from '../../../../platform/actions/browser/actionViewItemService.js';
import { Action2, MenuId, registerAction2 } from '../../../../platform/actions/common/actions.js';
import { ICommandService } from '../../../../platform/commands/common/commands.js';
import { CommandsRegistry, ICommandService } from '../../../../platform/commands/common/commands.js';
import { IContextKey, IContextKeyService, RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';
import { IHoverService } from '../../../../platform/hover/browser/hover.js';
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
@@ -115,9 +115,20 @@ export class UpdateTitleBarContribution extends Disposable implements IWorkbench
}
));
this._register(CommandsRegistry.registerCommand('_update.showUpdateInfo', (_accessor, markdown?: string) => this.showUpdateInfo(markdown)));
void this.onStateChange(true);
}
private async showUpdateInfo(markdown?: string) {
const rendered = await this.tooltip.renderPostInstall(markdown);
if (rendered) {
this.tooltipVisible = true;
this.context.set(true);
this.entry?.showTooltip(true);
}
}
private async onStateChange(startup = false) {
this.pendingShow.clear();
if (ACTIONABLE_STATES.includes(this.state.type)) {

View File

@@ -382,19 +382,21 @@ export class UpdateTooltip extends Disposable {
this.renderMessage(localize('updateTooltip.restartingPleaseWait', "Restarting to update, please wait..."));
}
public async renderPostInstall(): Promise<boolean> {
public async renderPostInstall(markdown?: string): Promise<boolean> {
this.hideAll();
this.renderTitleAndInfo(localize('updateTooltip.installedDefaultTitle', "New Update Installed"));
this.renderMessage(
localize('updateTooltip.installedDefaultMessage', "See release notes for details on what's new in this release."),
Codicon.info);
let text: string | null = null;
try {
const url = getUpdateInfoUrl(this.productService.version);
const context = await this.requestService.request({ url, callSite: 'updateTooltip' }, CancellationToken.None);
text = await asTextOrError(context);
} catch { }
let text: string | null = markdown ?? null;
if (!text) {
try {
const url = getUpdateInfoUrl(this.productService.version);
const context = await this.requestService.request({ url, callSite: 'updateTooltip' }, CancellationToken.None);
text = await asTextOrError(context);
} catch { }
}
if (!text) {
return false;