未验证 提交 c4719739 编写于 作者: M Martin Aeschlimann 提交者: GitHub

Merge branch 'master' into aeschli/preferencesIcons

......@@ -7,8 +7,8 @@ let err = false;
const majorNodeVersion = parseInt(/^(\d+)\./.exec(process.versions.node)[1]);
if (majorNodeVersion < 10 || majorNodeVersion >= 15) {
console.error('\033[1;31m*** Please use node >=10 and <=14.\033[0;0m');
if (majorNodeVersion < 10 || majorNodeVersion >= 16) {
console.error('\033[1;31m*** Please use node >=10 and <=16.\033[0;0m');
err = true;
}
......
......@@ -2403,4 +2403,27 @@ declare module 'vscode' {
location?: Location;
}
//#endregion
//#region Statusbar Item Background Color (https://github.com/microsoft/vscode/issues/110214)
/**
* A status bar item is a status bar contribution that can
* show text and icons and run a command on click.
*/
export interface StatusBarItem {
/**
* The background color for this entry.
*
* Note: the supported colors for background are currently limited to
* `ThemeColors` with id `statusBarItem.errorBackground`. Other `ThemeColors`
* will be ignored.
*
* When setting the background color to `statusBarItem.errorBackground`, it is
* recommended to also set `color` to `statusBarItem.errorForeground`.
*/
backgroundColor: ThemeColor | undefined;
}
//#endregion
}
......@@ -27,7 +27,7 @@ export class MainThreadStatusBar implements MainThreadStatusBarShape {
this.entries.clear();
}
$setEntry(id: number, statusId: string, statusName: string, text: string, tooltip: string | undefined, command: Command | undefined, color: string | ThemeColor | undefined, alignment: MainThreadStatusBarAlignment, priority: number | undefined, accessibilityInformation: IAccessibilityInformation): void {
$setEntry(id: number, statusId: string, statusName: string, text: string, tooltip: string | undefined, command: Command | undefined, color: string | ThemeColor | undefined, backgroundColor: string | ThemeColor | undefined, alignment: MainThreadStatusBarAlignment, priority: number | undefined, accessibilityInformation: IAccessibilityInformation): void {
// if there are icons in the text use the tooltip for the aria label
let ariaLabel: string;
let role: string | undefined = undefined;
......@@ -37,7 +37,7 @@ export class MainThreadStatusBar implements MainThreadStatusBarShape {
} else {
ariaLabel = text ? text.replace(MainThreadStatusBar.CODICON_REGEXP, (_match, codiconName) => codiconName) : '';
}
const entry: IStatusbarEntry = { text, tooltip, command, color, ariaLabel, role };
const entry: IStatusbarEntry = { text, tooltip, command, color, backgroundColor, ariaLabel, role };
if (typeof priority === 'undefined') {
priority = 0;
......
......@@ -600,7 +600,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
priority = priority;
}
return extHostStatusBar.createStatusBarEntry(id, name, alignment, priority, accessibilityInformation);
return extHostStatusBar.createStatusBarEntry(id, name, alignment, priority, accessibilityInformation, extension);
},
setStatusBarMessage(text: string, timeoutOrThenable?: number | Thenable<any>): vscode.Disposable {
return extHostStatusBar.setStatusBarMessage(text, timeoutOrThenable);
......
......@@ -565,7 +565,7 @@ export interface MainThreadQuickOpenShape extends IDisposable {
}
export interface MainThreadStatusBarShape extends IDisposable {
$setEntry(id: number, statusId: string, statusName: string, text: string, tooltip: string | undefined, command: ICommandDto | undefined, color: string | ThemeColor | undefined, alignment: statusbar.StatusbarAlignment, priority: number | undefined, accessibilityInformation: IAccessibilityInformation | undefined): void;
$setEntry(id: number, statusId: string, statusName: string, text: string, tooltip: string | undefined, command: ICommandDto | undefined, color: string | ThemeColor | undefined, backgroundColor: string | ThemeColor | undefined, alignment: statusbar.StatusbarAlignment, priority: number | undefined, accessibilityInformation: IAccessibilityInformation | undefined): void;
$dispose(id: number): void;
}
......
......@@ -17,6 +17,7 @@ import { ISplice } from 'vs/base/common/sequence';
import { ILogService } from 'vs/platform/log/common/log';
import { CancellationToken } from 'vs/base/common/cancellation';
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { checkProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions';
type ProviderHandle = number;
type GroupHandle = number;
......@@ -221,17 +222,13 @@ export class ExtHostSCMInputBox implements vscode.SourceControlInputBox {
private _validateInput: IValidateInput | undefined;
get validateInput(): IValidateInput | undefined {
if (!this._extension.enableProposedApi) {
throw new Error(`[${this._extension.identifier.value}]: Proposed API is only available when running out of dev or with the following command line switch: --enable-proposed-api ${this._extension.identifier.value}`);
}
checkProposedApiEnabled(this._extension);
return this._validateInput;
}
set validateInput(fn: IValidateInput | undefined) {
if (!this._extension.enableProposedApi) {
throw new Error(`[${this._extension.identifier.value}]: Proposed API is only available when running out of dev or with the following command line switch: --enable-proposed-api ${this._extension.identifier.value}`);
}
checkProposedApiEnabled(this._extension);
if (fn && typeof fn !== 'function') {
throw new Error(`[${this._extension.identifier.value}]: Invalid SCM input box validation function`);
......
......@@ -10,9 +10,12 @@ import { MainContext, MainThreadStatusBarShape, IMainContext, ICommandDto } from
import { localize } from 'vs/nls';
import { CommandsConverter } from 'vs/workbench/api/common/extHostCommands';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { checkProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions';
export class ExtHostStatusBarEntry implements vscode.StatusBarItem {
private static ID_GEN = 0;
private static ALLOWED_BACKGROUND_COLORS = new Set<string>(['statusBarItem.errorBackground']);
private _id: number;
private _alignment: number;
......@@ -26,6 +29,7 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem {
private _text: string = '';
private _tooltip?: string;
private _color?: string | ThemeColor;
private _backgroundColor?: ThemeColor;
private readonly _internalCommandRegistration = new DisposableStore();
private _command?: {
readonly fromApi: string | vscode.Command,
......@@ -36,8 +40,9 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem {
private _proxy: MainThreadStatusBarShape;
private _commands: CommandsConverter;
private _accessibilityInformation?: vscode.AccessibilityInformation;
private _extension?: IExtensionDescription;
constructor(proxy: MainThreadStatusBarShape, commands: CommandsConverter, id: string, name: string, alignment: ExtHostStatusBarAlignment = ExtHostStatusBarAlignment.Left, priority?: number, accessibilityInformation?: vscode.AccessibilityInformation) {
constructor(proxy: MainThreadStatusBarShape, commands: CommandsConverter, id: string, name: string, alignment: ExtHostStatusBarAlignment = ExtHostStatusBarAlignment.Left, priority?: number, accessibilityInformation?: vscode.AccessibilityInformation, extension?: IExtensionDescription) {
this._id = ExtHostStatusBarEntry.ID_GEN++;
this._proxy = proxy;
this._commands = commands;
......@@ -46,6 +51,7 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem {
this._alignment = alignment;
this._priority = priority;
this._accessibilityInformation = accessibilityInformation;
this._extension = extension;
}
public get id(): number {
......@@ -72,6 +78,14 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem {
return this._color;
}
public get backgroundColor(): ThemeColor | undefined {
if (this._extension) {
checkProposedApiEnabled(this._extension);
}
return this._backgroundColor;
}
public get command(): string | vscode.Command | undefined {
return this._command?.fromApi;
}
......@@ -95,6 +109,19 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem {
this.update();
}
public set backgroundColor(color: ThemeColor | undefined) {
if (this._extension) {
checkProposedApiEnabled(this._extension);
}
if (color && !ExtHostStatusBarEntry.ALLOWED_BACKGROUND_COLORS.has(color.id)) {
color = undefined;
}
this._backgroundColor = color;
this.update();
}
public set command(command: string | vscode.Command | undefined) {
if (this._command?.fromApi === command) {
return;
......@@ -146,7 +173,7 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem {
// Set to status bar
this._proxy.$setEntry(this.id, this._statusId, this._statusName, this.text, this.tooltip, this._command?.internal, this.color,
this._alignment === ExtHostStatusBarAlignment.Left ? MainThreadStatusBarAlignment.LEFT : MainThreadStatusBarAlignment.RIGHT,
this.backgroundColor, this._alignment === ExtHostStatusBarAlignment.Left ? MainThreadStatusBarAlignment.LEFT : MainThreadStatusBarAlignment.RIGHT,
this._priority, this._accessibilityInformation);
}, 0);
}
......@@ -207,8 +234,8 @@ export class ExtHostStatusBar {
this._statusMessage = new StatusBarMessage(this);
}
createStatusBarEntry(id: string, name: string, alignment?: ExtHostStatusBarAlignment, priority?: number, accessibilityInformation?: vscode.AccessibilityInformation): vscode.StatusBarItem {
return new ExtHostStatusBarEntry(this._proxy, this._commands, id, name, alignment, priority, accessibilityInformation);
createStatusBarEntry(id: string, name: string, alignment?: ExtHostStatusBarAlignment, priority?: number, accessibilityInformation?: vscode.AccessibilityInformation, extension?: IExtensionDescription): vscode.StatusBarItem {
return new ExtHostStatusBarEntry(this._proxy, this._commands, id, name, alignment, priority, accessibilityInformation, extension);
}
setStatusBarMessage(text: string, timeoutOrThenable?: number | Thenable<any>): Disposable {
......
......@@ -395,6 +395,18 @@ export const STATUS_BAR_PROMINENT_ITEM_BACKGROUND = registerColor('statusBarItem
hc: Color.black.transparent(0.5),
}, nls.localize('statusBarProminentItemBackground', "Status bar prominent items background color. Prominent items stand out from other status bar entries to indicate importance. Change mode `Toggle Tab Key Moves Focus` from command palette to see an example. The status bar is shown in the bottom of the window."));
export const STATUS_BAR_ERROR_ITEM_BACKGROUND = registerColor('statusBarItem.errorBackground', {
dark: Color.red,
light: Color.red,
hc: null,
}, nls.localize('statusBarErrorItemBackground', "Status bar error items background color. Error items stand out from other status bar entries to indicate error conditions. The status bar is shown in the bottom of the window."));
export const STATUS_BAR_ERROR_ITEM_FOREGROUND = registerColor('statusBarItem.errorForeground', {
dark: STATUS_BAR_FOREGROUND,
light: STATUS_BAR_FOREGROUND,
hc: STATUS_BAR_FOREGROUND,
}, nls.localize('statusBarErrorItemForeground', "Status bar error items foreground color. Error items stand out from other status bar entries to indicate error conditions. The status bar is shown in the bottom of the window."));
export const STATUS_BAR_PROMINENT_ITEM_HOVER_BACKGROUND = registerColor('statusBarItem.prominentHoverBackground', {
dark: Color.black.transparent(0.3),
light: Color.black.transparent(0.3),
......
......@@ -84,6 +84,7 @@
/* Make icons and text the same color as the list foreground on focus selection */
.debug-pane .monaco-list:focus .monaco-list-row.selected .state.label,
.debug-pane .monaco-list:focus .monaco-list-row.selected .load-all,
.debug-pane .monaco-list:focus .monaco-list-row.selected.focused .state.label,
.debug-pane .monaco-list:focus .monaco-list-row.selected .codicon,
.debug-pane .monaco-list:focus .monaco-list-row.selected.focused .codicon {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册