Merge from vscode 2f984aad710215f4e4684a035bb02f55d1a9e2cc (#9819)

This commit is contained in:
Anthony Dresser
2020-04-01 00:44:39 -07:00
committed by GitHub
parent 0e27aaa61f
commit 0bfbdc62ed
247 changed files with 5402 additions and 3311 deletions

View File

@@ -29,7 +29,7 @@ import { IHostService } from 'vs/workbench/services/host/browser/host';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { URI } from 'vs/base/common/uri';
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { registerThemingParticipant, IColorTheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService';
import { buttonBackground, buttonForeground, buttonHoverBackground, contrastBorder, registerColor, foreground } from 'vs/platform/theme/common/colorRegistry';
import { Color } from 'vs/base/common/color';
@@ -52,7 +52,7 @@ import { CancellationToken } from 'vs/base/common/cancellation';
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
import { alert } from 'vs/base/browser/ui/aria/aria';
import { coalesce } from 'vs/base/common/arrays';
import { IWorkbenchThemeService, ThemeSettings, IWorkbenchFileIconTheme, IWorkbenchColorTheme } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IWorkbenchThemeService, IWorkbenchTheme, IWorkbenchColorTheme, IWorkbenchFileIconTheme, IWorkbenchProductIconTheme } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { ILabelService } from 'vs/platform/label/common/label';
import { prefersExecuteOnUI, prefersExecuteOnWorkspace } from 'vs/workbench/services/extensions/common/extensionsUtil';
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
@@ -142,6 +142,10 @@ function getRelativeDateLabel(date: Date): string {
}
export abstract class ExtensionAction extends Action implements IExtensionContainer {
static readonly EXTENSION_ACTION_CLASS = 'extension-action';
static readonly TEXT_ACTION_CLASS = `${ExtensionAction.EXTENSION_ACTION_CLASS} text`;
static readonly LABEL_ACTION_CLASS = `${ExtensionAction.EXTENSION_ACTION_CLASS} label`;
static readonly ICON_ACTION_CLASS = `${ExtensionAction.EXTENSION_ACTION_CLASS} icon`;
private _extension: IExtension | null = null;
get extension(): IExtension | null { return this._extension; }
set extension(extension: IExtension | null) { this._extension = extension; this.update(); }
@@ -153,9 +157,8 @@ export class InstallAction extends ExtensionAction {
private static readonly INSTALL_LABEL = localize('install', "Install");
private static readonly INSTALLING_LABEL = localize('installing', "Installing");
private static readonly Class = 'extension-action prominent install';
private static readonly InstallingClass = 'extension-action install installing';
private static readonly Class = `${ExtensionAction.LABEL_ACTION_CLASS} prominent install`;
private static readonly InstallingClass = `${ExtensionAction.LABEL_ACTION_CLASS} install installing`;
private _manifest: IExtensionManifest | null = null;
set manifest(manifest: IExtensionManifest) {
@@ -239,17 +242,15 @@ export class InstallAction extends ExtensionAction {
if (extension && extension.local) {
const runningExtension = await this.getRunningExtension(extension.local);
if (runningExtension) {
const colorThemes = await this.workbenchThemeService.getColorThemes();
const fileIconThemes = await this.workbenchThemeService.getFileIconThemes();
if (SetColorThemeAction.getColorThemes(colorThemes, this.extension).length) {
const action = this.instantiationService.createInstance(SetColorThemeAction, colorThemes);
action.extension = extension;
return action.run({ showCurrentTheme: true, ignoreFocusLost: true });
}
if (SetFileIconThemeAction.getFileIconThemes(fileIconThemes, this.extension).length) {
const action = this.instantiationService.createInstance(SetFileIconThemeAction, fileIconThemes);
action.extension = extension;
return action.run({ showCurrentTheme: true, ignoreFocusLost: true });
let action = await SetColorThemeAction.create(this.workbenchThemeService, this.instantiationService, extension)
|| await SetFileIconThemeAction.create(this.workbenchThemeService, this.instantiationService, extension)
|| await SetProductIconThemeAction.create(this.workbenchThemeService, this.instantiationService, extension);
if (action) {
try {
return action.run({ showCurrentTheme: true, ignoreFocusLost: true });
} finally {
action.dispose();
}
}
}
}
@@ -301,8 +302,8 @@ export abstract class InstallInOtherServerAction extends ExtensionAction {
protected static readonly INSTALL_LABEL = localize('install', "Install");
protected static readonly INSTALLING_LABEL = localize('installing', "Installing");
private static readonly Class = 'extension-action prominent install';
private static readonly InstallingClass = 'extension-action install installing';
private static readonly Class = `${ExtensionAction.LABEL_ACTION_CLASS} prominent install`;
private static readonly InstallingClass = `${ExtensionAction.LABEL_ACTION_CLASS} install installing`;
updateWhenCounterExtensionChanges: boolean = true;
@@ -394,8 +395,8 @@ export class UninstallAction extends ExtensionAction {
private static readonly UninstallLabel = localize('uninstallAction', "Uninstall");
private static readonly UninstallingLabel = localize('Uninstalling', "Uninstalling");
private static readonly UninstallClass = 'extension-action uninstall';
private static readonly UnInstallingClass = 'extension-action uninstall uninstalling';
private static readonly UninstallClass = `${ExtensionAction.LABEL_ACTION_CLASS} uninstall`;
private static readonly UnInstallingClass = `${ExtensionAction.LABEL_ACTION_CLASS} uninstall uninstalling`;
constructor(
@IExtensionsWorkbenchService private extensionsWorkbenchService: IExtensionsWorkbenchService
@@ -450,7 +451,7 @@ export class UninstallAction extends ExtensionAction {
export class CombinedInstallAction extends ExtensionAction {
private static readonly NoExtensionClass = 'extension-action prominent install no-extension';
private static readonly NoExtensionClass = `${ExtensionAction.LABEL_ACTION_CLASS} prominent install no-extension`;
private installAction: InstallAction;
private uninstallAction: UninstallAction;
@@ -517,7 +518,7 @@ export class CombinedInstallAction extends ExtensionAction {
export class UpdateAction extends ExtensionAction {
private static readonly EnabledClass = 'extension-action prominent update';
private static readonly EnabledClass = `${ExtensionAction.LABEL_ACTION_CLASS} prominent update`;
private static readonly DisabledClass = `${UpdateAction.EnabledClass} disabled`;
constructor(
@@ -701,7 +702,8 @@ export function getContextMenuActions(menuService: IMenuService, contextKeyServi
export class ManageExtensionAction extends ExtensionDropDownAction {
static readonly ID = 'extensions.manage';
private static readonly Class = 'extension-action manage codicon-gear';
private static readonly Class = `${ExtensionAction.ICON_ACTION_CLASS} manage codicon-gear`;
private static readonly HideManageExtensionClass = `${ManageExtensionAction.Class} hide`;
constructor(
@@ -719,19 +721,22 @@ export class ManageExtensionAction extends ExtensionDropDownAction {
this.update();
}
getActionGroups(runningExtensions: IExtensionDescription[], colorThemes: IWorkbenchColorTheme[], fileIconThemes: IWorkbenchFileIconTheme[]): IAction[][] {
async getActionGroups(runningExtensions: IExtensionDescription[]): Promise<IAction[][]> {
const groups: ExtensionAction[][] = [];
if (this.extension) {
const extensionColorThemes = SetColorThemeAction.getColorThemes(colorThemes, this.extension);
const extensionFileIconThemes = SetFileIconThemeAction.getFileIconThemes(fileIconThemes, this.extension);
if (extensionColorThemes.length || extensionFileIconThemes.length) {
const themesGroup: ExtensionAction[] = [];
if (extensionColorThemes.length) {
themesGroup.push(this.instantiationService.createInstance(SetColorThemeAction, colorThemes));
}
if (extensionFileIconThemes.length) {
themesGroup.push(this.instantiationService.createInstance(SetFileIconThemeAction, fileIconThemes));
const actions = await Promise.all([
SetColorThemeAction.create(this.workbenchThemeService, this.instantiationService, this.extension),
SetFileIconThemeAction.create(this.workbenchThemeService, this.instantiationService, this.extension),
SetProductIconThemeAction.create(this.workbenchThemeService, this.instantiationService, this.extension)
]);
const themesGroup: ExtensionAction[] = [];
for (let action of actions) {
if (action) {
themesGroup.push(action);
}
}
if (themesGroup.length) {
groups.push(themesGroup);
}
}
@@ -755,9 +760,7 @@ export class ManageExtensionAction extends ExtensionDropDownAction {
async run(): Promise<any> {
const runtimeExtensions = await this.extensionService.getExtensions();
const colorThemes = await this.workbenchThemeService.getColorThemes();
const fileIconThemes = await this.workbenchThemeService.getFileIconThemes();
return super.run({ actionGroups: this.getActionGroups(runtimeExtensions, colorThemes, fileIconThemes), disposeActionsOnHide: true });
return super.run({ actionGroups: await this.getActionGroups(runtimeExtensions), disposeActionsOnHide: true });
}
update(): void {
@@ -972,8 +975,8 @@ export class DisableGloballyAction extends ExtensionAction {
export abstract class ExtensionEditorDropDownAction extends ExtensionDropDownAction {
private static readonly EnabledClass = 'extension-action extension-editor-dropdown-action';
private static readonly EnabledDropDownClass = 'extension-action extension-editor-dropdown-action dropdown enable';
private static readonly EnabledClass = `${ExtensionAction.LABEL_ACTION_CLASS} extension-editor-dropdown-action`;
private static readonly EnabledDropDownClass = `${ExtensionEditorDropDownAction.EnabledClass} dropdown enable`;
private static readonly DisabledClass = `${ExtensionEditorDropDownAction.EnabledClass} disabled`;
constructor(
@@ -1181,7 +1184,7 @@ export class UpdateAllAction extends Action {
export class ReloadAction extends ExtensionAction {
private static readonly EnabledClass = 'extension-action reload';
private static readonly EnabledClass = `${ExtensionAction.LABEL_ACTION_CLASS} reload`;
private static readonly DisabledClass = `${ReloadAction.EnabledClass} disabled`;
updateWhenCounterExtensionChanges: boolean = true;
@@ -1318,22 +1321,45 @@ export class ReloadAction extends ExtensionAction {
}
}
function isThemeFromExtension(theme: IWorkbenchTheme, extension: IExtension | undefined | null): boolean {
return !!(extension && theme.extensionData && ExtensionIdentifier.equals(theme.extensionData.extensionId, extension.identifier.id));
}
function getQuickPickEntries(themes: IWorkbenchTheme[], currentTheme: IWorkbenchTheme, extension: IExtension | null | undefined, showCurrentTheme: boolean): (IQuickPickItem | IQuickPickSeparator)[] {
const picks: (IQuickPickItem | IQuickPickSeparator)[] = [];
for (const theme of themes) {
if (isThemeFromExtension(theme, extension) && !(showCurrentTheme && theme === currentTheme)) {
picks.push({ label: theme.label, id: theme.id });
}
}
if (showCurrentTheme) {
picks.push(<IQuickPickSeparator>{ type: 'separator', label: localize('current', "Current") });
picks.push(<IQuickPickItem>{ label: currentTheme.label, id: currentTheme.id });
}
return picks;
}
export class SetColorThemeAction extends ExtensionAction {
static getColorThemes(colorThemes: IWorkbenchColorTheme[], extension: IExtension): IWorkbenchColorTheme[] {
return colorThemes.filter(c => c.extensionData && ExtensionIdentifier.equals(c.extensionData.extensionId, extension.identifier.id));
}
private static readonly EnabledClass = 'extension-action theme';
private static readonly EnabledClass = `${ExtensionAction.LABEL_ACTION_CLASS} theme`;
private static readonly DisabledClass = `${SetColorThemeAction.EnabledClass} disabled`;
static async create(workbenchThemeService: IWorkbenchThemeService, instantiationService: IInstantiationService, extension: IExtension): Promise<SetColorThemeAction | undefined> {
const themes = await workbenchThemeService.getColorThemes();
if (themes.some(th => isThemeFromExtension(th, extension))) {
const action = instantiationService.createInstance(SetColorThemeAction, themes);
action.extension = extension;
return action;
}
return undefined;
}
constructor(
private readonly colorThemes: IWorkbenchColorTheme[],
private colorThemes: IWorkbenchColorTheme[],
@IExtensionService extensionService: IExtensionService,
@IWorkbenchThemeService private readonly workbenchThemeService: IWorkbenchThemeService,
@IQuickInputService private readonly quickInputService: IQuickInputService,
@IConfigurationService private readonly configurationService: IConfigurationService
) {
super(`extensions.colorTheme`, localize('color theme', "Set Color Theme"), SetColorThemeAction.DisabledClass, false);
this._register(Event.any<any>(extensionService.onDidChangeExtensions, workbenchThemeService.onDidColorThemeChange)(() => this.update(), this));
@@ -1341,36 +1367,21 @@ export class SetColorThemeAction extends ExtensionAction {
}
update(): void {
this.enabled = false;
if (this.extension) {
const isInstalled = this.extension.state === ExtensionState.Installed;
if (isInstalled) {
const extensionThemes = SetColorThemeAction.getColorThemes(this.colorThemes, this.extension);
this.enabled = extensionThemes.length > 0;
}
}
this.enabled = !!this.extension && (this.extension.state === ExtensionState.Installed) && this.colorThemes.some(th => isThemeFromExtension(th, this.extension));
this.class = this.enabled ? SetColorThemeAction.EnabledClass : SetColorThemeAction.DisabledClass;
}
async run({ showCurrentTheme, ignoreFocusLost }: { showCurrentTheme: boolean, ignoreFocusLost: boolean } = { showCurrentTheme: false, ignoreFocusLost: false }): Promise<any> {
this.colorThemes = await this.workbenchThemeService.getColorThemes();
this.update();
if (!this.enabled) {
return;
}
let extensionThemes = SetColorThemeAction.getColorThemes(this.colorThemes, this.extension!);
const currentTheme = this.colorThemes.filter(t => t.settingsId === this.configurationService.getValue(ThemeSettings.COLOR_THEME))[0] || this.workbenchThemeService.getColorTheme();
showCurrentTheme = showCurrentTheme || extensionThemes.some(t => t.id === currentTheme.id);
if (showCurrentTheme) {
extensionThemes = extensionThemes.filter(t => t.id !== currentTheme.id);
}
const currentTheme = this.workbenchThemeService.getColorTheme();
const delayer = new Delayer<any>(100);
const picks: (IQuickPickItem | IQuickPickSeparator)[] = [];
picks.push(...extensionThemes.map(theme => (<IQuickPickItem>{ label: theme.label, id: theme.id })));
if (showCurrentTheme) {
picks.push(<IQuickPickSeparator>{ type: 'separator', label: localize('current', "Current") });
picks.push(<IQuickPickItem>{ label: currentTheme.label, id: currentTheme.id });
}
const picks = getQuickPickEntries(this.colorThemes, currentTheme, this.extension, showCurrentTheme);
const pickedTheme = await this.quickInputService.pick(
picks,
{
@@ -1378,28 +1389,30 @@ export class SetColorThemeAction extends ExtensionAction {
onDidFocus: item => delayer.trigger(() => this.workbenchThemeService.setColorTheme(item.id, undefined)),
ignoreFocusLost
});
let confValue = this.configurationService.inspect(ThemeSettings.COLOR_THEME);
const target = typeof confValue.workspaceValue !== 'undefined' ? ConfigurationTarget.WORKSPACE : ConfigurationTarget.USER;
return this.workbenchThemeService.setColorTheme(pickedTheme ? pickedTheme.id : currentTheme.id, target);
return this.workbenchThemeService.setColorTheme(pickedTheme ? pickedTheme.id : currentTheme.id, 'auto');
}
}
export class SetFileIconThemeAction extends ExtensionAction {
private static readonly EnabledClass = 'extension-action theme';
private static readonly EnabledClass = `${ExtensionAction.LABEL_ACTION_CLASS} theme`;
private static readonly DisabledClass = `${SetFileIconThemeAction.EnabledClass} disabled`;
static getFileIconThemes(fileIconThemes: IWorkbenchFileIconTheme[], extension: IExtension): IWorkbenchFileIconTheme[] {
return fileIconThemes.filter(c => c.extensionData && ExtensionIdentifier.equals(c.extensionData.extensionId, extension.identifier.id));
static async create(workbenchThemeService: IWorkbenchThemeService, instantiationService: IInstantiationService, extension: IExtension): Promise<SetFileIconThemeAction | undefined> {
const themes = await workbenchThemeService.getFileIconThemes();
if (themes.some(th => isThemeFromExtension(th, extension))) {
const action = instantiationService.createInstance(SetFileIconThemeAction, themes);
action.extension = extension;
return action;
}
return undefined;
}
constructor(
private readonly fileIconThemes: IWorkbenchFileIconTheme[],
private fileIconThemes: IWorkbenchFileIconTheme[],
@IExtensionService extensionService: IExtensionService,
@IWorkbenchThemeService private readonly workbenchThemeService: IWorkbenchThemeService,
@IQuickInputService private readonly quickInputService: IQuickInputService,
@IConfigurationService private readonly configurationService: IConfigurationService
@IQuickInputService private readonly quickInputService: IQuickInputService
) {
super(`extensions.fileIconTheme`, localize('file icon theme', "Set File Icon Theme"), SetFileIconThemeAction.DisabledClass, false);
this._register(Event.any<any>(extensionService.onDidChangeExtensions, workbenchThemeService.onDidFileIconThemeChange)(() => this.update(), this));
@@ -1407,36 +1420,20 @@ export class SetFileIconThemeAction extends ExtensionAction {
}
update(): void {
this.enabled = false;
if (this.extension) {
const isInstalled = this.extension.state === ExtensionState.Installed;
if (isInstalled) {
const extensionThemes = SetFileIconThemeAction.getFileIconThemes(this.fileIconThemes, this.extension);
this.enabled = extensionThemes.length > 0;
}
}
this.enabled = !!this.extension && (this.extension.state === ExtensionState.Installed) && this.fileIconThemes.some(th => isThemeFromExtension(th, this.extension));
this.class = this.enabled ? SetFileIconThemeAction.EnabledClass : SetFileIconThemeAction.DisabledClass;
}
async run({ showCurrentTheme, ignoreFocusLost }: { showCurrentTheme: boolean, ignoreFocusLost: boolean } = { showCurrentTheme: false, ignoreFocusLost: false }): Promise<any> {
await this.update();
this.fileIconThemes = await this.workbenchThemeService.getFileIconThemes();
this.update();
if (!this.enabled) {
return;
}
let extensionThemes = SetFileIconThemeAction.getFileIconThemes(this.fileIconThemes, this.extension!);
const currentTheme = this.fileIconThemes.filter(t => t.settingsId === this.configurationService.getValue(ThemeSettings.ICON_THEME))[0] || this.workbenchThemeService.getFileIconTheme();
showCurrentTheme = showCurrentTheme || extensionThemes.some(t => t.id === currentTheme.id);
if (showCurrentTheme) {
extensionThemes = extensionThemes.filter(t => t.id !== currentTheme.id);
}
const currentTheme = this.workbenchThemeService.getFileIconTheme();
const delayer = new Delayer<any>(100);
const picks: (IQuickPickItem | IQuickPickSeparator)[] = [];
picks.push(...extensionThemes.map(theme => (<IQuickPickItem>{ label: theme.label, id: theme.id })));
if (showCurrentTheme && currentTheme.label) {
picks.push(<IQuickPickSeparator>{ type: 'separator', label: localize('current', "Current") });
picks.push(<IQuickPickItem>{ label: currentTheme.label, id: currentTheme.id });
}
const picks = getQuickPickEntries(this.fileIconThemes, currentTheme, this.extension, showCurrentTheme);
const pickedTheme = await this.quickInputService.pick(
picks,
{
@@ -1444,9 +1441,62 @@ export class SetFileIconThemeAction extends ExtensionAction {
onDidFocus: item => delayer.trigger(() => this.workbenchThemeService.setFileIconTheme(item.id, undefined)),
ignoreFocusLost
});
let confValue = this.configurationService.inspect(ThemeSettings.ICON_THEME);
const target = typeof confValue.workspaceValue !== 'undefined' ? ConfigurationTarget.WORKSPACE : ConfigurationTarget.USER;
return this.workbenchThemeService.setFileIconTheme(pickedTheme ? pickedTheme.id : currentTheme.id, target);
return this.workbenchThemeService.setFileIconTheme(pickedTheme ? pickedTheme.id : currentTheme.id, 'auto');
}
}
export class SetProductIconThemeAction extends ExtensionAction {
private static readonly EnabledClass = `${ExtensionAction.LABEL_ACTION_CLASS} theme`;
private static readonly DisabledClass = `${SetProductIconThemeAction.EnabledClass} disabled`;
static async create(workbenchThemeService: IWorkbenchThemeService, instantiationService: IInstantiationService, extension: IExtension): Promise<SetProductIconThemeAction | undefined> {
const themes = await workbenchThemeService.getProductIconThemes();
if (themes.some(th => isThemeFromExtension(th, extension))) {
const action = instantiationService.createInstance(SetProductIconThemeAction, themes);
action.extension = extension;
return action;
}
return undefined;
}
constructor(
private productIconThemes: IWorkbenchProductIconTheme[],
@IExtensionService extensionService: IExtensionService,
@IWorkbenchThemeService private readonly workbenchThemeService: IWorkbenchThemeService,
@IQuickInputService private readonly quickInputService: IQuickInputService
) {
super(`extensions.productIconTheme`, localize('product icon theme', "Set Product Icon Theme"), SetProductIconThemeAction.DisabledClass, false);
this._register(Event.any<any>(extensionService.onDidChangeExtensions, workbenchThemeService.onDidProductIconThemeChange)(() => this.update(), this));
this.enabled = true; // enabled by default
this.class = SetProductIconThemeAction.EnabledClass;
// this.update();
}
update(): void {
this.enabled = !!this.extension && (this.extension.state === ExtensionState.Installed) && this.productIconThemes.some(th => isThemeFromExtension(th, this.extension));
this.class = this.enabled ? SetProductIconThemeAction.EnabledClass : SetProductIconThemeAction.DisabledClass;
}
async run({ showCurrentTheme, ignoreFocusLost }: { showCurrentTheme: boolean, ignoreFocusLost: boolean } = { showCurrentTheme: false, ignoreFocusLost: false }): Promise<any> {
this.productIconThemes = await this.workbenchThemeService.getProductIconThemes();
this.update();
if (!this.enabled) {
return;
}
const currentTheme = this.workbenchThemeService.getProductIconTheme();
const delayer = new Delayer<any>(100);
const picks = getQuickPickEntries(this.productIconThemes, currentTheme, this.extension, showCurrentTheme);
const pickedTheme = await this.quickInputService.pick(
picks,
{
placeHolder: localize('select product icon theme', "Select Product Icon Theme"),
onDidFocus: item => delayer.trigger(() => this.workbenchThemeService.setProductIconTheme(item.id, undefined)),
ignoreFocusLost
});
return this.workbenchThemeService.setProductIconTheme(pickedTheme ? pickedTheme.id : currentTheme.id, 'auto');
}
}
@@ -1811,7 +1861,6 @@ export class UndoIgnoreExtensionRecommendationAction extends Action {
}
}
export class ShowRecommendedKeymapExtensionsAction extends Action {
static readonly ID = 'workbench.extensions.action.showRecommendedKeymapExtensions';
@@ -2205,7 +2254,6 @@ export class ConfigureWorkspaceRecommendedExtensionsAction extends AbstractConfi
static readonly ID = 'workbench.extensions.action.configureWorkspaceRecommendedExtensions';
static readonly LABEL = localize('configureWorkspaceRecommendedExtensions', "Configure Recommended Extensions (Workspace)");
constructor(
id: string,
label: string,
@@ -2241,7 +2289,6 @@ export class ConfigureWorkspaceFolderRecommendedExtensionsAction extends Abstrac
static readonly ID = 'workbench.extensions.action.configureWorkspaceFolderRecommendedExtensions';
static readonly LABEL = localize('configureWorkspaceFolderRecommendedExtensions', "Configure Recommended Extensions (Workspace Folder)");
constructor(
id: string,
label: string,
@@ -2432,7 +2479,7 @@ export class AddToWorkspaceRecommendationsAction extends AbstractConfigureRecomm
export class StatusLabelAction extends Action implements IExtensionContainer {
private static readonly ENABLED_CLASS = 'extension-status-label';
private static readonly ENABLED_CLASS = `${ExtensionAction.TEXT_ACTION_CLASS} extension-status-label`;
private static readonly DISABLED_CLASS = `${StatusLabelAction.ENABLED_CLASS} hide`;
private initialStatus: ExtensionState | null = null;
@@ -2534,7 +2581,7 @@ export class StatusLabelAction extends Action implements IExtensionContainer {
export class MaliciousStatusLabelAction extends ExtensionAction {
private static readonly Class = 'malicious-status';
private static readonly Class = `${ExtensionAction.TEXT_ACTION_CLASS} malicious-status`;
constructor(long: boolean) {
const tooltip = localize('malicious tooltip', "This extension was reported to be problematic.");
@@ -2556,9 +2603,38 @@ export class MaliciousStatusLabelAction extends ExtensionAction {
}
}
export class SyncIgnoredIconAction extends ExtensionAction {
private static readonly ENABLE_CLASS = `${ExtensionAction.ICON_ACTION_CLASS} codicon-eye-closed`;
private static readonly DISABLE_CLASS = `${SyncIgnoredIconAction.ENABLE_CLASS} hide`;
constructor(
@IConfigurationService private readonly configurationService: IConfigurationService
) {
super('extensions.syncignore', '', SyncIgnoredIconAction.DISABLE_CLASS, false);
this._register(Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectedKeys.includes('sync.ignoredExtensions'))(() => this.update()));
this.update();
this.tooltip = localize('syncingore.label', "This extension is ignored during sync.");
}
update(): void {
this.class = SyncIgnoredIconAction.DISABLE_CLASS;
if (this.extension) {
const ignoredExtensions = this.configurationService.getValue<string[]>('sync.ignoredExtensions') || [];
if (ignoredExtensions.some(id => areSameExtensions({ id }, this.extension!.identifier))) {
this.class = SyncIgnoredIconAction.ENABLE_CLASS;
}
}
}
run(): Promise<any> {
return Promise.resolve();
}
}
export class ExtensionToolTipAction extends ExtensionAction {
private static readonly Class = 'disable-status';
private static readonly Class = `${ExtensionAction.TEXT_ACTION_CLASS} disable-status`;
updateWhenCounterExtensionChanges: boolean = true;
private _runningExtensions: IExtensionDescription[] | null = null;
@@ -2635,7 +2711,7 @@ export class ExtensionToolTipAction extends ExtensionAction {
export class SystemDisabledWarningAction extends ExtensionAction {
private static readonly CLASS = 'system-disable';
private static readonly CLASS = `${ExtensionAction.ICON_ACTION_CLASS} system-disable`;
private static readonly WARNING_CLASS = `${SystemDisabledWarningAction.CLASS} codicon-warning`;
private static readonly INFO_CLASS = `${SystemDisabledWarningAction.CLASS} codicon-info`;
@@ -2726,7 +2802,6 @@ export class DisableAllAction extends Action {
static readonly ID = 'workbench.extensions.action.disableAll';
static readonly LABEL = localize('disableAll', "Disable All Installed Extensions");
constructor(
id: string = DisableAllAction.ID, label: string = DisableAllAction.LABEL,
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
@@ -2751,7 +2826,6 @@ export class DisableAllWorkspaceAction extends Action {
static readonly ID = 'workbench.extensions.action.disableAllWorkspace';
static readonly LABEL = localize('disableAllWorkspace', "Disable All Installed Extensions for this Workspace");
constructor(
id: string = DisableAllWorkspaceAction.ID, label: string = DisableAllWorkspaceAction.LABEL,
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
@@ -2778,7 +2852,6 @@ export class EnableAllAction extends Action {
static readonly ID = 'workbench.extensions.action.enableAll';
static readonly LABEL = localize('enableAll', "Enable All Extensions");
constructor(
id: string = EnableAllAction.ID, label: string = EnableAllAction.LABEL,
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
@@ -2803,7 +2876,6 @@ export class EnableAllWorkspaceAction extends Action {
static readonly ID = 'workbench.extensions.action.enableAllWorkspace';
static readonly LABEL = localize('enableAllWorkspace', "Enable All Extensions for this Workspace");
constructor(
id: string = EnableAllWorkspaceAction.ID, label: string = EnableAllWorkspaceAction.LABEL,
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
@@ -3262,49 +3334,49 @@ export const extensionButtonProminentHoverBackground = registerColor('extensionB
registerThemingParticipant((theme: IColorTheme, collector: ICssStyleCollector) => {
const foregroundColor = theme.getColor(foreground);
if (foregroundColor) {
collector.addRule(`.extension .monaco-action-bar .action-item .action-label.extension-action.built-in-status { border-color: ${foregroundColor}; }`);
collector.addRule(`.extension-list-item .monaco-action-bar .action-item .action-label.extension-action.built-in-status { border-color: ${foregroundColor}; }`);
collector.addRule(`.extension-editor .monaco-action-bar .action-item .action-label.extension-action.built-in-status { border-color: ${foregroundColor}; }`);
}
const buttonBackgroundColor = theme.getColor(buttonBackground);
if (buttonBackgroundColor) {
collector.addRule(`.extension .monaco-action-bar .action-item .action-label.extension-action { background-color: ${buttonBackgroundColor}; }`);
collector.addRule(`.extension-editor .monaco-action-bar .action-item .action-label.extension-action { background-color: ${buttonBackgroundColor}; }`);
collector.addRule(`.extension-list-item .monaco-action-bar .action-item .action-label.extension-action.label { background-color: ${buttonBackgroundColor}; }`);
collector.addRule(`.extension-editor .monaco-action-bar .action-item .action-label.extension-action.label { background-color: ${buttonBackgroundColor}; }`);
}
const buttonForegroundColor = theme.getColor(buttonForeground);
if (buttonForegroundColor) {
collector.addRule(`.extension .monaco-action-bar .action-item .action-label.extension-action { color: ${buttonForegroundColor}; }`);
collector.addRule(`.extension-editor .monaco-action-bar .action-item .action-label.extension-action { color: ${buttonForegroundColor}; }`);
collector.addRule(`.extension-list-item .monaco-action-bar .action-item .action-label.extension-action.label { color: ${buttonForegroundColor}; }`);
collector.addRule(`.extension-editor .monaco-action-bar .action-item .action-label.extension-action.label { color: ${buttonForegroundColor}; }`);
}
const buttonHoverBackgroundColor = theme.getColor(buttonHoverBackground);
if (buttonHoverBackgroundColor) {
collector.addRule(`.extension .monaco-action-bar .action-item:hover .action-label.extension-action { background-color: ${buttonHoverBackgroundColor}; }`);
collector.addRule(`.extension-editor .monaco-action-bar .action-item:hover .action-label.extension-action { background-color: ${buttonHoverBackgroundColor}; }`);
}
const contrastBorderColor = theme.getColor(contrastBorder);
if (contrastBorderColor) {
collector.addRule(`.extension .monaco-action-bar .action-item .action-label.extension-action { border: 1px solid ${contrastBorderColor}; }`);
collector.addRule(`.extension-editor .monaco-action-bar .action-item .action-label.extension-action { border: 1px solid ${contrastBorderColor}; }`);
collector.addRule(`.extension-list-item .monaco-action-bar .action-item:hover .action-label.extension-action.label { background-color: ${buttonHoverBackgroundColor}; }`);
collector.addRule(`.extension-editor .monaco-action-bar .action-item:hover .action-label.extension-action.label { background-color: ${buttonHoverBackgroundColor}; }`);
}
const extensionButtonProminentBackgroundColor = theme.getColor(extensionButtonProminentBackground);
if (extensionButtonProminentBackground) {
collector.addRule(`.extension .monaco-action-bar .action-item .action-label.extension-action.prominent { background-color: ${extensionButtonProminentBackgroundColor}; }`);
collector.addRule(`.extension-editor .monaco-action-bar .action-item .action-label.extension-action.prominent { background-color: ${extensionButtonProminentBackgroundColor}; }`);
collector.addRule(`.extension-list-item .monaco-action-bar .action-item .action-label.extension-action.label.prominent { background-color: ${extensionButtonProminentBackgroundColor}; }`);
collector.addRule(`.extension-editor .monaco-action-bar .action-item .action-label.extension-action.label.prominent { background-color: ${extensionButtonProminentBackgroundColor}; }`);
}
const extensionButtonProminentForegroundColor = theme.getColor(extensionButtonProminentForeground);
if (extensionButtonProminentForeground) {
collector.addRule(`.extension .monaco-action-bar .action-item .action-label.extension-action.prominent { color: ${extensionButtonProminentForegroundColor}; }`);
collector.addRule(`.extension-editor .monaco-action-bar .action-item .action-label.extension-action.prominent { color: ${extensionButtonProminentForegroundColor}; }`);
collector.addRule(`.extension-list-item .monaco-action-bar .action-item .action-label.extension-action.label.prominent { color: ${extensionButtonProminentForegroundColor}; }`);
collector.addRule(`.extension-editor .monaco-action-bar .action-item .action-label.extension-action.label.prominent { color: ${extensionButtonProminentForegroundColor}; }`);
}
const extensionButtonProminentHoverBackgroundColor = theme.getColor(extensionButtonProminentHoverBackground);
if (extensionButtonProminentHoverBackground) {
collector.addRule(`.extension .monaco-action-bar .action-item:hover .action-label.extension-action.prominent { background-color: ${extensionButtonProminentHoverBackgroundColor}; }`);
collector.addRule(`.extension-editor .monaco-action-bar .action-item:hover .action-label.extension-action.prominent { background-color: ${extensionButtonProminentHoverBackgroundColor}; }`);
collector.addRule(`.extension-list-item .monaco-action-bar .action-item:hover .action-label.extension-action.label.prominent { background-color: ${extensionButtonProminentHoverBackgroundColor}; }`);
collector.addRule(`.extension-editor .monaco-action-bar .action-item:hover .action-label.extension-action.label.prominent { background-color: ${extensionButtonProminentHoverBackgroundColor}; }`);
}
const contrastBorderColor = theme.getColor(contrastBorder);
if (contrastBorderColor) {
collector.addRule(`.extension-list-item .monaco-action-bar .action-item .action-label.extension-action { border: 1px solid ${contrastBorderColor}; }`);
collector.addRule(`.extension-editor .monaco-action-bar .action-item .action-label.extension-action { border: 1px solid ${contrastBorderColor}; }`);
}
});