@codingame/monaco-vscode-view-status-bar-service-override 1.82.4 → 1.82.5-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
- package/external/tslib/tslib.es6.js +11 -0
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +2 -2
- package/viewStatusBar.d.ts +5 -0
- package/viewStatusBar.js +11 -0
- package/vscode/src/vs/workbench/browser/parts/statusbar/media/statusbarpart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/statusbar/statusbarActions.js +111 -0
- package/vscode/src/vs/workbench/browser/parts/statusbar/statusbarItem.js +236 -0
- package/vscode/src/vs/workbench/browser/parts/statusbar/statusbarModel.js +251 -0
- package/vscode/src/vs/workbench/browser/parts/statusbar/statusbarPart.js +441 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=( Object.keys(r.attributes)),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
2
|
+
|
|
3
|
+
export { n as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function __decorate(decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
}
|
|
7
|
+
function __param(paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { __decorate, __param };
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from '
|
|
2
|
-
export
|
|
1
|
+
export { default } from './viewStatusBar.js';
|
|
2
|
+
export { StatusbarPart } from 'vscode/vscode/vs/workbench/browser/parts/statusbar/statusbarPart';
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from '
|
|
2
|
-
export
|
|
1
|
+
export { default } from './viewStatusBar.js';
|
|
2
|
+
export { StatusbarPart } from './vscode/src/vs/workbench/browser/parts/statusbar/statusbarPart.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-view-status-bar-service-override",
|
|
3
|
-
"version": "1.82.
|
|
3
|
+
"version": "1.82.5-next.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@1.82.
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@1.82.5-next.1",
|
|
22
22
|
"monaco-editor": "0.43.0"
|
|
23
23
|
}
|
|
24
24
|
}
|
package/viewStatusBar.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
|
|
2
|
+
import { StatusbarPart } from './vscode/src/vs/workbench/browser/parts/statusbar/statusbarPart.js';
|
|
3
|
+
import { IStatusbarService } from 'vscode/vscode/vs/workbench/services/statusbar/browser/statusbar';
|
|
4
|
+
|
|
5
|
+
function getServiceOverride() {
|
|
6
|
+
return {
|
|
7
|
+
[( IStatusbarService.toString())]: new SyncDescriptor(StatusbarPart, [], false)
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { StatusbarPart, getServiceOverride as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import n from '../../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
|
|
2
|
+
|
|
3
|
+
var css = ".monaco-workbench .part.statusbar{box-sizing:border-box;cursor:default;display:flex;font-size:12px;height:22px;overflow:hidden;width:100%}.monaco-workbench:not(.reduce-motion) .part.statusbar{transition:background-color .15s ease-out}.monaco-workbench .part.statusbar.status-border-top:after{background-color:var(--status-border-top-color);content:\"\";height:1px;left:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:5}.monaco-workbench .part.statusbar>.left-items,.monaco-workbench .part.statusbar>.right-items{display:flex}.monaco-workbench .part.statusbar>.right-items{flex-direction:row-reverse;flex-wrap:wrap}.monaco-workbench .part.statusbar>.left-items{flex-grow:1}.monaco-workbench .part.statusbar>.items-container>.statusbar-item{display:inline-block;font-variant-numeric:tabular-nums;height:100%;line-height:22px;max-width:40vw;vertical-align:top}.monaco-workbench .part.statusbar>.items-container>.statusbar-item.has-beak{position:relative}.monaco-workbench .part.statusbar>.items-container>.statusbar-item.has-beak>.status-bar-item-beak-container{height:5px;left:calc(50% - 5px);position:absolute;top:-5px;width:10px}.monaco-workbench .part.statusbar>.items-container>.statusbar-item.has-beak>.status-bar-item-beak-container:before{border-bottom-style:solid;border-bottom-width:5px;border-left:5px solid transparent;border-right:5px solid transparent;content:\"\";position:fixed}.monaco-workbench .part.statusbar>.items-container>.statusbar-item>.statusbar-item-label{margin-left:3px;margin-right:3px}.monaco-workbench .part.statusbar>.items-container>.statusbar-item.compact-left>.statusbar-item-label{margin-left:0;margin-right:3px}.monaco-workbench .part.statusbar>.items-container>.statusbar-item.compact-right>.statusbar-item-label{margin-left:3px;margin-right:0}.monaco-workbench .part.statusbar>.items-container>.statusbar-item.left.first-visible-item{padding-left:7px}.monaco-workbench .part.statusbar>.items-container>.statusbar-item.right.last-visible-item{margin-right:7px}.monaco-workbench .part.statusbar>.items-container>.statusbar-item.has-background-color.left.first-visible-item,.monaco-workbench .part.statusbar>.items-container>.statusbar-item.has-background-color.right.last-visible-item{padding-left:0;padding-right:0}.monaco-workbench .part.statusbar>.items-container>.statusbar-item.has-background-color>.statusbar-item-label{margin-left:0;margin-right:0;padding-left:10px;padding-right:10px}.monaco-workbench .part.statusbar>.items-container>.statusbar-item.compact-left.has-background-color>.statusbar-item-label{padding-left:3px;padding-right:10px}.monaco-workbench .part.statusbar>.items-container>.statusbar-item.compact-right.has-background-color>.statusbar-item-label{padding-left:10px;padding-right:3px}.monaco-workbench .part.statusbar>.items-container>.statusbar-item>.statusbar-item-label{align-items:center;cursor:pointer;display:flex;height:100%;outline-width:0;overflow:hidden;padding:0 5px;text-overflow:ellipsis;white-space:pre}.monaco-workbench .part.statusbar>.items-container>.statusbar-item.compact-left>.statusbar-item-label,.monaco-workbench .part.statusbar>.items-container>.statusbar-item.compact-right>.statusbar-item-label{padding:0 3px}.monaco-workbench .part.statusbar>.items-container>.statusbar-item>a:hover:not(.disabled){color:var(--vscode-statusBarItem-hoverForeground);text-decoration:none}.monaco-workbench .part.statusbar>.items-container>.statusbar-item>a.disabled{cursor:default}.monaco-workbench .part.statusbar>.items-container>.statusbar-item span.codicon{color:inherit;font-size:14px;text-align:center}.monaco-workbench .part.statusbar>.items-container>.statusbar-item a:active:not(.disabled){outline:1px solid var(--vscode-contrastActiveBorder)!important;outline-offset:-1px}.monaco-workbench:not(.hc-light):not(.hc-black) .part.statusbar>.items-container>.statusbar-item a:active:not(.disabled){background-color:var(--vscode-statusBarItem-activeBackground)!important}.monaco-workbench .part.statusbar>.items-container>.statusbar-item a:hover:not(.disabled){outline:1px dashed var(--vscode-contrastActiveBorder);outline-offset:-1px}.monaco-workbench:not(.hc-light):not(.hc-black) .part.statusbar>.items-container>.statusbar-item a:hover:not(.disabled){background-color:var(--vscode-statusBarItem-hoverBackground)}.monaco-workbench .part.statusbar>.items-container>.statusbar-item.warning-kind{background-color:var(--vscode-statusBarItem-warningBackground);color:var(--vscode-statusBarItem-warningForeground)}.monaco-workbench .part.statusbar>.items-container>.statusbar-item.warning-kind a:hover:not(.disabled){background-color:var(--vscode-statusBarItem-warningHoverBackground)!important;color:var(--vscode-statusBarItem-warningHoverForeground)}.monaco-workbench .part.statusbar>.items-container>.statusbar-item.error-kind{background-color:var(--vscode-statusBarItem-errorBackground);color:var(--vscode-statusBarItem-errorForeground)}.monaco-workbench .part.statusbar>.items-container>.statusbar-item.error-kind a:hover:not(.disabled){background-color:var(--vscode-statusBarItem-errorHoverBackground)!important;color:var(--vscode-statusBarItem-errorHoverForeground)}.monaco-workbench .part.statusbar>.items-container>.statusbar-item.prominent-kind{background-color:var(--vscode-statusBarItem-prominentBackground);color:var(--vscode-statusBarItem-prominentForeground)}.monaco-workbench .part.statusbar>.items-container>.statusbar-item.prominent-kind a:hover:not(.disabled){background-color:var(--vscode-statusBarItem-prominentHoverBackground)!important;color:var(--vscode-statusBarItem-prominentHoverForeground)}.monaco-workbench .part.statusbar>.items-container>.statusbar-item.remote-kind{background-color:var(--vscode-statusBarItem-remoteBackground);color:var(--vscode-statusBarItem-remoteForeground)}.monaco-workbench .part.statusbar>.items-container>.statusbar-item.remote-kind a:hover:not(.disabled){background-color:var(--vscode-statusBarItem-remoteHoverBackground)!important;color:var(--vscode-statusBarItem-remoteHoverForeground)}.monaco-workbench .part.statusbar>.items-container>.statusbar-item.offline-kind{background-color:var(--vscode-statusBarItem-offlineBackground);color:var(--vscode-statusBarItem-offlineForeground)}.monaco-workbench .part.statusbar>.items-container>.statusbar-item.offline-kind a:hover:not(.disabled){background-color:var(--vscode-statusBarItem-offlineHoverBackground)!important;color:var(--vscode-statusBarItem-offlineHoverForeground)}";
|
|
4
|
+
n(css,{});
|
|
5
|
+
|
|
6
|
+
export { css, css as default };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
2
|
+
import { IStatusbarService } from 'vscode/vscode/vs/workbench/services/statusbar/browser/statusbar';
|
|
3
|
+
import { Action } from 'monaco-editor/esm/vs/base/common/actions.js';
|
|
4
|
+
import { IWorkbenchLayoutService } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService';
|
|
5
|
+
import { KeybindingsRegistry } from 'monaco-editor/esm/vs/platform/keybinding/common/keybindingsRegistry.js';
|
|
6
|
+
import { registerAction2, Action2 } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
|
|
7
|
+
import { Categories } from 'monaco-editor/esm/vs/platform/action/common/actionCommonCategories.js';
|
|
8
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
9
|
+
import { StatusBarFocused } from 'vscode/vscode/vs/workbench/common/contextkeys';
|
|
10
|
+
|
|
11
|
+
class ToggleStatusbarEntryVisibilityAction extends Action {
|
|
12
|
+
constructor(id, label, model) {
|
|
13
|
+
super(id, label, undefined, true);
|
|
14
|
+
this.model = model;
|
|
15
|
+
this.checked = !model.isHidden(id);
|
|
16
|
+
}
|
|
17
|
+
async run() {
|
|
18
|
+
if (this.model.isHidden(this.id)) {
|
|
19
|
+
this.model.show(this.id);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
this.model.hide(this.id);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
class HideStatusbarEntryAction extends Action {
|
|
27
|
+
constructor(id, name, model) {
|
|
28
|
+
super(id, ( localize('hide', "Hide '{0}'", name)), undefined, true);
|
|
29
|
+
this.model = model;
|
|
30
|
+
}
|
|
31
|
+
async run() {
|
|
32
|
+
this.model.hide(this.id);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
36
|
+
id: 'workbench.statusBar.focusPrevious',
|
|
37
|
+
weight: 200 ,
|
|
38
|
+
primary: 15 ,
|
|
39
|
+
secondary: [16 ],
|
|
40
|
+
when: StatusBarFocused,
|
|
41
|
+
handler: (accessor) => {
|
|
42
|
+
const statusBarService = accessor.get(IStatusbarService);
|
|
43
|
+
statusBarService.focusPreviousEntry();
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
47
|
+
id: 'workbench.statusBar.focusNext',
|
|
48
|
+
weight: 200 ,
|
|
49
|
+
primary: 17 ,
|
|
50
|
+
secondary: [18 ],
|
|
51
|
+
when: StatusBarFocused,
|
|
52
|
+
handler: (accessor) => {
|
|
53
|
+
const statusBarService = accessor.get(IStatusbarService);
|
|
54
|
+
statusBarService.focusNextEntry();
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
58
|
+
id: 'workbench.statusBar.focusFirst',
|
|
59
|
+
weight: 200 ,
|
|
60
|
+
primary: 14 ,
|
|
61
|
+
when: StatusBarFocused,
|
|
62
|
+
handler: (accessor) => {
|
|
63
|
+
const statusBarService = accessor.get(IStatusbarService);
|
|
64
|
+
statusBarService.focus(false);
|
|
65
|
+
statusBarService.focusNextEntry();
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
69
|
+
id: 'workbench.statusBar.focusLast',
|
|
70
|
+
weight: 200 ,
|
|
71
|
+
primary: 13 ,
|
|
72
|
+
when: StatusBarFocused,
|
|
73
|
+
handler: (accessor) => {
|
|
74
|
+
const statusBarService = accessor.get(IStatusbarService);
|
|
75
|
+
statusBarService.focus(false);
|
|
76
|
+
statusBarService.focusPreviousEntry();
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
80
|
+
id: 'workbench.statusBar.clearFocus',
|
|
81
|
+
weight: 200 ,
|
|
82
|
+
primary: 9 ,
|
|
83
|
+
when: StatusBarFocused,
|
|
84
|
+
handler: (accessor) => {
|
|
85
|
+
const statusBarService = accessor.get(IStatusbarService);
|
|
86
|
+
const editorService = accessor.get(IEditorService);
|
|
87
|
+
if (statusBarService.isEntryFocused()) {
|
|
88
|
+
statusBarService.focus(false);
|
|
89
|
+
}
|
|
90
|
+
else if (editorService.activeEditorPane) {
|
|
91
|
+
editorService.activeEditorPane.focus();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
class FocusStatusBarAction extends Action2 {
|
|
96
|
+
constructor() {
|
|
97
|
+
super({
|
|
98
|
+
id: 'workbench.action.focusStatusBar',
|
|
99
|
+
title: { value: ( localize('focusStatusBar', "Focus Status Bar")), original: 'Focus Status Bar' },
|
|
100
|
+
category: Categories.View,
|
|
101
|
+
f1: true
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
async run(accessor) {
|
|
105
|
+
const layoutService = accessor.get(IWorkbenchLayoutService);
|
|
106
|
+
layoutService.focusPart("workbench.parts.statusbar" );
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
registerAction2(FocusStatusBarAction);
|
|
110
|
+
|
|
111
|
+
export { HideStatusbarEntryAction, ToggleStatusbarEntryVisibilityAction };
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { toErrorMessage } from 'monaco-editor/esm/vs/base/common/errorMessage.js';
|
|
3
|
+
import { Disposable, MutableDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
4
|
+
import { SimpleIconLabel } from 'vscode/vscode/vs/base/browser/ui/iconLabel/simpleIconLabel';
|
|
5
|
+
import { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
6
|
+
import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
|
|
7
|
+
import { ShowTooltipCommand, StatusbarEntryKinds } from 'vscode/vscode/vs/workbench/services/statusbar/browser/statusbar';
|
|
8
|
+
import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
9
|
+
import { isThemeColor } from 'monaco-editor/esm/vs/editor/common/editorCommon.js';
|
|
10
|
+
import { show, hide, addDisposableListener, EventType, EventHelper, append } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
11
|
+
import { INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
|
12
|
+
import { assertIsDefined } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
13
|
+
import { StandardKeyboardEvent } from 'monaco-editor/esm/vs/base/browser/keyboardEvent.js';
|
|
14
|
+
import { renderIcon, renderLabelWithIcons } from 'monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabels.js';
|
|
15
|
+
import { syncing, spinningLoading } from 'monaco-editor/esm/vs/platform/theme/common/iconRegistry.js';
|
|
16
|
+
import { setupCustomHover } from 'monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabelHover.js';
|
|
17
|
+
import { isMarkdownString, markdownStringEqual } from 'monaco-editor/esm/vs/base/common/htmlContent.js';
|
|
18
|
+
import { Gesture, EventType as EventType$1 } from 'monaco-editor/esm/vs/base/browser/touch.js';
|
|
19
|
+
|
|
20
|
+
let StatusbarEntryItem = class StatusbarEntryItem extends Disposable {
|
|
21
|
+
get name() {
|
|
22
|
+
return assertIsDefined(this.entry).name;
|
|
23
|
+
}
|
|
24
|
+
get hasCommand() {
|
|
25
|
+
return typeof this.entry?.command !== 'undefined';
|
|
26
|
+
}
|
|
27
|
+
constructor(container, entry, hoverDelegate, commandService, notificationService, telemetryService, themeService) {
|
|
28
|
+
super();
|
|
29
|
+
this.container = container;
|
|
30
|
+
this.hoverDelegate = hoverDelegate;
|
|
31
|
+
this.commandService = commandService;
|
|
32
|
+
this.notificationService = notificationService;
|
|
33
|
+
this.telemetryService = telemetryService;
|
|
34
|
+
this.themeService = themeService;
|
|
35
|
+
this.entry = undefined;
|
|
36
|
+
this.foregroundListener = this._register(( new MutableDisposable()));
|
|
37
|
+
this.backgroundListener = this._register(( new MutableDisposable()));
|
|
38
|
+
this.commandMouseListener = this._register(( new MutableDisposable()));
|
|
39
|
+
this.commandTouchListener = this._register(( new MutableDisposable()));
|
|
40
|
+
this.commandKeyboardListener = this._register(( new MutableDisposable()));
|
|
41
|
+
this.hover = undefined;
|
|
42
|
+
this.labelContainer = document.createElement('a');
|
|
43
|
+
this.labelContainer.tabIndex = -1;
|
|
44
|
+
this.labelContainer.setAttribute('role', 'button');
|
|
45
|
+
this.labelContainer.className = 'statusbar-item-label';
|
|
46
|
+
this._register(Gesture.addTarget(this.labelContainer));
|
|
47
|
+
this.label = ( new StatusBarCodiconLabel(this.labelContainer));
|
|
48
|
+
this.container.appendChild(this.labelContainer);
|
|
49
|
+
this.beakContainer = document.createElement('div');
|
|
50
|
+
this.beakContainer.className = 'status-bar-item-beak-container';
|
|
51
|
+
this.container.appendChild(this.beakContainer);
|
|
52
|
+
this.update(entry);
|
|
53
|
+
}
|
|
54
|
+
update(entry) {
|
|
55
|
+
this.label.showProgress = entry.showProgress ?? false;
|
|
56
|
+
if (!this.entry || entry.text !== this.entry.text) {
|
|
57
|
+
this.label.text = entry.text;
|
|
58
|
+
if (entry.text) {
|
|
59
|
+
show(this.labelContainer);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
hide(this.labelContainer);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (!this.entry || entry.ariaLabel !== this.entry.ariaLabel) {
|
|
66
|
+
this.container.setAttribute('aria-label', entry.ariaLabel);
|
|
67
|
+
this.labelContainer.setAttribute('aria-label', entry.ariaLabel);
|
|
68
|
+
}
|
|
69
|
+
if (!this.entry || entry.role !== this.entry.role) {
|
|
70
|
+
this.labelContainer.setAttribute('role', entry.role || 'button');
|
|
71
|
+
}
|
|
72
|
+
if (!this.entry || !this.isEqualTooltip(this.entry, entry)) {
|
|
73
|
+
const hoverContents = isMarkdownString(entry.tooltip) ? { markdown: entry.tooltip, markdownNotSupportedFallback: undefined } : entry.tooltip;
|
|
74
|
+
if (this.hover) {
|
|
75
|
+
this.hover.update(hoverContents);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
this.hover = this._register(setupCustomHover(this.hoverDelegate, this.container, hoverContents));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (!this.entry || entry.command !== this.entry.command) {
|
|
82
|
+
this.commandMouseListener.clear();
|
|
83
|
+
this.commandTouchListener.clear();
|
|
84
|
+
this.commandKeyboardListener.clear();
|
|
85
|
+
const command = entry.command;
|
|
86
|
+
if (command && (command !== ShowTooltipCommand || this.hover) ) {
|
|
87
|
+
this.commandMouseListener.value = addDisposableListener(this.labelContainer, EventType.CLICK, () => this.executeCommand(command));
|
|
88
|
+
this.commandTouchListener.value = addDisposableListener(this.labelContainer, EventType$1.Tap, () => this.executeCommand(command));
|
|
89
|
+
this.commandKeyboardListener.value = addDisposableListener(this.labelContainer, EventType.KEY_DOWN, e => {
|
|
90
|
+
const event = ( new StandardKeyboardEvent(e));
|
|
91
|
+
if (event.equals(10 ) || event.equals(3 )) {
|
|
92
|
+
EventHelper.stop(e);
|
|
93
|
+
this.executeCommand(command);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
this.labelContainer.classList.remove('disabled');
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
this.labelContainer.classList.add('disabled');
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (!this.entry || entry.showBeak !== this.entry.showBeak) {
|
|
103
|
+
if (entry.showBeak) {
|
|
104
|
+
this.container.classList.add('has-beak');
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
this.container.classList.remove('has-beak');
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const hasBackgroundColor = !!entry.backgroundColor || (entry.kind && entry.kind !== 'standard');
|
|
111
|
+
if (!this.entry || entry.kind !== this.entry.kind) {
|
|
112
|
+
for (const kind of StatusbarEntryKinds) {
|
|
113
|
+
this.container.classList.remove(`${kind}-kind`);
|
|
114
|
+
}
|
|
115
|
+
if (entry.kind && entry.kind !== 'standard') {
|
|
116
|
+
this.container.classList.add(`${entry.kind}-kind`);
|
|
117
|
+
}
|
|
118
|
+
this.container.classList.toggle('has-background-color', hasBackgroundColor);
|
|
119
|
+
}
|
|
120
|
+
if (!this.entry || entry.color !== this.entry.color) {
|
|
121
|
+
this.applyColor(this.labelContainer, entry.color);
|
|
122
|
+
}
|
|
123
|
+
if (!this.entry || entry.backgroundColor !== this.entry.backgroundColor) {
|
|
124
|
+
this.container.classList.toggle('has-background-color', hasBackgroundColor);
|
|
125
|
+
this.applyColor(this.container, entry.backgroundColor, true);
|
|
126
|
+
}
|
|
127
|
+
this.entry = entry;
|
|
128
|
+
}
|
|
129
|
+
isEqualTooltip({ tooltip }, { tooltip: otherTooltip }) {
|
|
130
|
+
if (tooltip === undefined) {
|
|
131
|
+
return otherTooltip === undefined;
|
|
132
|
+
}
|
|
133
|
+
if (isMarkdownString(tooltip)) {
|
|
134
|
+
return isMarkdownString(otherTooltip) && markdownStringEqual(tooltip, otherTooltip);
|
|
135
|
+
}
|
|
136
|
+
return tooltip === otherTooltip;
|
|
137
|
+
}
|
|
138
|
+
async executeCommand(command) {
|
|
139
|
+
if (command === ShowTooltipCommand) {
|
|
140
|
+
this.hover?.show(true );
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
const id = typeof command === 'string' ? command : command.id;
|
|
144
|
+
const args = typeof command === 'string' ? [] : command.arguments ?? [];
|
|
145
|
+
this.telemetryService.publicLog2('workbenchActionExecuted', { id, from: 'status bar' });
|
|
146
|
+
try {
|
|
147
|
+
await this.commandService.executeCommand(id, ...args);
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
this.notificationService.error(toErrorMessage(error));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
applyColor(container, color, isBackground) {
|
|
155
|
+
let colorResult = undefined;
|
|
156
|
+
if (isBackground) {
|
|
157
|
+
this.backgroundListener.clear();
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
this.foregroundListener.clear();
|
|
161
|
+
}
|
|
162
|
+
if (color) {
|
|
163
|
+
if (isThemeColor(color)) {
|
|
164
|
+
colorResult = this.themeService.getColorTheme().getColor(color.id)?.toString();
|
|
165
|
+
const listener = this.themeService.onDidColorThemeChange(theme => {
|
|
166
|
+
const colorValue = theme.getColor(color.id)?.toString();
|
|
167
|
+
if (isBackground) {
|
|
168
|
+
container.style.backgroundColor = colorValue ?? '';
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
container.style.color = colorValue ?? '';
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
if (isBackground) {
|
|
175
|
+
this.backgroundListener.value = listener;
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
this.foregroundListener.value = listener;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
colorResult = color;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (isBackground) {
|
|
186
|
+
container.style.backgroundColor = colorResult ?? '';
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
container.style.color = colorResult ?? '';
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
StatusbarEntryItem = ( __decorate([
|
|
194
|
+
( __param(3, ICommandService)),
|
|
195
|
+
( __param(4, INotificationService)),
|
|
196
|
+
( __param(5, ITelemetryService)),
|
|
197
|
+
( __param(6, IThemeService))
|
|
198
|
+
], StatusbarEntryItem));
|
|
199
|
+
class StatusBarCodiconLabel extends SimpleIconLabel {
|
|
200
|
+
constructor(container) {
|
|
201
|
+
super(container);
|
|
202
|
+
this.container = container;
|
|
203
|
+
this.progressCodicon = renderIcon(syncing);
|
|
204
|
+
this.currentText = '';
|
|
205
|
+
this.currentShowProgress = false;
|
|
206
|
+
}
|
|
207
|
+
set showProgress(showProgress) {
|
|
208
|
+
if (this.currentShowProgress !== showProgress) {
|
|
209
|
+
this.currentShowProgress = showProgress;
|
|
210
|
+
this.progressCodicon = renderIcon(showProgress === 'loading' ? spinningLoading : syncing);
|
|
211
|
+
this.text = this.currentText;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
set text(text) {
|
|
215
|
+
if (this.currentShowProgress) {
|
|
216
|
+
if (this.container.firstChild !== this.progressCodicon) {
|
|
217
|
+
this.container.appendChild(this.progressCodicon);
|
|
218
|
+
}
|
|
219
|
+
for (const node of Array.from(this.container.childNodes)) {
|
|
220
|
+
if (node !== this.progressCodicon) {
|
|
221
|
+
node.remove();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
let textContent = text ?? '';
|
|
225
|
+
if (textContent) {
|
|
226
|
+
textContent = ` ${textContent}`;
|
|
227
|
+
}
|
|
228
|
+
append(this.container, ...renderLabelWithIcons(textContent));
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
super.text = text;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export { StatusbarEntryItem };
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { Disposable, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
2
|
+
import { isStatusbarEntryLocation } from 'vscode/vscode/vs/workbench/services/statusbar/browser/statusbar';
|
|
3
|
+
import { isAncestor, hide, show } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
4
|
+
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
5
|
+
|
|
6
|
+
class StatusbarViewModel extends Disposable {
|
|
7
|
+
static { this.HIDDEN_ENTRIES_KEY = 'workbench.statusbar.hidden'; }
|
|
8
|
+
get entries() { return this._entries.slice(0); }
|
|
9
|
+
get lastFocusedEntry() {
|
|
10
|
+
return this._lastFocusedEntry && !this.isHidden(this._lastFocusedEntry.id) ? this._lastFocusedEntry : undefined;
|
|
11
|
+
}
|
|
12
|
+
constructor(storageService) {
|
|
13
|
+
super();
|
|
14
|
+
this.storageService = storageService;
|
|
15
|
+
this._onDidChangeEntryVisibility = this._register(( new Emitter()));
|
|
16
|
+
this.onDidChangeEntryVisibility = this._onDidChangeEntryVisibility.event;
|
|
17
|
+
this._entries = [];
|
|
18
|
+
this.hidden = ( new Set());
|
|
19
|
+
this.restoreState();
|
|
20
|
+
this.registerListeners();
|
|
21
|
+
}
|
|
22
|
+
restoreState() {
|
|
23
|
+
const hiddenRaw = this.storageService.get(StatusbarViewModel.HIDDEN_ENTRIES_KEY, 0 );
|
|
24
|
+
if (hiddenRaw) {
|
|
25
|
+
try {
|
|
26
|
+
const hiddenArray = JSON.parse(hiddenRaw);
|
|
27
|
+
this.hidden = ( new Set(hiddenArray));
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
registerListeners() {
|
|
34
|
+
this._register(this.storageService.onDidChangeValue(0 , StatusbarViewModel.HIDDEN_ENTRIES_KEY, this._register(( new DisposableStore())))(() => this.onDidStorageValueChange()));
|
|
35
|
+
}
|
|
36
|
+
onDidStorageValueChange() {
|
|
37
|
+
const currentlyHidden = ( new Set(this.hidden));
|
|
38
|
+
this.hidden.clear();
|
|
39
|
+
this.restoreState();
|
|
40
|
+
const changed = ( new Set());
|
|
41
|
+
for (const id of currentlyHidden) {
|
|
42
|
+
if (!( this.hidden.has(id))) {
|
|
43
|
+
changed.add(id);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
for (const id of this.hidden) {
|
|
47
|
+
if (!( currentlyHidden.has(id))) {
|
|
48
|
+
changed.add(id);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (changed.size > 0) {
|
|
52
|
+
for (const entry of this._entries) {
|
|
53
|
+
if (( changed.has(entry.id))) {
|
|
54
|
+
this.updateVisibility(entry.id, true);
|
|
55
|
+
changed.delete(entry.id);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
add(entry) {
|
|
61
|
+
this._entries.push(entry);
|
|
62
|
+
this.updateVisibility(entry, false);
|
|
63
|
+
this.sort();
|
|
64
|
+
this.markFirstLastVisibleEntry();
|
|
65
|
+
}
|
|
66
|
+
remove(entry) {
|
|
67
|
+
const index = this._entries.indexOf(entry);
|
|
68
|
+
if (index >= 0) {
|
|
69
|
+
this._entries.splice(index, 1);
|
|
70
|
+
if (( this._entries.some(
|
|
71
|
+
otherEntry => isStatusbarEntryLocation(otherEntry.priority.primary) && otherEntry.priority.primary.id === entry.id
|
|
72
|
+
))) {
|
|
73
|
+
this.sort();
|
|
74
|
+
}
|
|
75
|
+
this.markFirstLastVisibleEntry();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
isHidden(id) {
|
|
79
|
+
return ( this.hidden.has(id));
|
|
80
|
+
}
|
|
81
|
+
hide(id) {
|
|
82
|
+
if (!( this.hidden.has(id))) {
|
|
83
|
+
this.hidden.add(id);
|
|
84
|
+
this.updateVisibility(id, true);
|
|
85
|
+
this.saveState();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
show(id) {
|
|
89
|
+
if (( this.hidden.has(id))) {
|
|
90
|
+
this.hidden.delete(id);
|
|
91
|
+
this.updateVisibility(id, true);
|
|
92
|
+
this.saveState();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
findEntry(container) {
|
|
96
|
+
return this._entries.find(entry => entry.container === container);
|
|
97
|
+
}
|
|
98
|
+
getEntries(alignment) {
|
|
99
|
+
return this._entries.filter(entry => entry.alignment === alignment);
|
|
100
|
+
}
|
|
101
|
+
focusNextEntry() {
|
|
102
|
+
this.focusEntry(+1, 0);
|
|
103
|
+
}
|
|
104
|
+
focusPreviousEntry() {
|
|
105
|
+
this.focusEntry(-1, this.entries.length - 1);
|
|
106
|
+
}
|
|
107
|
+
isEntryFocused() {
|
|
108
|
+
return !!this.getFocusedEntry();
|
|
109
|
+
}
|
|
110
|
+
getFocusedEntry() {
|
|
111
|
+
return this._entries.find(entry => isAncestor(document.activeElement, entry.container));
|
|
112
|
+
}
|
|
113
|
+
focusEntry(delta, restartPosition) {
|
|
114
|
+
const getVisibleEntry = (start) => {
|
|
115
|
+
let indexToFocus = start;
|
|
116
|
+
let entry = (indexToFocus >= 0 && indexToFocus < this._entries.length) ? this._entries[indexToFocus] : undefined;
|
|
117
|
+
while (entry && this.isHidden(entry.id)) {
|
|
118
|
+
indexToFocus += delta;
|
|
119
|
+
entry = (indexToFocus >= 0 && indexToFocus < this._entries.length) ? this._entries[indexToFocus] : undefined;
|
|
120
|
+
}
|
|
121
|
+
return entry;
|
|
122
|
+
};
|
|
123
|
+
const focused = this.getFocusedEntry();
|
|
124
|
+
if (focused) {
|
|
125
|
+
const entry = getVisibleEntry(this._entries.indexOf(focused) + delta);
|
|
126
|
+
if (entry) {
|
|
127
|
+
this._lastFocusedEntry = entry;
|
|
128
|
+
entry.labelContainer.focus();
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const entry = getVisibleEntry(restartPosition);
|
|
133
|
+
if (entry) {
|
|
134
|
+
this._lastFocusedEntry = entry;
|
|
135
|
+
entry.labelContainer.focus();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
updateVisibility(arg1, trigger) {
|
|
139
|
+
if (typeof arg1 === 'string') {
|
|
140
|
+
const id = arg1;
|
|
141
|
+
for (const entry of this._entries) {
|
|
142
|
+
if (entry.id === id) {
|
|
143
|
+
this.updateVisibility(entry, trigger);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
const entry = arg1;
|
|
149
|
+
const isHidden = this.isHidden(entry.id);
|
|
150
|
+
if (isHidden) {
|
|
151
|
+
hide(entry.container);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
show(entry.container);
|
|
155
|
+
}
|
|
156
|
+
if (trigger) {
|
|
157
|
+
this._onDidChangeEntryVisibility.fire({ id: entry.id, visible: !isHidden });
|
|
158
|
+
}
|
|
159
|
+
this.markFirstLastVisibleEntry();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
saveState() {
|
|
163
|
+
if (this.hidden.size > 0) {
|
|
164
|
+
this.storageService.store(StatusbarViewModel.HIDDEN_ENTRIES_KEY, JSON.stringify(Array.from(( this.hidden.values()))), 0 , 0 );
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
this.storageService.remove(StatusbarViewModel.HIDDEN_ENTRIES_KEY, 0 );
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
sort() {
|
|
171
|
+
const mapEntryWithNumberedPriorityToIndex = ( new Map());
|
|
172
|
+
const mapEntryWithRelativePriority = ( new Map());
|
|
173
|
+
for (let i = 0; i < this._entries.length; i++) {
|
|
174
|
+
const entry = this._entries[i];
|
|
175
|
+
if (typeof entry.priority.primary === 'number') {
|
|
176
|
+
mapEntryWithNumberedPriorityToIndex.set(entry, i);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
let entries = mapEntryWithRelativePriority.get(entry.priority.primary.id);
|
|
180
|
+
if (!entries) {
|
|
181
|
+
entries = [];
|
|
182
|
+
mapEntryWithRelativePriority.set(entry.priority.primary.id, entries);
|
|
183
|
+
}
|
|
184
|
+
entries.push(entry);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
const sortedEntriesWithNumberedPriority = Array.from(( mapEntryWithNumberedPriorityToIndex.keys()));
|
|
188
|
+
sortedEntriesWithNumberedPriority.sort((entryA, entryB) => {
|
|
189
|
+
if (entryA.alignment === entryB.alignment) {
|
|
190
|
+
if (entryA.priority.primary !== entryB.priority.primary) {
|
|
191
|
+
return Number(entryB.priority.primary) - Number(entryA.priority.primary);
|
|
192
|
+
}
|
|
193
|
+
if (entryA.priority.secondary !== entryB.priority.secondary) {
|
|
194
|
+
return entryB.priority.secondary - entryA.priority.secondary;
|
|
195
|
+
}
|
|
196
|
+
return mapEntryWithNumberedPriorityToIndex.get(entryA) - mapEntryWithNumberedPriorityToIndex.get(entryB);
|
|
197
|
+
}
|
|
198
|
+
if (entryA.alignment === 0 ) {
|
|
199
|
+
return -1;
|
|
200
|
+
}
|
|
201
|
+
if (entryB.alignment === 0 ) {
|
|
202
|
+
return 1;
|
|
203
|
+
}
|
|
204
|
+
return 0;
|
|
205
|
+
});
|
|
206
|
+
let sortedEntries;
|
|
207
|
+
if (mapEntryWithRelativePriority.size > 0) {
|
|
208
|
+
sortedEntries = [];
|
|
209
|
+
for (const entry of sortedEntriesWithNumberedPriority) {
|
|
210
|
+
const relativeEntries = mapEntryWithRelativePriority.get(entry.id);
|
|
211
|
+
if (relativeEntries) {
|
|
212
|
+
sortedEntries.push(...relativeEntries.filter(entry => isStatusbarEntryLocation(entry.priority.primary) && entry.priority.primary.alignment === 0 ));
|
|
213
|
+
}
|
|
214
|
+
sortedEntries.push(entry);
|
|
215
|
+
if (relativeEntries) {
|
|
216
|
+
sortedEntries.push(...relativeEntries.filter(entry => isStatusbarEntryLocation(entry.priority.primary) && entry.priority.primary.alignment === 1 ));
|
|
217
|
+
}
|
|
218
|
+
mapEntryWithRelativePriority.delete(entry.id);
|
|
219
|
+
}
|
|
220
|
+
for (const [, entries] of mapEntryWithRelativePriority) {
|
|
221
|
+
sortedEntries.push(...entries);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
sortedEntries = sortedEntriesWithNumberedPriority;
|
|
226
|
+
}
|
|
227
|
+
this._entries = sortedEntries;
|
|
228
|
+
}
|
|
229
|
+
markFirstLastVisibleEntry() {
|
|
230
|
+
this.doMarkFirstLastVisibleStatusbarItem(this.getEntries(0 ));
|
|
231
|
+
this.doMarkFirstLastVisibleStatusbarItem(this.getEntries(1 ));
|
|
232
|
+
}
|
|
233
|
+
doMarkFirstLastVisibleStatusbarItem(entries) {
|
|
234
|
+
let firstVisibleItem;
|
|
235
|
+
let lastVisibleItem;
|
|
236
|
+
for (const entry of entries) {
|
|
237
|
+
entry.container.classList.remove('first-visible-item', 'last-visible-item');
|
|
238
|
+
const isVisible = !this.isHidden(entry.id);
|
|
239
|
+
if (isVisible) {
|
|
240
|
+
if (!firstVisibleItem) {
|
|
241
|
+
firstVisibleItem = entry;
|
|
242
|
+
}
|
|
243
|
+
lastVisibleItem = entry;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
firstVisibleItem?.container.classList.add('first-visible-item');
|
|
247
|
+
lastVisibleItem?.container.classList.add('last-visible-item');
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export { StatusbarViewModel };
|
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import './media/statusbarpart.css.js';
|
|
3
|
+
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
4
|
+
import { MutableDisposable, dispose, DisposableStore, disposeIfDisposable, toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
5
|
+
import { Part } from 'vscode/vscode/vs/workbench/browser/part';
|
|
6
|
+
import { Gesture, EventType as EventType$1 } from 'monaco-editor/esm/vs/base/browser/touch.js';
|
|
7
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
8
|
+
import { isStatusbarEntryPriority, isStatusbarEntryLocation } from 'vscode/vscode/vs/workbench/services/statusbar/browser/statusbar';
|
|
9
|
+
import { IContextMenuService } from 'monaco-editor/esm/vs/platform/contextview/browser/contextView.js';
|
|
10
|
+
import { toAction, Separator } from 'monaco-editor/esm/vs/base/common/actions.js';
|
|
11
|
+
import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
12
|
+
import { STATUS_BAR_ITEM_HOVER_BACKGROUND, STATUS_BAR_ITEM_COMPACT_HOVER_BACKGROUND, STATUS_BAR_BACKGROUND, STATUS_BAR_NO_FOLDER_BACKGROUND, STATUS_BAR_FOREGROUND, STATUS_BAR_NO_FOLDER_FOREGROUND, STATUS_BAR_ITEM_FOCUS_BORDER, STATUS_BAR_BORDER, STATUS_BAR_NO_FOLDER_BORDER, STATUS_BAR_FOCUS_BORDER } from 'vscode/vscode/vs/workbench/common/theme';
|
|
13
|
+
import { IWorkspaceContextService } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
|
|
14
|
+
import { contrastBorder, activeContrastBorder } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
|
|
15
|
+
import { addDisposableListener, EventType, clearNode, EventHelper, createStyleSheet } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
16
|
+
import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
|
|
17
|
+
import { IWorkbenchLayoutService } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService';
|
|
18
|
+
import { equals } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
19
|
+
import { StandardMouseEvent } from 'monaco-editor/esm/vs/base/browser/mouseEvent.js';
|
|
20
|
+
import { ToggleStatusbarVisibilityAction } from 'vscode/vscode/vs/workbench/browser/actions/layoutActions';
|
|
21
|
+
import { assertIsDefined } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
22
|
+
import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
23
|
+
import { isHighContrast } from 'monaco-editor/esm/vs/platform/theme/common/theme.js';
|
|
24
|
+
import { hash } from 'monaco-editor/esm/vs/base/common/hash.js';
|
|
25
|
+
import { IHoverService } from 'vscode/vscode/vs/workbench/services/hover/browser/hover';
|
|
26
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
27
|
+
import { ToggleStatusbarEntryVisibilityAction, HideStatusbarEntryAction } from './statusbarActions.js';
|
|
28
|
+
import { StatusbarViewModel } from './statusbarModel.js';
|
|
29
|
+
import { StatusbarEntryItem } from './statusbarItem.js';
|
|
30
|
+
import { StatusBarFocused } from 'vscode/vscode/vs/workbench/common/contextkeys';
|
|
31
|
+
|
|
32
|
+
let StatusbarPart = class StatusbarPart extends Part {
|
|
33
|
+
constructor(instantiationService, themeService, contextService, storageService, layoutService, contextMenuService, contextKeyService, hoverService, configurationService) {
|
|
34
|
+
super("workbench.parts.statusbar" , { hasTitle: false }, themeService, storageService, layoutService);
|
|
35
|
+
this.instantiationService = instantiationService;
|
|
36
|
+
this.contextService = contextService;
|
|
37
|
+
this.storageService = storageService;
|
|
38
|
+
this.contextMenuService = contextMenuService;
|
|
39
|
+
this.contextKeyService = contextKeyService;
|
|
40
|
+
this.hoverService = hoverService;
|
|
41
|
+
this.configurationService = configurationService;
|
|
42
|
+
this.minimumWidth = 0;
|
|
43
|
+
this.maximumWidth = Number.POSITIVE_INFINITY;
|
|
44
|
+
this.minimumHeight = 22;
|
|
45
|
+
this.maximumHeight = 22;
|
|
46
|
+
this.pendingEntries = [];
|
|
47
|
+
this.viewModel = this._register(( new StatusbarViewModel(this.storageService)));
|
|
48
|
+
this.onDidChangeEntryVisibility = this.viewModel.onDidChangeEntryVisibility;
|
|
49
|
+
this.hoverDelegate = new (class {
|
|
50
|
+
get delay() {
|
|
51
|
+
if (Date.now() - this.lastHoverHideTime < 200) {
|
|
52
|
+
return 0;
|
|
53
|
+
}
|
|
54
|
+
return this.configurationService.getValue('workbench.hover.delay');
|
|
55
|
+
}
|
|
56
|
+
constructor(configurationService, hoverService) {
|
|
57
|
+
this.configurationService = configurationService;
|
|
58
|
+
this.hoverService = hoverService;
|
|
59
|
+
this.lastHoverHideTime = 0;
|
|
60
|
+
this.placement = 'element';
|
|
61
|
+
}
|
|
62
|
+
showHover(options, focus) {
|
|
63
|
+
return this.hoverService.showHover({
|
|
64
|
+
...options,
|
|
65
|
+
hideOnKeyDown: true
|
|
66
|
+
}, focus);
|
|
67
|
+
}
|
|
68
|
+
onDidHideHover() {
|
|
69
|
+
this.lastHoverHideTime = Date.now();
|
|
70
|
+
}
|
|
71
|
+
})(this.configurationService, this.hoverService);
|
|
72
|
+
this.compactEntriesDisposable = this._register(( new MutableDisposable()));
|
|
73
|
+
this.styleOverrides = ( new Set());
|
|
74
|
+
this.registerListeners();
|
|
75
|
+
}
|
|
76
|
+
registerListeners() {
|
|
77
|
+
this._register(this.onDidChangeEntryVisibility(() => this.updateCompactEntries()));
|
|
78
|
+
this._register(this.contextService.onDidChangeWorkbenchState(() => this.updateStyles()));
|
|
79
|
+
}
|
|
80
|
+
addEntry(entry, id, alignment, priorityOrLocation = 0) {
|
|
81
|
+
let priority;
|
|
82
|
+
if (isStatusbarEntryPriority(priorityOrLocation)) {
|
|
83
|
+
priority = priorityOrLocation;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
priority = {
|
|
87
|
+
primary: priorityOrLocation,
|
|
88
|
+
secondary: hash(id)
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
if (!this.element) {
|
|
92
|
+
return this.doAddPendingEntry(entry, id, alignment, priority);
|
|
93
|
+
}
|
|
94
|
+
return this.doAddEntry(entry, id, alignment, priority);
|
|
95
|
+
}
|
|
96
|
+
doAddPendingEntry(entry, id, alignment, priority) {
|
|
97
|
+
const pendingEntry = { entry, id, alignment, priority };
|
|
98
|
+
this.pendingEntries.push(pendingEntry);
|
|
99
|
+
const accessor = {
|
|
100
|
+
update: (entry) => {
|
|
101
|
+
if (pendingEntry.accessor) {
|
|
102
|
+
pendingEntry.accessor.update(entry);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
pendingEntry.entry = entry;
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
dispose: () => {
|
|
109
|
+
if (pendingEntry.accessor) {
|
|
110
|
+
pendingEntry.accessor.dispose();
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
this.pendingEntries = this.pendingEntries.filter(entry => entry !== pendingEntry);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
return accessor;
|
|
118
|
+
}
|
|
119
|
+
doAddEntry(entry, id, alignment, priority) {
|
|
120
|
+
const itemContainer = this.doCreateStatusItem(id, alignment);
|
|
121
|
+
const item = this.instantiationService.createInstance(StatusbarEntryItem, itemContainer, entry, this.hoverDelegate);
|
|
122
|
+
const viewModelEntry = new class {
|
|
123
|
+
constructor() {
|
|
124
|
+
this.id = id;
|
|
125
|
+
this.alignment = alignment;
|
|
126
|
+
this.priority = priority;
|
|
127
|
+
this.container = itemContainer;
|
|
128
|
+
this.labelContainer = item.labelContainer;
|
|
129
|
+
}
|
|
130
|
+
get name() { return item.name; }
|
|
131
|
+
get hasCommand() { return item.hasCommand; }
|
|
132
|
+
};
|
|
133
|
+
const { needsFullRefresh } = this.doAddOrRemoveModelEntry(viewModelEntry, true);
|
|
134
|
+
if (needsFullRefresh) {
|
|
135
|
+
this.appendStatusbarEntries();
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
this.appendStatusbarEntry(viewModelEntry);
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
update: entry => {
|
|
142
|
+
item.update(entry);
|
|
143
|
+
},
|
|
144
|
+
dispose: () => {
|
|
145
|
+
const { needsFullRefresh } = this.doAddOrRemoveModelEntry(viewModelEntry, false);
|
|
146
|
+
if (needsFullRefresh) {
|
|
147
|
+
this.appendStatusbarEntries();
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
itemContainer.remove();
|
|
151
|
+
}
|
|
152
|
+
dispose(item);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
doCreateStatusItem(id, alignment, ...extraClasses) {
|
|
157
|
+
const itemContainer = document.createElement('div');
|
|
158
|
+
itemContainer.id = id;
|
|
159
|
+
itemContainer.classList.add('statusbar-item');
|
|
160
|
+
if (extraClasses) {
|
|
161
|
+
itemContainer.classList.add(...extraClasses);
|
|
162
|
+
}
|
|
163
|
+
if (alignment === 1 ) {
|
|
164
|
+
itemContainer.classList.add('right');
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
itemContainer.classList.add('left');
|
|
168
|
+
}
|
|
169
|
+
return itemContainer;
|
|
170
|
+
}
|
|
171
|
+
doAddOrRemoveModelEntry(entry, add) {
|
|
172
|
+
const entriesBefore = this.viewModel.entries;
|
|
173
|
+
if (add) {
|
|
174
|
+
this.viewModel.add(entry);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
this.viewModel.remove(entry);
|
|
178
|
+
}
|
|
179
|
+
const entriesAfter = this.viewModel.entries;
|
|
180
|
+
if (add) {
|
|
181
|
+
entriesBefore.splice(entriesAfter.indexOf(entry), 0, entry);
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
entriesBefore.splice(entriesBefore.indexOf(entry), 1);
|
|
185
|
+
}
|
|
186
|
+
const needsFullRefresh = !equals(entriesBefore, entriesAfter);
|
|
187
|
+
return { needsFullRefresh };
|
|
188
|
+
}
|
|
189
|
+
isEntryVisible(id) {
|
|
190
|
+
return !this.viewModel.isHidden(id);
|
|
191
|
+
}
|
|
192
|
+
updateEntryVisibility(id, visible) {
|
|
193
|
+
if (visible) {
|
|
194
|
+
this.viewModel.show(id);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
this.viewModel.hide(id);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
focusNextEntry() {
|
|
201
|
+
this.viewModel.focusNextEntry();
|
|
202
|
+
}
|
|
203
|
+
focusPreviousEntry() {
|
|
204
|
+
this.viewModel.focusPreviousEntry();
|
|
205
|
+
}
|
|
206
|
+
isEntryFocused() {
|
|
207
|
+
return this.viewModel.isEntryFocused();
|
|
208
|
+
}
|
|
209
|
+
focus(preserveEntryFocus = true) {
|
|
210
|
+
this.getContainer()?.focus();
|
|
211
|
+
const lastFocusedEntry = this.viewModel.lastFocusedEntry;
|
|
212
|
+
if (preserveEntryFocus && lastFocusedEntry) {
|
|
213
|
+
setTimeout(() => lastFocusedEntry.labelContainer.focus(), 0);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
createContentArea(parent) {
|
|
217
|
+
this.element = parent;
|
|
218
|
+
const scopedContextKeyService = this.contextKeyService.createScoped(this.element);
|
|
219
|
+
StatusBarFocused.bindTo(scopedContextKeyService).set(true);
|
|
220
|
+
this.leftItemsContainer = document.createElement('div');
|
|
221
|
+
this.leftItemsContainer.classList.add('left-items', 'items-container');
|
|
222
|
+
this.element.appendChild(this.leftItemsContainer);
|
|
223
|
+
this.element.tabIndex = 0;
|
|
224
|
+
this.rightItemsContainer = document.createElement('div');
|
|
225
|
+
this.rightItemsContainer.classList.add('right-items', 'items-container');
|
|
226
|
+
this.element.appendChild(this.rightItemsContainer);
|
|
227
|
+
this._register(addDisposableListener(parent, EventType.CONTEXT_MENU, e => this.showContextMenu(e)));
|
|
228
|
+
this._register(Gesture.addTarget(parent));
|
|
229
|
+
this._register(addDisposableListener(parent, EventType$1.Contextmenu, e => this.showContextMenu(e)));
|
|
230
|
+
this.createInitialStatusbarEntries();
|
|
231
|
+
return this.element;
|
|
232
|
+
}
|
|
233
|
+
createInitialStatusbarEntries() {
|
|
234
|
+
this.appendStatusbarEntries();
|
|
235
|
+
while (this.pendingEntries.length) {
|
|
236
|
+
const pending = this.pendingEntries.shift();
|
|
237
|
+
if (pending) {
|
|
238
|
+
pending.accessor = this.addEntry(pending.entry, pending.id, pending.alignment, pending.priority.primary);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
appendStatusbarEntries() {
|
|
243
|
+
const leftItemsContainer = assertIsDefined(this.leftItemsContainer);
|
|
244
|
+
const rightItemsContainer = assertIsDefined(this.rightItemsContainer);
|
|
245
|
+
clearNode(leftItemsContainer);
|
|
246
|
+
clearNode(rightItemsContainer);
|
|
247
|
+
for (const entry of [
|
|
248
|
+
...this.viewModel.getEntries(0 ),
|
|
249
|
+
...this.viewModel.getEntries(1 ).reverse()
|
|
250
|
+
]) {
|
|
251
|
+
const target = entry.alignment === 0 ? leftItemsContainer : rightItemsContainer;
|
|
252
|
+
target.appendChild(entry.container);
|
|
253
|
+
}
|
|
254
|
+
this.updateCompactEntries();
|
|
255
|
+
}
|
|
256
|
+
appendStatusbarEntry(entry) {
|
|
257
|
+
const entries = this.viewModel.getEntries(entry.alignment);
|
|
258
|
+
if (entry.alignment === 1 ) {
|
|
259
|
+
entries.reverse();
|
|
260
|
+
}
|
|
261
|
+
const target = assertIsDefined(entry.alignment === 0 ? this.leftItemsContainer : this.rightItemsContainer);
|
|
262
|
+
const index = entries.indexOf(entry);
|
|
263
|
+
if (index + 1 === entries.length) {
|
|
264
|
+
target.appendChild(entry.container);
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
target.insertBefore(entry.container, entries[index + 1].container);
|
|
268
|
+
}
|
|
269
|
+
this.updateCompactEntries();
|
|
270
|
+
}
|
|
271
|
+
updateCompactEntries() {
|
|
272
|
+
const entries = this.viewModel.entries;
|
|
273
|
+
const mapIdToVisibleEntry = ( new Map());
|
|
274
|
+
for (const entry of entries) {
|
|
275
|
+
if (!this.viewModel.isHidden(entry.id)) {
|
|
276
|
+
mapIdToVisibleEntry.set(entry.id, entry);
|
|
277
|
+
}
|
|
278
|
+
entry.container.classList.remove('compact-left', 'compact-right');
|
|
279
|
+
}
|
|
280
|
+
const compactEntryGroups = ( new Map());
|
|
281
|
+
for (const entry of ( mapIdToVisibleEntry.values())) {
|
|
282
|
+
if (isStatusbarEntryLocation(entry.priority.primary) &&
|
|
283
|
+
entry.priority.primary.compact
|
|
284
|
+
) {
|
|
285
|
+
const locationId = entry.priority.primary.id;
|
|
286
|
+
const location = mapIdToVisibleEntry.get(locationId);
|
|
287
|
+
if (!location) {
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
let compactEntryGroup = compactEntryGroups.get(locationId);
|
|
291
|
+
if (!compactEntryGroup) {
|
|
292
|
+
compactEntryGroup = ( new Set([entry, location]));
|
|
293
|
+
compactEntryGroups.set(locationId, compactEntryGroup);
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
compactEntryGroup.add(entry);
|
|
297
|
+
}
|
|
298
|
+
if (entry.priority.primary.alignment === 0 ) {
|
|
299
|
+
location.container.classList.add('compact-left');
|
|
300
|
+
entry.container.classList.add('compact-right');
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
location.container.classList.add('compact-right');
|
|
304
|
+
entry.container.classList.add('compact-left');
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
const statusBarItemHoverBackground = this.getColor(STATUS_BAR_ITEM_HOVER_BACKGROUND);
|
|
309
|
+
const statusBarItemCompactHoverBackground = this.getColor(STATUS_BAR_ITEM_COMPACT_HOVER_BACKGROUND);
|
|
310
|
+
this.compactEntriesDisposable.value = ( new DisposableStore());
|
|
311
|
+
if (statusBarItemHoverBackground && statusBarItemCompactHoverBackground && !isHighContrast(this.theme.type)) {
|
|
312
|
+
for (const [, compactEntryGroup] of compactEntryGroups) {
|
|
313
|
+
for (const compactEntry of compactEntryGroup) {
|
|
314
|
+
if (!compactEntry.hasCommand) {
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
317
|
+
this.compactEntriesDisposable.value.add(addDisposableListener(compactEntry.labelContainer, EventType.MOUSE_OVER, () => {
|
|
318
|
+
compactEntryGroup.forEach(compactEntry => compactEntry.labelContainer.style.backgroundColor = statusBarItemHoverBackground);
|
|
319
|
+
compactEntry.labelContainer.style.backgroundColor = statusBarItemCompactHoverBackground;
|
|
320
|
+
}));
|
|
321
|
+
this.compactEntriesDisposable.value.add(addDisposableListener(compactEntry.labelContainer, EventType.MOUSE_OUT, () => {
|
|
322
|
+
compactEntryGroup.forEach(compactEntry => compactEntry.labelContainer.style.backgroundColor = '');
|
|
323
|
+
}));
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
showContextMenu(e) {
|
|
329
|
+
EventHelper.stop(e, true);
|
|
330
|
+
const event = ( new StandardMouseEvent(e));
|
|
331
|
+
let actions = undefined;
|
|
332
|
+
this.contextMenuService.showContextMenu({
|
|
333
|
+
getAnchor: () => event,
|
|
334
|
+
getActions: () => {
|
|
335
|
+
actions = this.getContextMenuActions(event);
|
|
336
|
+
return actions;
|
|
337
|
+
},
|
|
338
|
+
onHide: () => {
|
|
339
|
+
if (actions) {
|
|
340
|
+
disposeIfDisposable(actions);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
getContextMenuActions(event) {
|
|
346
|
+
const actions = [];
|
|
347
|
+
actions.push(toAction({ id: ToggleStatusbarVisibilityAction.ID, label: ( localize('hideStatusBar', "Hide Status Bar")), run: () => this.instantiationService.invokeFunction(accessor => ( new ToggleStatusbarVisibilityAction()).run(accessor)) }));
|
|
348
|
+
actions.push(( new Separator()));
|
|
349
|
+
const handledEntries = ( new Set());
|
|
350
|
+
for (const entry of this.viewModel.entries) {
|
|
351
|
+
if (!( handledEntries.has(entry.id))) {
|
|
352
|
+
actions.push(( new ToggleStatusbarEntryVisibilityAction(entry.id, entry.name, this.viewModel)));
|
|
353
|
+
handledEntries.add(entry.id);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
let statusEntryUnderMouse = undefined;
|
|
357
|
+
for (let element = event.target; element; element = element.parentElement) {
|
|
358
|
+
const entry = this.viewModel.findEntry(element);
|
|
359
|
+
if (entry) {
|
|
360
|
+
statusEntryUnderMouse = entry;
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
if (statusEntryUnderMouse) {
|
|
365
|
+
actions.push(( new Separator()));
|
|
366
|
+
actions.push(( new HideStatusbarEntryAction(statusEntryUnderMouse.id, statusEntryUnderMouse.name, this.viewModel)));
|
|
367
|
+
}
|
|
368
|
+
return actions;
|
|
369
|
+
}
|
|
370
|
+
updateStyles() {
|
|
371
|
+
super.updateStyles();
|
|
372
|
+
const container = assertIsDefined(this.getContainer());
|
|
373
|
+
const styleOverride = [...this.styleOverrides].sort((a, b) => a.priority - b.priority)[0];
|
|
374
|
+
const backgroundColor = this.getColor(styleOverride?.background ?? (this.contextService.getWorkbenchState() !== 1 ? STATUS_BAR_BACKGROUND : STATUS_BAR_NO_FOLDER_BACKGROUND)) || '';
|
|
375
|
+
container.style.backgroundColor = backgroundColor;
|
|
376
|
+
const foregroundColor = this.getColor(styleOverride?.foreground ?? (this.contextService.getWorkbenchState() !== 1 ? STATUS_BAR_FOREGROUND : STATUS_BAR_NO_FOLDER_FOREGROUND)) || '';
|
|
377
|
+
container.style.color = foregroundColor;
|
|
378
|
+
const itemBorderColor = this.getColor(STATUS_BAR_ITEM_FOCUS_BORDER);
|
|
379
|
+
const borderColor = this.getColor(styleOverride?.border ?? (this.contextService.getWorkbenchState() !== 1 ? STATUS_BAR_BORDER : STATUS_BAR_NO_FOLDER_BORDER)) || this.getColor(contrastBorder);
|
|
380
|
+
if (borderColor) {
|
|
381
|
+
container.classList.add('status-border-top');
|
|
382
|
+
container.style.setProperty('--status-border-top-color', borderColor);
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
container.classList.remove('status-border-top');
|
|
386
|
+
container.style.removeProperty('--status-border-top-color');
|
|
387
|
+
}
|
|
388
|
+
const statusBarFocusColor = this.getColor(STATUS_BAR_FOCUS_BORDER);
|
|
389
|
+
if (!this.styleElement) {
|
|
390
|
+
this.styleElement = createStyleSheet(container);
|
|
391
|
+
}
|
|
392
|
+
this.styleElement.textContent = `
|
|
393
|
+
|
|
394
|
+
/* Status bar focus outline */
|
|
395
|
+
.monaco-workbench .part.statusbar:focus {
|
|
396
|
+
outline-color: ${statusBarFocusColor};
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/* Status bar item focus outline */
|
|
400
|
+
.monaco-workbench .part.statusbar > .items-container > .statusbar-item a:focus-visible:not(.disabled) {
|
|
401
|
+
outline: 1px solid ${this.getColor(activeContrastBorder) ?? itemBorderColor};
|
|
402
|
+
outline-offset: ${borderColor ? '-2px' : '-1px'};
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/* Notification Beak */
|
|
406
|
+
.monaco-workbench .part.statusbar > .items-container > .statusbar-item.has-beak > .status-bar-item-beak-container:before {
|
|
407
|
+
border-bottom-color: ${backgroundColor};
|
|
408
|
+
}
|
|
409
|
+
`;
|
|
410
|
+
}
|
|
411
|
+
layout(width, height, top, left) {
|
|
412
|
+
super.layout(width, height, top, left);
|
|
413
|
+
super.layoutContents(width, height);
|
|
414
|
+
}
|
|
415
|
+
overrideStyle(style) {
|
|
416
|
+
this.styleOverrides.add(style);
|
|
417
|
+
this.updateStyles();
|
|
418
|
+
return toDisposable(() => {
|
|
419
|
+
this.styleOverrides.delete(style);
|
|
420
|
+
this.updateStyles();
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
toJSON() {
|
|
424
|
+
return {
|
|
425
|
+
type: "workbench.parts.statusbar"
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
StatusbarPart = ( __decorate([
|
|
430
|
+
( __param(0, IInstantiationService)),
|
|
431
|
+
( __param(1, IThemeService)),
|
|
432
|
+
( __param(2, IWorkspaceContextService)),
|
|
433
|
+
( __param(3, IStorageService)),
|
|
434
|
+
( __param(4, IWorkbenchLayoutService)),
|
|
435
|
+
( __param(5, IContextMenuService)),
|
|
436
|
+
( __param(6, IContextKeyService)),
|
|
437
|
+
( __param(7, IHoverService)),
|
|
438
|
+
( __param(8, IConfigurationService))
|
|
439
|
+
], StatusbarPart));
|
|
440
|
+
|
|
441
|
+
export { StatusbarPart };
|