Skip to content

Commit

Permalink
Fix #138262
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed Dec 2, 2021
1 parent cbab504 commit 60ea8cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 34 deletions.
35 changes: 2 additions & 33 deletions src/vs/workbench/contrib/extensions/browser/extensionEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import { ResolvedKeybinding } from 'vs/base/common/keybindings';
import { ExtensionsInput, IExtensionEditorOptions } from 'vs/workbench/contrib/extensions/common/extensionsInput';
import { IExtensionsWorkbenchService, IExtensionsViewPaneContainer, VIEWLET_ID, IExtension, ExtensionContainers, ExtensionEditorTab, ExtensionState } from 'vs/workbench/contrib/extensions/common/extensions';
import { RatingsWidget, InstallCountWidget, RemoteBadgeWidget, ExtensionHoverWidget } from 'vs/workbench/contrib/extensions/browser/extensionsWidgets';
import { RatingsWidget, InstallCountWidget, RemoteBadgeWidget } from 'vs/workbench/contrib/extensions/browser/extensionsWidgets';
import { IEditorOpenContext } from 'vs/workbench/common/editor';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import {
Expand Down Expand Up @@ -68,7 +68,7 @@ import { Delegate } from 'vs/workbench/contrib/extensions/browser/extensionsList
import { renderMarkdown } from 'vs/base/browser/markdownRenderer';
import { attachKeybindingLabelStyler } from 'vs/platform/theme/common/styler';
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
import { errorIcon, infoIcon, preReleaseIcon, starEmptyIcon, verifiedPublisherIcon as verifiedPublisherThemeIcon, warningIcon } from 'vs/workbench/contrib/extensions/browser/extensionsIcons';
import { errorIcon, infoIcon, starEmptyIcon, verifiedPublisherIcon as verifiedPublisherThemeIcon, warningIcon } from 'vs/workbench/contrib/extensions/browser/extensionsIcons';
import { MarkdownString } from 'vs/base/common/htmlContent';
import { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/browser/panecomposite';
import { ViewContainerLocation } from 'vs/workbench/common/views';
Expand Down Expand Up @@ -151,7 +151,6 @@ interface IExtensionEditorTemplate {
actionsAndStatusContainer: HTMLElement;
extensionActionBar: ActionBar;
status: HTMLElement;
preReleaseText: HTMLElement;
recommendation: HTMLElement;
navbar: NavBar;
content: HTMLElement;
Expand Down Expand Up @@ -303,7 +302,6 @@ export class ExtensionEditor extends EditorPane {
}));

const status = append(actionsAndStatusContainer, $('.status'));
const preReleaseText = append(details, $('.pre-release-text'));
const recommendation = append(details, $('.recommendation'));

this._register(Event.chain(extensionActionBar.onDidRun)
Expand Down Expand Up @@ -336,7 +334,6 @@ export class ExtensionEditor extends EditorPane {
rating,
actionsAndStatusContainer,
extensionActionBar,
preReleaseText,
status,
recommendation
};
Expand Down Expand Up @@ -526,7 +523,6 @@ export class ExtensionEditor extends EditorPane {
this.transientDisposables.add(disposable);
}

this.setPreReleaseText(extension, template);
this.setStatus(extension, extensionStatus, template);
this.setRecommendationText(extension, template);

Expand Down Expand Up @@ -575,33 +571,6 @@ export class ExtensionEditor extends EditorPane {
this.editorLoadComplete = true;
}

private setPreReleaseText(extension: IExtension, template: IExtensionEditorTemplate): void {
let preReleaseText: string | undefined;
reset(template.preReleaseText);
const disposables = this.transientDisposables.add(new DisposableStore());
const updatePreReleaseText = (layout: boolean) => {
const newPreReleaseText = ExtensionHoverWidget.getPreReleaseMessage(extension);
if (preReleaseText !== newPreReleaseText) {
preReleaseText = newPreReleaseText;
disposables.clear();
reset(template.preReleaseText);
if (preReleaseText) {
append(template.preReleaseText, $(`span${ThemeIcon.asCSSSelector(preReleaseIcon)}`));
disposables.add(this.renderMarkdownText(preReleaseText, template.preReleaseText));
}
if (layout && this.dimension) {
this.layout(this.dimension);
}
}
};
updatePreReleaseText(false);
this.transientDisposables.add(this.extensionsWorkbenchService.onChange(e => {
if (e && areSameExtensions(e.identifier, extension.identifier)) {
updatePreReleaseText(true);
}
}));
}

private setStatus(extension: IExtension, extensionStatus: ExtensionStatusAction, template: IExtensionEditorTemplate): void {
const disposables = new DisposableStore();
this.transientDisposables.add(disposables);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,8 @@ export class ExtensionHoverWidget extends ExtensionWidget {
if (extension.local?.isPreReleaseVersion || extension.gallery?.properties.isPreReleaseVersion) {
return undefined;
}
return localize('has prerelease', "This extension has a Pre-Release version available");
const preReleaseVersionLink = `[${localize('Show prerelease version', "Pre-Release version")}](${URI.parse(`command:workbench.extensions.action.showPreReleaseVersion?${encodeURIComponent(JSON.stringify([extension.identifier.id]))}`)})`;
return localize('has prerelease', "This extension has a {0} available", preReleaseVersionLink);
}

}
Expand Down

0 comments on commit 60ea8cb

Please sign in to comment.