Implement #17068
This commit is contained in:
parent
982abc5f42
commit
b7a44e48cc
10 changed files with 74 additions and 56 deletions
|
@ -25,7 +25,7 @@ import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||||
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||||
import { IExtensionManifest, IKeyBinding, IView, IExtensionTipsService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
import { IExtensionManifest, IKeyBinding, IView, IExtensionTipsService, LocalExtensionType } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||||
import { ResolvedKeybinding, KeyMod, KeyCode } from 'vs/base/common/keyCodes';
|
import { ResolvedKeybinding, KeyMod, KeyCode } from 'vs/base/common/keyCodes';
|
||||||
import { ExtensionsInput } from 'vs/workbench/parts/extensions/common/extensionsInput';
|
import { ExtensionsInput } from 'vs/workbench/parts/extensions/common/extensionsInput';
|
||||||
import { IExtensionsWorkbenchService, IExtensionsViewlet, VIEWLET_ID, IExtension, IExtensionDependencies } from 'vs/workbench/parts/extensions/common/extensions';
|
import { IExtensionsWorkbenchService, IExtensionsViewlet, VIEWLET_ID, IExtension, IExtensionDependencies } from 'vs/workbench/parts/extensions/common/extensions';
|
||||||
|
@ -33,7 +33,7 @@ import { Renderer, DataSource, Controller } from 'vs/workbench/parts/extensions/
|
||||||
import { RatingsWidget, InstallCountWidget } from 'vs/workbench/parts/extensions/browser/extensionsWidgets';
|
import { RatingsWidget, InstallCountWidget } from 'vs/workbench/parts/extensions/browser/extensionsWidgets';
|
||||||
import { EditorOptions } from 'vs/workbench/common/editor';
|
import { EditorOptions } from 'vs/workbench/common/editor';
|
||||||
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
|
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||||
import { CombinedInstallAction, UpdateAction, EnableAction, DisableAction, BuiltinStatusLabelAction, ReloadAction, MaliciousStatusLabelAction } from 'vs/workbench/parts/extensions/browser/extensionsActions';
|
import { CombinedInstallAction, UpdateAction, EnableAction, DisableAction, ReloadAction, MaliciousStatusLabelAction } from 'vs/workbench/parts/extensions/browser/extensionsActions';
|
||||||
import { Webview } from 'vs/workbench/parts/html/browser/webview';
|
import { Webview } from 'vs/workbench/parts/html/browser/webview';
|
||||||
import { KeybindingIO } from 'vs/workbench/services/keybinding/common/keybindingIO';
|
import { KeybindingIO } from 'vs/workbench/services/keybinding/common/keybindingIO';
|
||||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||||
|
@ -156,6 +156,7 @@ export class ExtensionEditor extends BaseEditor {
|
||||||
private name: HTMLElement;
|
private name: HTMLElement;
|
||||||
private identifier: HTMLElement;
|
private identifier: HTMLElement;
|
||||||
private preview: HTMLElement;
|
private preview: HTMLElement;
|
||||||
|
private builtin: HTMLElement;
|
||||||
private license: HTMLElement;
|
private license: HTMLElement;
|
||||||
private publisher: HTMLElement;
|
private publisher: HTMLElement;
|
||||||
private installCount: HTMLElement;
|
private installCount: HTMLElement;
|
||||||
|
@ -220,7 +221,12 @@ export class ExtensionEditor extends BaseEditor {
|
||||||
const title = append(details, $('.title'));
|
const title = append(details, $('.title'));
|
||||||
this.name = append(title, $('span.name.clickable', { title: localize('name', "Extension name") }));
|
this.name = append(title, $('span.name.clickable', { title: localize('name', "Extension name") }));
|
||||||
this.identifier = append(title, $('span.identifier', { title: localize('extension id', "Extension identifier") }));
|
this.identifier = append(title, $('span.identifier', { title: localize('extension id', "Extension identifier") }));
|
||||||
|
|
||||||
this.preview = append(title, $('span.preview', { title: localize('preview', "Preview") }));
|
this.preview = append(title, $('span.preview', { title: localize('preview', "Preview") }));
|
||||||
|
this.preview.textContent = localize('preview', "Preview");
|
||||||
|
|
||||||
|
this.builtin = append(title, $('span.builtin'));
|
||||||
|
this.builtin.textContent = localize('builtin', "Built-in");
|
||||||
|
|
||||||
const subtitle = append(details, $('.subtitle'));
|
const subtitle = append(details, $('.subtitle'));
|
||||||
this.publisher = append(subtitle, $('span.publisher.clickable', { title: localize('publisher', "Publisher name") }));
|
this.publisher = append(subtitle, $('span.publisher.clickable', { title: localize('publisher', "Publisher name") }));
|
||||||
|
@ -283,11 +289,8 @@ export class ExtensionEditor extends BaseEditor {
|
||||||
|
|
||||||
this.name.textContent = extension.displayName;
|
this.name.textContent = extension.displayName;
|
||||||
this.identifier.textContent = extension.id;
|
this.identifier.textContent = extension.id;
|
||||||
if (extension.preview) {
|
this.preview.style.display = extension.preview ? 'inherit' : 'none';
|
||||||
this.preview.textContent = localize('preview', "Preview");
|
this.builtin.style.display = extension.type === LocalExtensionType.System ? 'inherit' : 'none';
|
||||||
} else {
|
|
||||||
this.preview.textContent = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.publisher.textContent = extension.publisherDisplayName;
|
this.publisher.textContent = extension.publisherDisplayName;
|
||||||
this.description.textContent = extension.description;
|
this.description.textContent = extension.description;
|
||||||
|
@ -346,7 +349,6 @@ export class ExtensionEditor extends BaseEditor {
|
||||||
const ratings = this.instantiationService.createInstance(RatingsWidget, this.rating, { extension });
|
const ratings = this.instantiationService.createInstance(RatingsWidget, this.rating, { extension });
|
||||||
this.transientDisposables.push(ratings);
|
this.transientDisposables.push(ratings);
|
||||||
|
|
||||||
const builtinStatusAction = this.instantiationService.createInstance(BuiltinStatusLabelAction);
|
|
||||||
const maliciousStatusAction = this.instantiationService.createInstance(MaliciousStatusLabelAction, true);
|
const maliciousStatusAction = this.instantiationService.createInstance(MaliciousStatusLabelAction, true);
|
||||||
const installAction = this.instantiationService.createInstance(CombinedInstallAction);
|
const installAction = this.instantiationService.createInstance(CombinedInstallAction);
|
||||||
const updateAction = this.instantiationService.createInstance(UpdateAction);
|
const updateAction = this.instantiationService.createInstance(UpdateAction);
|
||||||
|
@ -355,7 +357,6 @@ export class ExtensionEditor extends BaseEditor {
|
||||||
const reloadAction = this.instantiationService.createInstance(ReloadAction);
|
const reloadAction = this.instantiationService.createInstance(ReloadAction);
|
||||||
|
|
||||||
installAction.extension = extension;
|
installAction.extension = extension;
|
||||||
builtinStatusAction.extension = extension;
|
|
||||||
maliciousStatusAction.extension = extension;
|
maliciousStatusAction.extension = extension;
|
||||||
updateAction.extension = extension;
|
updateAction.extension = extension;
|
||||||
enableAction.extension = extension;
|
enableAction.extension = extension;
|
||||||
|
@ -363,8 +364,8 @@ export class ExtensionEditor extends BaseEditor {
|
||||||
reloadAction.extension = extension;
|
reloadAction.extension = extension;
|
||||||
|
|
||||||
this.extensionActionBar.clear();
|
this.extensionActionBar.clear();
|
||||||
this.extensionActionBar.push([reloadAction, updateAction, enableAction, disableAction, installAction, builtinStatusAction, maliciousStatusAction], { icon: true, label: true });
|
this.extensionActionBar.push([reloadAction, updateAction, enableAction, disableAction, installAction, maliciousStatusAction], { icon: true, label: true });
|
||||||
this.transientDisposables.push(enableAction, updateAction, reloadAction, disableAction, installAction, builtinStatusAction, maliciousStatusAction);
|
this.transientDisposables.push(enableAction, updateAction, reloadAction, disableAction, installAction, maliciousStatusAction);
|
||||||
|
|
||||||
this.navbar.clear();
|
this.navbar.clear();
|
||||||
this.navbar.onChange(this.onNavbarChange.bind(this, extension), this, this.transientDisposables);
|
this.navbar.onChange(this.onNavbarChange.bind(this, extension), this, this.transientDisposables);
|
||||||
|
|
|
@ -392,7 +392,7 @@ export class ManageExtensionAction extends Action {
|
||||||
this.class = ManageExtensionAction.HideManageExtensionClass;
|
this.class = ManageExtensionAction.HideManageExtensionClass;
|
||||||
this.tooltip = '';
|
this.tooltip = '';
|
||||||
this.enabled = false;
|
this.enabled = false;
|
||||||
if (this.extension && this.extension.type !== LocalExtensionType.System) {
|
if (this.extension) {
|
||||||
const state = this.extension.state;
|
const state = this.extension.state;
|
||||||
this.enabled = state === ExtensionState.Installed;
|
this.enabled = state === ExtensionState.Installed;
|
||||||
this.class = this.enabled || state === ExtensionState.Uninstalling ? ManageExtensionAction.Class : ManageExtensionAction.HideManageExtensionClass;
|
this.class = this.enabled || state === ExtensionState.Uninstalling ? ManageExtensionAction.Class : ManageExtensionAction.HideManageExtensionClass;
|
||||||
|
@ -573,7 +573,7 @@ export class DisableForWorkspaceAction extends Action implements IExtensionActio
|
||||||
private update(): void {
|
private update(): void {
|
||||||
this.enabled = false;
|
this.enabled = false;
|
||||||
if (this.extension && this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY) {
|
if (this.extension && this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY) {
|
||||||
this.enabled = this.extension.type !== LocalExtensionType.System && (this.extension.enablementState === EnablementState.Enabled || this.extension.enablementState === EnablementState.WorkspaceEnabled) && this.extension.local && this.extensionEnablementService.canChangeEnablement(this.extension.local);
|
this.enabled = (this.extension.enablementState === EnablementState.Enabled || this.extension.enablementState === EnablementState.WorkspaceEnabled) && this.extension.local && this.extensionEnablementService.canChangeEnablement(this.extension.local);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -611,7 +611,7 @@ export class DisableGloballyAction extends Action implements IExtensionAction {
|
||||||
private update(): void {
|
private update(): void {
|
||||||
this.enabled = false;
|
this.enabled = false;
|
||||||
if (this.extension) {
|
if (this.extension) {
|
||||||
this.enabled = this.extension.type !== LocalExtensionType.System && (this.extension.enablementState === EnablementState.Enabled || this.extension.enablementState === EnablementState.WorkspaceEnabled) && this.extension.local && this.extensionEnablementService.canChangeEnablement(this.extension.local);
|
this.enabled = (this.extension.enablementState === EnablementState.Enabled || this.extension.enablementState === EnablementState.WorkspaceEnabled) && this.extension.local && this.extensionEnablementService.canChangeEnablement(this.extension.local);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,7 +665,7 @@ export class DisableAction extends Action {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.enabled = this.extension.state === ExtensionState.Installed && this.extension.type !== LocalExtensionType.System && this._disableActions.some(a => a.enabled);
|
this.enabled = this.extension.state === ExtensionState.Installed && this._disableActions.some(a => a.enabled);
|
||||||
this.class = this.enabled ? DisableAction.EnabledClass : DisableAction.DisabledClass;
|
this.class = this.enabled ? DisableAction.EnabledClass : DisableAction.DisabledClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1004,6 +1004,29 @@ export class ClearExtensionsInputAction extends Action {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class ShowBuiltInExtensionsAction extends Action {
|
||||||
|
|
||||||
|
static readonly ID = 'workbench.extensions.action.listBuiltInExtensions';
|
||||||
|
static LABEL = localize('showBuiltInExtensions', "Show Built-in Extensions");
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
id: string,
|
||||||
|
label: string,
|
||||||
|
@IViewletService private viewletService: IViewletService
|
||||||
|
) {
|
||||||
|
super(id, label, null, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
run(): TPromise<void> {
|
||||||
|
return this.viewletService.openViewlet(VIEWLET_ID, true)
|
||||||
|
.then(viewlet => viewlet as IExtensionsViewlet)
|
||||||
|
.then(viewlet => {
|
||||||
|
viewlet.search('@builtin ');
|
||||||
|
viewlet.focus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class ShowOutdatedExtensionsAction extends Action {
|
export class ShowOutdatedExtensionsAction extends Action {
|
||||||
|
|
||||||
static readonly ID = 'workbench.extensions.action.listOutdatedExtensions';
|
static readonly ID = 'workbench.extensions.action.listOutdatedExtensions';
|
||||||
|
@ -1530,31 +1553,6 @@ export class ConfigureWorkspaceFolderRecommendedExtensionsAction extends Abstrac
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BuiltinStatusLabelAction extends Action {
|
|
||||||
|
|
||||||
private static readonly Class = 'built-in-status';
|
|
||||||
|
|
||||||
private _extension: IExtension;
|
|
||||||
get extension(): IExtension { return this._extension; }
|
|
||||||
set extension(extension: IExtension) { this._extension = extension; this.update(); }
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
super('extensions.install', localize('builtin', "Built-in"), '', false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private update(): void {
|
|
||||||
if (this.extension && this.extension.type === LocalExtensionType.System) {
|
|
||||||
this.class = `${BuiltinStatusLabelAction.Class} system`;
|
|
||||||
} else {
|
|
||||||
this.class = `${BuiltinStatusLabelAction.Class} user`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
run(): TPromise<any> {
|
|
||||||
return TPromise.as(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class MaliciousStatusLabelAction extends Action {
|
export class MaliciousStatusLabelAction extends Action {
|
||||||
|
|
||||||
private static readonly Class = 'malicious-status';
|
private static readonly Class = 'malicious-status';
|
||||||
|
|
|
@ -16,7 +16,7 @@ import { IPagedRenderer } from 'vs/base/browser/ui/list/listPaging';
|
||||||
import { once } from 'vs/base/common/event';
|
import { once } from 'vs/base/common/event';
|
||||||
import { domEvent } from 'vs/base/browser/event';
|
import { domEvent } from 'vs/base/browser/event';
|
||||||
import { IExtension, IExtensionsWorkbenchService } from 'vs/workbench/parts/extensions/common/extensions';
|
import { IExtension, IExtensionsWorkbenchService } from 'vs/workbench/parts/extensions/common/extensions';
|
||||||
import { InstallAction, UpdateAction, BuiltinStatusLabelAction, ManageExtensionAction, ReloadAction, extensionButtonProminentBackground, extensionButtonProminentForeground, MaliciousStatusLabelAction } from 'vs/workbench/parts/extensions/browser/extensionsActions';
|
import { InstallAction, UpdateAction, ManageExtensionAction, ReloadAction, extensionButtonProminentBackground, extensionButtonProminentForeground, MaliciousStatusLabelAction } from 'vs/workbench/parts/extensions/browser/extensionsActions';
|
||||||
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||||
import { Label, RatingsWidget, InstallCountWidget } from 'vs/workbench/parts/extensions/browser/extensionsWidgets';
|
import { Label, RatingsWidget, InstallCountWidget } from 'vs/workbench/parts/extensions/browser/extensionsWidgets';
|
||||||
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
|
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
|
||||||
|
@ -96,15 +96,14 @@ export class Renderer implements IPagedRenderer<IExtension, ITemplateData> {
|
||||||
const installCountWidget = this.instantiationService.createInstance(InstallCountWidget, installCount, { small: true });
|
const installCountWidget = this.instantiationService.createInstance(InstallCountWidget, installCount, { small: true });
|
||||||
const ratingsWidget = this.instantiationService.createInstance(RatingsWidget, ratings, { small: true });
|
const ratingsWidget = this.instantiationService.createInstance(RatingsWidget, ratings, { small: true });
|
||||||
|
|
||||||
const builtinStatusAction = this.instantiationService.createInstance(BuiltinStatusLabelAction);
|
|
||||||
const maliciousStatusAction = this.instantiationService.createInstance(MaliciousStatusLabelAction, false);
|
const maliciousStatusAction = this.instantiationService.createInstance(MaliciousStatusLabelAction, false);
|
||||||
const installAction = this.instantiationService.createInstance(InstallAction);
|
const installAction = this.instantiationService.createInstance(InstallAction);
|
||||||
const updateAction = this.instantiationService.createInstance(UpdateAction);
|
const updateAction = this.instantiationService.createInstance(UpdateAction);
|
||||||
const reloadAction = this.instantiationService.createInstance(ReloadAction);
|
const reloadAction = this.instantiationService.createInstance(ReloadAction);
|
||||||
const manageAction = this.instantiationService.createInstance(ManageExtensionAction);
|
const manageAction = this.instantiationService.createInstance(ManageExtensionAction);
|
||||||
|
|
||||||
actionbar.push([reloadAction, updateAction, installAction, builtinStatusAction, maliciousStatusAction, manageAction], actionOptions);
|
actionbar.push([reloadAction, updateAction, installAction, maliciousStatusAction, manageAction], actionOptions);
|
||||||
const disposables = [versionWidget, installCountWidget, ratingsWidget, builtinStatusAction, maliciousStatusAction, updateAction, reloadAction, manageAction, actionbar, bookmarkStyler];
|
const disposables = [versionWidget, installCountWidget, ratingsWidget, maliciousStatusAction, updateAction, reloadAction, manageAction, actionbar, bookmarkStyler];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
root, element, icon, name, installCount, ratings, author, description, disposables,
|
root, element, icon, name, installCount, ratings, author, description, disposables,
|
||||||
|
@ -113,7 +112,6 @@ export class Renderer implements IPagedRenderer<IExtension, ITemplateData> {
|
||||||
versionWidget.extension = extension;
|
versionWidget.extension = extension;
|
||||||
installCountWidget.extension = extension;
|
installCountWidget.extension = extension;
|
||||||
ratingsWidget.extension = extension;
|
ratingsWidget.extension = extension;
|
||||||
builtinStatusAction.extension = extension;
|
|
||||||
maliciousStatusAction.extension = extension;
|
maliciousStatusAction.extension = extension;
|
||||||
installAction.extension = extension;
|
installAction.extension = extension;
|
||||||
updateAction.extension = extension;
|
updateAction.extension = extension;
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><style>.st0{fill:#f6f6f6;fill-opacity:0}.st1{fill:#fff}.st2{fill:#167abf}</style><path class="st0" d="M1024 1024H0V0h1024v1024z"/><path class="st1" d="M1024 85.333v853.333H0V85.333h1024z"/><path class="st2" d="M0 85.333h298.667v853.333H0V85.333zm1024 0v853.333H384V85.333h640zm-554.667 160h341.333v-64H469.333v64zm341.334 533.334H469.333v64h341.333l.001-64zm128-149.334H597.333v64h341.333l.001-64zm0-149.333H597.333v64h341.333l.001-64zm0-149.333H597.333v64h341.333l.001-64z"/></svg>
|
After Width: | Height: | Size: 559 B |
|
@ -30,12 +30,10 @@
|
||||||
.monaco-action-bar .action-item.disabled .action-label.extension-action.enable,
|
.monaco-action-bar .action-item.disabled .action-label.extension-action.enable,
|
||||||
.monaco-action-bar .action-item.disabled .action-label.extension-action.disable,
|
.monaco-action-bar .action-item.disabled .action-label.extension-action.disable,
|
||||||
.monaco-action-bar .action-item.disabled .action-label.extension-action.reload,
|
.monaco-action-bar .action-item.disabled .action-label.extension-action.reload,
|
||||||
.monaco-action-bar .action-item.disabled .action-label.built-in-status.user,
|
|
||||||
.monaco-action-bar .action-item.disabled .action-label.malicious-status.not-malicious {
|
.monaco-action-bar .action-item.disabled .action-label.malicious-status.not-malicious {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.monaco-action-bar .action-item .action-label.built-in-status
|
|
||||||
.monaco-action-bar .action-item .action-label.malicious-status {
|
.monaco-action-bar .action-item .action-label.malicious-status {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
|
@ -46,7 +44,6 @@
|
||||||
line-height: initial;
|
line-height: initial;
|
||||||
}
|
}
|
||||||
|
|
||||||
.extension-editor>.header>.details>.actions>.monaco-action-bar .action-item .action-label.built-in-status,
|
|
||||||
.extension-editor>.header>.details>.actions>.monaco-action-bar .action-item .action-label.malicious-status {
|
.extension-editor>.header>.details>.actions>.monaco-action-bar .action-item .action-label.malicious-status {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,12 @@
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.extension-editor > .header > .details > .title > .builtin {
|
||||||
|
font-size: 10px;
|
||||||
|
font-style: italic;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.vs .extension-editor > .header > .details > .title > .preview {
|
.vs .extension-editor > .header > .details > .title > .preview {
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
@ -337,4 +343,4 @@
|
||||||
font-size: 90%;
|
font-size: 90%;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
}
|
}
|
|
@ -29,7 +29,7 @@ import { IExtensionsWorkbenchService, IExtensionsViewlet, VIEWLET_ID, ExtensionS
|
||||||
import {
|
import {
|
||||||
ShowEnabledExtensionsAction, ShowInstalledExtensionsAction, ShowRecommendedExtensionsAction, ShowPopularExtensionsAction, ShowDisabledExtensionsAction,
|
ShowEnabledExtensionsAction, ShowInstalledExtensionsAction, ShowRecommendedExtensionsAction, ShowPopularExtensionsAction, ShowDisabledExtensionsAction,
|
||||||
ShowOutdatedExtensionsAction, ClearExtensionsInputAction, ChangeSortAction, UpdateAllAction, CheckForUpdatesAction, DisableAllAction, EnableAllAction,
|
ShowOutdatedExtensionsAction, ClearExtensionsInputAction, ChangeSortAction, UpdateAllAction, CheckForUpdatesAction, DisableAllAction, EnableAllAction,
|
||||||
EnableAutoUpdateAction, DisableAutoUpdateAction
|
EnableAutoUpdateAction, DisableAutoUpdateAction, ShowBuiltInExtensionsAction
|
||||||
} from 'vs/workbench/parts/extensions/browser/extensionsActions';
|
} from 'vs/workbench/parts/extensions/browser/extensionsActions';
|
||||||
import { LocalExtensionType, IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
import { LocalExtensionType, IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||||
import { InstallVSIXAction } from 'vs/workbench/parts/extensions/electron-browser/extensionsActions';
|
import { InstallVSIXAction } from 'vs/workbench/parts/extensions/electron-browser/extensionsActions';
|
||||||
|
@ -298,6 +298,7 @@ export class ExtensionsViewlet extends PersistentViewsViewlet implements IExtens
|
||||||
this.instantiationService.createInstance(ShowOutdatedExtensionsAction, ShowOutdatedExtensionsAction.ID, ShowOutdatedExtensionsAction.LABEL),
|
this.instantiationService.createInstance(ShowOutdatedExtensionsAction, ShowOutdatedExtensionsAction.ID, ShowOutdatedExtensionsAction.LABEL),
|
||||||
this.instantiationService.createInstance(ShowEnabledExtensionsAction, ShowEnabledExtensionsAction.ID, ShowEnabledExtensionsAction.LABEL),
|
this.instantiationService.createInstance(ShowEnabledExtensionsAction, ShowEnabledExtensionsAction.ID, ShowEnabledExtensionsAction.LABEL),
|
||||||
this.instantiationService.createInstance(ShowDisabledExtensionsAction, ShowDisabledExtensionsAction.ID, ShowDisabledExtensionsAction.LABEL),
|
this.instantiationService.createInstance(ShowDisabledExtensionsAction, ShowDisabledExtensionsAction.ID, ShowDisabledExtensionsAction.LABEL),
|
||||||
|
this.instantiationService.createInstance(ShowBuiltInExtensionsAction, ShowBuiltInExtensionsAction.ID, ShowBuiltInExtensionsAction.LABEL),
|
||||||
this.instantiationService.createInstance(ShowRecommendedExtensionsAction, ShowRecommendedExtensionsAction.ID, ShowRecommendedExtensionsAction.LABEL),
|
this.instantiationService.createInstance(ShowRecommendedExtensionsAction, ShowRecommendedExtensionsAction.ID, ShowRecommendedExtensionsAction.LABEL),
|
||||||
this.instantiationService.createInstance(ShowPopularExtensionsAction, ShowPopularExtensionsAction.ID, ShowPopularExtensionsAction.LABEL),
|
this.instantiationService.createInstance(ShowPopularExtensionsAction, ShowPopularExtensionsAction.ID, ShowPopularExtensionsAction.LABEL),
|
||||||
new Separator(),
|
new Separator(),
|
||||||
|
|
|
@ -146,6 +146,18 @@ export class ExtensionsListView extends ViewsViewletPanel {
|
||||||
case 'name': options = assign(options, { sortBy: SortBy.Title }); break;
|
case 'name': options = assign(options, { sortBy: SortBy.Title }); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!value || ExtensionsListView.isBuiltInExtensionsQuery(value)) {
|
||||||
|
// Show installed extensions
|
||||||
|
value = value ? value.replace(/@builtin/g, '').replace(/@sort:(\w+)(-\w*)?/g, '').trim().toLowerCase() : '';
|
||||||
|
|
||||||
|
let result = await this.extensionsWorkbenchService.queryLocal();
|
||||||
|
|
||||||
|
result = result
|
||||||
|
.filter(e => e.type === LocalExtensionType.System && e.name.toLowerCase().indexOf(value) > -1);
|
||||||
|
|
||||||
|
return new PagedModel(this.sortExtensions(result, options));
|
||||||
|
}
|
||||||
|
|
||||||
if (!value || ExtensionsListView.isInstalledExtensionsQuery(value)) {
|
if (!value || ExtensionsListView.isInstalledExtensionsQuery(value)) {
|
||||||
// Show installed extensions
|
// Show installed extensions
|
||||||
value = value ? value.replace(/@installed/g, '').replace(/@sort:(\w+)(-\w*)?/g, '').trim().toLowerCase() : '';
|
value = value ? value.replace(/@installed/g, '').replace(/@sort:(\w+)(-\w*)?/g, '').trim().toLowerCase() : '';
|
||||||
|
@ -470,6 +482,10 @@ export class ExtensionsListView extends ViewsViewletPanel {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static isBuiltInExtensionsQuery(query: string): boolean {
|
||||||
|
return /@builtin/i.test(query);
|
||||||
|
}
|
||||||
|
|
||||||
static isInstalledExtensionsQuery(query: string): boolean {
|
static isInstalledExtensionsQuery(query: string): boolean {
|
||||||
return /@installed/i.test(query);
|
return /@installed/i.test(query);
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,6 +138,9 @@ class Extension implements IExtension {
|
||||||
}
|
}
|
||||||
|
|
||||||
private get defaultIconUrl(): string {
|
private get defaultIconUrl(): string {
|
||||||
|
if (this.type === LocalExtensionType.System) {
|
||||||
|
return require.toUrl('../browser/media/code-icon.svg');
|
||||||
|
}
|
||||||
return require.toUrl('../browser/media/defaultIcon.png');
|
return require.toUrl('../browser/media/defaultIcon.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -588,10 +591,6 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
|
||||||
}
|
}
|
||||||
|
|
||||||
setEnablement(extension: IExtension, enablementState: EnablementState): TPromise<void> {
|
setEnablement(extension: IExtension, enablementState: EnablementState): TPromise<void> {
|
||||||
if (extension.type === LocalExtensionType.System) {
|
|
||||||
return TPromise.wrap<void>(void 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
const enable = enablementState === EnablementState.Enabled || enablementState === EnablementState.WorkspaceEnabled;
|
const enable = enablementState === EnablementState.Enabled || enablementState === EnablementState.WorkspaceEnabled;
|
||||||
return this.promptAndSetEnablement(extension, enablementState, enable).then(reload => {
|
return this.promptAndSetEnablement(extension, enablementState, enable).then(reload => {
|
||||||
/* __GDPR__
|
/* __GDPR__
|
||||||
|
|
|
@ -470,8 +470,9 @@ export class ExtensionService extends Disposable implements IExtensionService {
|
||||||
let userMigratedSystemExtensions: IExtensionIdentifier[] = [{ id: BetterMergeId }];
|
let userMigratedSystemExtensions: IExtensionIdentifier[] = [{ id: BetterMergeId }];
|
||||||
|
|
||||||
system.forEach((systemExtension) => {
|
system.forEach((systemExtension) => {
|
||||||
// Disabling system extensions is not supported
|
if (disabledExtensions.every(disabled => !areSameExtensions(disabled, systemExtension))) {
|
||||||
result[systemExtension.id] = systemExtension;
|
result[systemExtension.id] = systemExtension;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
user.forEach((userExtension) => {
|
user.forEach((userExtension) => {
|
||||||
|
|
Loading…
Reference in a new issue