Path: blob/main/src/vs/workbench/contrib/extensions/common/extensionsInput.ts
3296 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { Schemas } from '../../../../base/common/network.js';6import { URI } from '../../../../base/common/uri.js';7import { localize } from '../../../../nls.js';8import { EditorInputCapabilities, IUntypedEditorInput } from '../../../common/editor.js';9import { EditorInput } from '../../../common/editor/editorInput.js';10import { ExtensionEditorTab, IExtension } from './extensions.js';11import { areSameExtensions } from '../../../../platform/extensionManagement/common/extensionManagementUtil.js';12import { join } from '../../../../base/common/path.js';13import { IEditorOptions } from '../../../../platform/editor/common/editor.js';14import { ThemeIcon } from '../../../../base/common/themables.js';15import { Codicon } from '../../../../base/common/codicons.js';16import { registerIcon } from '../../../../platform/theme/common/iconRegistry.js';1718const ExtensionEditorIcon = registerIcon('extensions-editor-label-icon', Codicon.extensions, localize('extensionsEditorLabelIcon', 'Icon of the extensions editor label.'));1920export interface IExtensionEditorOptions extends IEditorOptions {21showPreReleaseVersion?: boolean;22tab?: ExtensionEditorTab;23feature?: string;24sideByside?: boolean;25}2627export class ExtensionsInput extends EditorInput {2829static readonly ID = 'workbench.extensions.input2';3031override get typeId(): string {32return ExtensionsInput.ID;33}3435override get capabilities(): EditorInputCapabilities {36return EditorInputCapabilities.Readonly | EditorInputCapabilities.Singleton;37}3839override get resource() {40return URI.from({41scheme: Schemas.extension,42path: join(this._extension.identifier.id, 'extension')43});44}4546constructor(private _extension: IExtension) {47super();48}4950get extension(): IExtension { return this._extension; }5152override getName(): string {53return localize('extensionsInputName', "Extension: {0}", this._extension.displayName);54}5556override getIcon(): ThemeIcon | undefined {57return ExtensionEditorIcon;58}5960override matches(other: EditorInput | IUntypedEditorInput): boolean {61if (super.matches(other)) {62return true;63}6465return other instanceof ExtensionsInput && areSameExtensions(this._extension.identifier, other._extension.identifier);66}67}686970