@codingame/monaco-vscode-view-status-bar-service-override 3.2.3 → 4.1.0
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/package.json +2 -2
- package/viewStatusBar.js +1 -1
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
- package/vscode/src/vs/workbench/browser/parts/statusbar/media/statusbarpart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/statusbar/statusbarActions.js +0 -121
- package/vscode/src/vs/workbench/browser/parts/statusbar/statusbarItem.js +0 -252
- package/vscode/src/vs/workbench/browser/parts/statusbar/statusbarModel.js +0 -251
- package/vscode/src/vs/workbench/browser/parts/statusbar/statusbarPart.js +0 -571
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-view-status-bar-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -18,6 +18,6 @@
|
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@4.1.0"
|
|
22
22
|
}
|
|
23
23
|
}
|
package/viewStatusBar.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __param } from './external/tslib/tslib.es6.js';
|
|
2
2
|
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
3
3
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
4
|
-
import { StatusbarService } from '
|
|
4
|
+
import { StatusbarService } from 'vscode/vscode/vs/workbench/browser/parts/statusbar/statusbarPart';
|
|
5
5
|
import { IStatusbarService } from 'vscode/vscode/vs/workbench/services/statusbar/browser/statusbar';
|
|
6
6
|
import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
7
7
|
import { StatusBarItemsExtensionPoint, IExtensionStatusBarItemService, ExtensionStatusBarItemService } from 'vscode/vscode/vs/workbench/api/browser/statusBarExtensionPoint';
|
|
@@ -1,3 +0,0 @@
|
|
|
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 };
|
|
@@ -1,6 +0,0 @@
|
|
|
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 };
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
2
|
-
import { IStatusbarService } from 'vscode/vscode/vs/workbench/services/statusbar/browser/statusbar';
|
|
3
|
-
import { Action } from 'vscode/vscode/vs/base/common/actions';
|
|
4
|
-
import { IWorkbenchLayoutService } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService';
|
|
5
|
-
import { KeybindingsRegistry } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
|
|
6
|
-
import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
7
|
-
import { Categories } from 'vscode/vscode/vs/platform/action/common/actionCommonCategories';
|
|
8
|
-
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
9
|
-
import { StatusBarFocused } from 'vscode/vscode/vs/workbench/common/contextkeys';
|
|
10
|
-
import { getActiveWindow } from 'vscode/vscode/vs/base/browser/dom';
|
|
11
|
-
|
|
12
|
-
class ToggleStatusbarEntryVisibilityAction extends Action {
|
|
13
|
-
constructor(id, label, model) {
|
|
14
|
-
super(id, label, undefined, true);
|
|
15
|
-
this.model = model;
|
|
16
|
-
this.checked = !model.isHidden(id);
|
|
17
|
-
}
|
|
18
|
-
async run() {
|
|
19
|
-
if (this.model.isHidden(this.id)) {
|
|
20
|
-
this.model.show(this.id);
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
this.model.hide(this.id);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
class HideStatusbarEntryAction extends Action {
|
|
28
|
-
constructor(id, name, model) {
|
|
29
|
-
super(id, ( localizeWithPath(
|
|
30
|
-
'vs/workbench/browser/parts/statusbar/statusbarActions',
|
|
31
|
-
'hide',
|
|
32
|
-
"Hide '{0}'",
|
|
33
|
-
name
|
|
34
|
-
)), undefined, true);
|
|
35
|
-
this.model = model;
|
|
36
|
-
}
|
|
37
|
-
async run() {
|
|
38
|
-
this.model.hide(this.id);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
42
|
-
id: 'workbench.statusBar.focusPrevious',
|
|
43
|
-
weight: 200 ,
|
|
44
|
-
primary: 15 ,
|
|
45
|
-
secondary: [16 ],
|
|
46
|
-
when: StatusBarFocused,
|
|
47
|
-
handler: (accessor) => {
|
|
48
|
-
const statusBarService = accessor.get(IStatusbarService);
|
|
49
|
-
statusBarService.focusPreviousEntry();
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
53
|
-
id: 'workbench.statusBar.focusNext',
|
|
54
|
-
weight: 200 ,
|
|
55
|
-
primary: 17 ,
|
|
56
|
-
secondary: [18 ],
|
|
57
|
-
when: StatusBarFocused,
|
|
58
|
-
handler: (accessor) => {
|
|
59
|
-
const statusBarService = accessor.get(IStatusbarService);
|
|
60
|
-
statusBarService.focusNextEntry();
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
64
|
-
id: 'workbench.statusBar.focusFirst',
|
|
65
|
-
weight: 200 ,
|
|
66
|
-
primary: 14 ,
|
|
67
|
-
when: StatusBarFocused,
|
|
68
|
-
handler: (accessor) => {
|
|
69
|
-
const statusBarService = accessor.get(IStatusbarService);
|
|
70
|
-
statusBarService.focus(false);
|
|
71
|
-
statusBarService.focusNextEntry();
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
75
|
-
id: 'workbench.statusBar.focusLast',
|
|
76
|
-
weight: 200 ,
|
|
77
|
-
primary: 13 ,
|
|
78
|
-
when: StatusBarFocused,
|
|
79
|
-
handler: (accessor) => {
|
|
80
|
-
const statusBarService = accessor.get(IStatusbarService);
|
|
81
|
-
statusBarService.focus(false);
|
|
82
|
-
statusBarService.focusPreviousEntry();
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
86
|
-
id: 'workbench.statusBar.clearFocus',
|
|
87
|
-
weight: 200 ,
|
|
88
|
-
primary: 9 ,
|
|
89
|
-
when: StatusBarFocused,
|
|
90
|
-
handler: (accessor) => {
|
|
91
|
-
const statusBarService = accessor.get(IStatusbarService);
|
|
92
|
-
const editorService = accessor.get(IEditorService);
|
|
93
|
-
if (statusBarService.isEntryFocused()) {
|
|
94
|
-
statusBarService.focus(false);
|
|
95
|
-
}
|
|
96
|
-
else if (editorService.activeEditorPane) {
|
|
97
|
-
editorService.activeEditorPane.focus();
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
class FocusStatusBarAction extends Action2 {
|
|
102
|
-
constructor() {
|
|
103
|
-
super({
|
|
104
|
-
id: 'workbench.action.focusStatusBar',
|
|
105
|
-
title: ( localize2WithPath(
|
|
106
|
-
'vs/workbench/browser/parts/statusbar/statusbarActions',
|
|
107
|
-
'focusStatusBar',
|
|
108
|
-
'Focus Status Bar'
|
|
109
|
-
)),
|
|
110
|
-
category: Categories.View,
|
|
111
|
-
f1: true
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
async run(accessor) {
|
|
115
|
-
const layoutService = accessor.get(IWorkbenchLayoutService);
|
|
116
|
-
layoutService.focusPart("workbench.parts.statusbar" , getActiveWindow());
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
registerAction2(FocusStatusBarAction);
|
|
120
|
-
|
|
121
|
-
export { HideStatusbarEntryAction, ToggleStatusbarEntryVisibilityAction };
|
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { toErrorMessage } from 'vscode/vscode/vs/base/common/errorMessage';
|
|
3
|
-
import { Disposable, MutableDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
-
import { SimpleIconLabel } from 'vscode/vscode/vs/base/browser/ui/iconLabel/simpleIconLabel';
|
|
5
|
-
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
6
|
-
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
7
|
-
import { ShowTooltipCommand, StatusbarEntryKinds } from 'vscode/vscode/vs/workbench/services/statusbar/browser/statusbar';
|
|
8
|
-
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
9
|
-
import { isThemeColor } from 'vscode/vscode/vs/editor/common/editorCommon';
|
|
10
|
-
import { show, hide, addDisposableListener, EventType, EventHelper, append } from 'vscode/vscode/vs/base/browser/dom';
|
|
11
|
-
import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification';
|
|
12
|
-
import { assertIsDefined } from 'vscode/vscode/vs/base/common/types';
|
|
13
|
-
import { StandardKeyboardEvent } from 'vscode/vscode/vs/base/browser/keyboardEvent';
|
|
14
|
-
import { renderIcon, renderLabelWithIcons } from 'vscode/vscode/vs/base/browser/ui/iconLabel/iconLabels';
|
|
15
|
-
import { syncing, spinningLoading } from 'vscode/vscode/vs/platform/theme/common/iconRegistry';
|
|
16
|
-
import { setupCustomHover } from 'vscode/vscode/vs/base/browser/ui/iconLabel/iconLabelHover';
|
|
17
|
-
import { isMarkdownString, markdownStringEqual } from 'vscode/vscode/vs/base/common/htmlContent';
|
|
18
|
-
import { Gesture, EventType as EventType$1 } from 'vscode/vscode/vs/base/browser/touch';
|
|
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.focusListener = this._register(( new MutableDisposable()));
|
|
42
|
-
this.focusOutListener = this._register(( new MutableDisposable()));
|
|
43
|
-
this.hover = undefined;
|
|
44
|
-
this.labelContainer = document.createElement('a');
|
|
45
|
-
this.labelContainer.tabIndex = -1;
|
|
46
|
-
this.labelContainer.setAttribute('role', 'button');
|
|
47
|
-
this.labelContainer.className = 'statusbar-item-label';
|
|
48
|
-
this._register(Gesture.addTarget(this.labelContainer));
|
|
49
|
-
this.label = ( new StatusBarCodiconLabel(this.labelContainer));
|
|
50
|
-
this.container.appendChild(this.labelContainer);
|
|
51
|
-
this.beakContainer = document.createElement('div');
|
|
52
|
-
this.beakContainer.className = 'status-bar-item-beak-container';
|
|
53
|
-
this.container.appendChild(this.beakContainer);
|
|
54
|
-
this.update(entry);
|
|
55
|
-
}
|
|
56
|
-
update(entry) {
|
|
57
|
-
this.label.showProgress = entry.showProgress ?? false;
|
|
58
|
-
if (!this.entry || entry.text !== this.entry.text) {
|
|
59
|
-
this.label.text = entry.text;
|
|
60
|
-
if (entry.text) {
|
|
61
|
-
show(this.labelContainer);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
hide(this.labelContainer);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (!this.entry || entry.ariaLabel !== this.entry.ariaLabel) {
|
|
68
|
-
this.container.setAttribute('aria-label', entry.ariaLabel);
|
|
69
|
-
this.labelContainer.setAttribute('aria-label', entry.ariaLabel);
|
|
70
|
-
}
|
|
71
|
-
if (!this.entry || entry.role !== this.entry.role) {
|
|
72
|
-
this.labelContainer.setAttribute('role', entry.role || 'button');
|
|
73
|
-
}
|
|
74
|
-
if (!this.entry || !this.isEqualTooltip(this.entry, entry)) {
|
|
75
|
-
const hoverContents = isMarkdownString(entry.tooltip) ? { markdown: entry.tooltip, markdownNotSupportedFallback: undefined } : entry.tooltip;
|
|
76
|
-
if (this.hover) {
|
|
77
|
-
this.hover.update(hoverContents);
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
this.hover = this._register(setupCustomHover(this.hoverDelegate, this.container, hoverContents));
|
|
81
|
-
}
|
|
82
|
-
if (entry.command !== ShowTooltipCommand ) {
|
|
83
|
-
this.focusListener.value = addDisposableListener(this.labelContainer, EventType.FOCUS, e => {
|
|
84
|
-
EventHelper.stop(e);
|
|
85
|
-
this.hover?.show(false);
|
|
86
|
-
});
|
|
87
|
-
this.focusOutListener.value = addDisposableListener(this.labelContainer, EventType.FOCUS_OUT, e => {
|
|
88
|
-
EventHelper.stop(e);
|
|
89
|
-
this.hover?.hide();
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (!this.entry || entry.command !== this.entry.command) {
|
|
94
|
-
this.commandMouseListener.clear();
|
|
95
|
-
this.commandTouchListener.clear();
|
|
96
|
-
this.commandKeyboardListener.clear();
|
|
97
|
-
const command = entry.command;
|
|
98
|
-
if (command && (command !== ShowTooltipCommand || this.hover) ) {
|
|
99
|
-
this.commandMouseListener.value = addDisposableListener(this.labelContainer, EventType.CLICK, () => this.executeCommand(command));
|
|
100
|
-
this.commandTouchListener.value = addDisposableListener(this.labelContainer, EventType$1.Tap, () => this.executeCommand(command));
|
|
101
|
-
this.commandKeyboardListener.value = addDisposableListener(this.labelContainer, EventType.KEY_DOWN, e => {
|
|
102
|
-
const event = ( new StandardKeyboardEvent(e));
|
|
103
|
-
if (event.equals(10 ) || event.equals(3 )) {
|
|
104
|
-
EventHelper.stop(e);
|
|
105
|
-
this.executeCommand(command);
|
|
106
|
-
}
|
|
107
|
-
else if (event.equals(9 ) || event.equals(15 ) || event.equals(17 )) {
|
|
108
|
-
EventHelper.stop(e);
|
|
109
|
-
this.hover?.hide();
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
this.labelContainer.classList.remove('disabled');
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
this.labelContainer.classList.add('disabled');
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
if (!this.entry || entry.showBeak !== this.entry.showBeak) {
|
|
119
|
-
if (entry.showBeak) {
|
|
120
|
-
this.container.classList.add('has-beak');
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
this.container.classList.remove('has-beak');
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
const hasBackgroundColor = !!entry.backgroundColor || (entry.kind && entry.kind !== 'standard');
|
|
127
|
-
if (!this.entry || entry.kind !== this.entry.kind) {
|
|
128
|
-
for (const kind of StatusbarEntryKinds) {
|
|
129
|
-
this.container.classList.remove(`${kind}-kind`);
|
|
130
|
-
}
|
|
131
|
-
if (entry.kind && entry.kind !== 'standard') {
|
|
132
|
-
this.container.classList.add(`${entry.kind}-kind`);
|
|
133
|
-
}
|
|
134
|
-
this.container.classList.toggle('has-background-color', hasBackgroundColor);
|
|
135
|
-
}
|
|
136
|
-
if (!this.entry || entry.color !== this.entry.color) {
|
|
137
|
-
this.applyColor(this.labelContainer, entry.color);
|
|
138
|
-
}
|
|
139
|
-
if (!this.entry || entry.backgroundColor !== this.entry.backgroundColor) {
|
|
140
|
-
this.container.classList.toggle('has-background-color', hasBackgroundColor);
|
|
141
|
-
this.applyColor(this.container, entry.backgroundColor, true);
|
|
142
|
-
}
|
|
143
|
-
this.entry = entry;
|
|
144
|
-
}
|
|
145
|
-
isEqualTooltip({ tooltip }, { tooltip: otherTooltip }) {
|
|
146
|
-
if (tooltip === undefined) {
|
|
147
|
-
return otherTooltip === undefined;
|
|
148
|
-
}
|
|
149
|
-
if (isMarkdownString(tooltip)) {
|
|
150
|
-
return isMarkdownString(otherTooltip) && markdownStringEqual(tooltip, otherTooltip);
|
|
151
|
-
}
|
|
152
|
-
return tooltip === otherTooltip;
|
|
153
|
-
}
|
|
154
|
-
async executeCommand(command) {
|
|
155
|
-
if (command === ShowTooltipCommand) {
|
|
156
|
-
this.hover?.show(true );
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
const id = typeof command === 'string' ? command : command.id;
|
|
160
|
-
const args = typeof command === 'string' ? [] : command.arguments ?? [];
|
|
161
|
-
this.telemetryService.publicLog2('workbenchActionExecuted', { id, from: 'status bar' });
|
|
162
|
-
try {
|
|
163
|
-
await this.commandService.executeCommand(id, ...args);
|
|
164
|
-
}
|
|
165
|
-
catch (error) {
|
|
166
|
-
this.notificationService.error(toErrorMessage(error));
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
applyColor(container, color, isBackground) {
|
|
171
|
-
let colorResult = undefined;
|
|
172
|
-
if (isBackground) {
|
|
173
|
-
this.backgroundListener.clear();
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
this.foregroundListener.clear();
|
|
177
|
-
}
|
|
178
|
-
if (color) {
|
|
179
|
-
if (isThemeColor(color)) {
|
|
180
|
-
colorResult = this.themeService.getColorTheme().getColor(color.id)?.toString();
|
|
181
|
-
const listener = this.themeService.onDidColorThemeChange(theme => {
|
|
182
|
-
const colorValue = theme.getColor(color.id)?.toString();
|
|
183
|
-
if (isBackground) {
|
|
184
|
-
container.style.backgroundColor = colorValue ?? '';
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
container.style.color = colorValue ?? '';
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
if (isBackground) {
|
|
191
|
-
this.backgroundListener.value = listener;
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
this.foregroundListener.value = listener;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
colorResult = color;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
if (isBackground) {
|
|
202
|
-
container.style.backgroundColor = colorResult ?? '';
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
container.style.color = colorResult ?? '';
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
StatusbarEntryItem = ( __decorate([
|
|
210
|
-
( __param(3, ICommandService)),
|
|
211
|
-
( __param(4, INotificationService)),
|
|
212
|
-
( __param(5, ITelemetryService)),
|
|
213
|
-
( __param(6, IThemeService))
|
|
214
|
-
], StatusbarEntryItem));
|
|
215
|
-
class StatusBarCodiconLabel extends SimpleIconLabel {
|
|
216
|
-
constructor(container) {
|
|
217
|
-
super(container);
|
|
218
|
-
this.container = container;
|
|
219
|
-
this.progressCodicon = renderIcon(syncing);
|
|
220
|
-
this.currentText = '';
|
|
221
|
-
this.currentShowProgress = false;
|
|
222
|
-
}
|
|
223
|
-
set showProgress(showProgress) {
|
|
224
|
-
if (this.currentShowProgress !== showProgress) {
|
|
225
|
-
this.currentShowProgress = showProgress;
|
|
226
|
-
this.progressCodicon = renderIcon(showProgress === 'loading' ? spinningLoading : syncing);
|
|
227
|
-
this.text = this.currentText;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
set text(text) {
|
|
231
|
-
if (this.currentShowProgress) {
|
|
232
|
-
if (this.container.firstChild !== this.progressCodicon) {
|
|
233
|
-
this.container.appendChild(this.progressCodicon);
|
|
234
|
-
}
|
|
235
|
-
for (const node of Array.from(this.container.childNodes)) {
|
|
236
|
-
if (node !== this.progressCodicon) {
|
|
237
|
-
node.remove();
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
let textContent = text ?? '';
|
|
241
|
-
if (textContent) {
|
|
242
|
-
textContent = ` ${textContent}`;
|
|
243
|
-
}
|
|
244
|
-
append(this.container, ...renderLabelWithIcons(textContent));
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
super.text = text;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
export { StatusbarEntryItem };
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
2
|
-
import { isStatusbarEntryLocation } from 'vscode/vscode/vs/workbench/services/statusbar/browser/statusbar';
|
|
3
|
-
import { isAncestorOfActiveElement, hide, show } from 'vscode/vscode/vs/base/browser/dom';
|
|
4
|
-
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
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.filter(entry => !entry.startsWith('status.workspaceTrust.'))));
|
|
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 => isAncestorOfActiveElement(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 };
|
|
@@ -1,571 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import './media/statusbarpart.css.js';
|
|
3
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
4
|
-
import { MutableDisposable, dispose, DisposableStore, disposeIfDisposable, toDisposable, Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
|
-
import { Part, MultiWindowParts } from 'vscode/vscode/vs/workbench/browser/part';
|
|
6
|
-
import { Gesture, EventType as EventType$1 } from 'vscode/vscode/vs/base/browser/touch';
|
|
7
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
8
|
-
import { isStatusbarEntryPriority, isStatusbarEntryLocation, IStatusbarService } from 'vscode/vscode/vs/workbench/services/statusbar/browser/statusbar';
|
|
9
|
-
import { IContextMenuService } from 'vscode/vscode/vs/platform/contextview/browser/contextView';
|
|
10
|
-
import { toAction, Separator } from 'vscode/vscode/vs/base/common/actions';
|
|
11
|
-
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
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 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
14
|
-
import { contrastBorder, activeContrastBorder } from 'vscode/vscode/vs/platform/theme/common/colorRegistry';
|
|
15
|
-
import { addDisposableListener, EventType, clearNode, EventHelper, getWindow, createStyleSheet } from 'vscode/vscode/vs/base/browser/dom';
|
|
16
|
-
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
17
|
-
import { IWorkbenchLayoutService } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService';
|
|
18
|
-
import { equals } from 'vscode/vscode/vs/base/common/arrays';
|
|
19
|
-
import { StandardMouseEvent } from 'vscode/vscode/vs/base/browser/mouseEvent';
|
|
20
|
-
import { ToggleStatusbarVisibilityAction } from 'vscode/vscode/vs/workbench/browser/actions/layoutActions';
|
|
21
|
-
import { assertIsDefined } from 'vscode/vscode/vs/base/common/types';
|
|
22
|
-
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
23
|
-
import { isHighContrast } from 'vscode/vscode/vs/platform/theme/common/theme';
|
|
24
|
-
import { hash } from 'vscode/vscode/vs/base/common/hash';
|
|
25
|
-
import { WorkbenchHoverDelegate } from 'vscode/vscode/vs/platform/hover/browser/hover';
|
|
26
|
-
import { ToggleStatusbarEntryVisibilityAction, HideStatusbarEntryAction } from './statusbarActions.js';
|
|
27
|
-
import { StatusbarViewModel } from './statusbarModel.js';
|
|
28
|
-
import { StatusbarEntryItem } from './statusbarItem.js';
|
|
29
|
-
import { StatusBarFocused } from 'vscode/vscode/vs/workbench/common/contextkeys';
|
|
30
|
-
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
31
|
-
|
|
32
|
-
var StatusbarPart_1, AuxiliaryStatusbarPart_1;
|
|
33
|
-
let StatusbarPart = class StatusbarPart extends Part {
|
|
34
|
-
static { StatusbarPart_1 = this; }
|
|
35
|
-
static { this.HEIGHT = 22; }
|
|
36
|
-
constructor(id, instantiationService, themeService, contextService, storageService, layoutService, contextMenuService, contextKeyService) {
|
|
37
|
-
super(id, { hasTitle: false }, themeService, storageService, layoutService);
|
|
38
|
-
this.instantiationService = instantiationService;
|
|
39
|
-
this.contextService = contextService;
|
|
40
|
-
this.storageService = storageService;
|
|
41
|
-
this.contextMenuService = contextMenuService;
|
|
42
|
-
this.contextKeyService = contextKeyService;
|
|
43
|
-
this.minimumWidth = 0;
|
|
44
|
-
this.maximumWidth = Number.POSITIVE_INFINITY;
|
|
45
|
-
this.minimumHeight = StatusbarPart_1.HEIGHT;
|
|
46
|
-
this.maximumHeight = StatusbarPart_1.HEIGHT;
|
|
47
|
-
this.pendingEntries = [];
|
|
48
|
-
this.viewModel = this._register(( new StatusbarViewModel(this.storageService)));
|
|
49
|
-
this.onDidChangeEntryVisibility = this.viewModel.onDidChangeEntryVisibility;
|
|
50
|
-
this._onWillDispose = this._register(( new Emitter()));
|
|
51
|
-
this.onWillDispose = this._onWillDispose.event;
|
|
52
|
-
this.hoverDelegate = this._register(this.instantiationService.createInstance(WorkbenchHoverDelegate, 'element', true, (_, focus) => ({
|
|
53
|
-
persistence: {
|
|
54
|
-
hideOnKeyDown: true,
|
|
55
|
-
sticky: focus
|
|
56
|
-
}
|
|
57
|
-
})));
|
|
58
|
-
this.compactEntriesDisposable = this._register(( new MutableDisposable()));
|
|
59
|
-
this.styleOverrides = ( new Set());
|
|
60
|
-
this.registerListeners();
|
|
61
|
-
}
|
|
62
|
-
registerListeners() {
|
|
63
|
-
this._register(this.onDidChangeEntryVisibility(() => this.updateCompactEntries()));
|
|
64
|
-
this._register(this.contextService.onDidChangeWorkbenchState(() => this.updateStyles()));
|
|
65
|
-
}
|
|
66
|
-
addEntry(entry, id, alignment, priorityOrLocation = 0) {
|
|
67
|
-
let priority;
|
|
68
|
-
if (isStatusbarEntryPriority(priorityOrLocation)) {
|
|
69
|
-
priority = priorityOrLocation;
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
priority = {
|
|
73
|
-
primary: priorityOrLocation,
|
|
74
|
-
secondary: hash(id)
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
if (!this.element) {
|
|
78
|
-
return this.doAddPendingEntry(entry, id, alignment, priority);
|
|
79
|
-
}
|
|
80
|
-
return this.doAddEntry(entry, id, alignment, priority);
|
|
81
|
-
}
|
|
82
|
-
doAddPendingEntry(entry, id, alignment, priority) {
|
|
83
|
-
const pendingEntry = { entry, id, alignment, priority };
|
|
84
|
-
this.pendingEntries.push(pendingEntry);
|
|
85
|
-
const accessor = {
|
|
86
|
-
update: (entry) => {
|
|
87
|
-
if (pendingEntry.accessor) {
|
|
88
|
-
pendingEntry.accessor.update(entry);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
pendingEntry.entry = entry;
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
dispose: () => {
|
|
95
|
-
if (pendingEntry.accessor) {
|
|
96
|
-
pendingEntry.accessor.dispose();
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
this.pendingEntries = this.pendingEntries.filter(entry => entry !== pendingEntry);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
return accessor;
|
|
104
|
-
}
|
|
105
|
-
doAddEntry(entry, id, alignment, priority) {
|
|
106
|
-
const itemContainer = this.doCreateStatusItem(id, alignment);
|
|
107
|
-
const item = this.instantiationService.createInstance(StatusbarEntryItem, itemContainer, entry, this.hoverDelegate);
|
|
108
|
-
const viewModelEntry = new class {
|
|
109
|
-
constructor() {
|
|
110
|
-
this.id = id;
|
|
111
|
-
this.alignment = alignment;
|
|
112
|
-
this.priority = priority;
|
|
113
|
-
this.container = itemContainer;
|
|
114
|
-
this.labelContainer = item.labelContainer;
|
|
115
|
-
}
|
|
116
|
-
get name() { return item.name; }
|
|
117
|
-
get hasCommand() { return item.hasCommand; }
|
|
118
|
-
};
|
|
119
|
-
const { needsFullRefresh } = this.doAddOrRemoveModelEntry(viewModelEntry, true);
|
|
120
|
-
if (needsFullRefresh) {
|
|
121
|
-
this.appendStatusbarEntries();
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
this.appendStatusbarEntry(viewModelEntry);
|
|
125
|
-
}
|
|
126
|
-
return {
|
|
127
|
-
update: entry => {
|
|
128
|
-
item.update(entry);
|
|
129
|
-
},
|
|
130
|
-
dispose: () => {
|
|
131
|
-
const { needsFullRefresh } = this.doAddOrRemoveModelEntry(viewModelEntry, false);
|
|
132
|
-
if (needsFullRefresh) {
|
|
133
|
-
this.appendStatusbarEntries();
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
itemContainer.remove();
|
|
137
|
-
}
|
|
138
|
-
dispose(item);
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
doCreateStatusItem(id, alignment, ...extraClasses) {
|
|
143
|
-
const itemContainer = document.createElement('div');
|
|
144
|
-
itemContainer.id = id;
|
|
145
|
-
itemContainer.classList.add('statusbar-item');
|
|
146
|
-
if (extraClasses) {
|
|
147
|
-
itemContainer.classList.add(...extraClasses);
|
|
148
|
-
}
|
|
149
|
-
if (alignment === 1 ) {
|
|
150
|
-
itemContainer.classList.add('right');
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
itemContainer.classList.add('left');
|
|
154
|
-
}
|
|
155
|
-
return itemContainer;
|
|
156
|
-
}
|
|
157
|
-
doAddOrRemoveModelEntry(entry, add) {
|
|
158
|
-
const entriesBefore = this.viewModel.entries;
|
|
159
|
-
if (add) {
|
|
160
|
-
this.viewModel.add(entry);
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
this.viewModel.remove(entry);
|
|
164
|
-
}
|
|
165
|
-
const entriesAfter = this.viewModel.entries;
|
|
166
|
-
if (add) {
|
|
167
|
-
entriesBefore.splice(entriesAfter.indexOf(entry), 0, entry);
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
entriesBefore.splice(entriesBefore.indexOf(entry), 1);
|
|
171
|
-
}
|
|
172
|
-
const needsFullRefresh = !equals(entriesBefore, entriesAfter);
|
|
173
|
-
return { needsFullRefresh };
|
|
174
|
-
}
|
|
175
|
-
isEntryVisible(id) {
|
|
176
|
-
return !this.viewModel.isHidden(id);
|
|
177
|
-
}
|
|
178
|
-
updateEntryVisibility(id, visible) {
|
|
179
|
-
if (visible) {
|
|
180
|
-
this.viewModel.show(id);
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
this.viewModel.hide(id);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
focusNextEntry() {
|
|
187
|
-
this.viewModel.focusNextEntry();
|
|
188
|
-
}
|
|
189
|
-
focusPreviousEntry() {
|
|
190
|
-
this.viewModel.focusPreviousEntry();
|
|
191
|
-
}
|
|
192
|
-
isEntryFocused() {
|
|
193
|
-
return this.viewModel.isEntryFocused();
|
|
194
|
-
}
|
|
195
|
-
focus(preserveEntryFocus = true) {
|
|
196
|
-
this.getContainer()?.focus();
|
|
197
|
-
const lastFocusedEntry = this.viewModel.lastFocusedEntry;
|
|
198
|
-
if (preserveEntryFocus && lastFocusedEntry) {
|
|
199
|
-
setTimeout(() => lastFocusedEntry.labelContainer.focus(), 0);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
createContentArea(parent) {
|
|
203
|
-
this.element = parent;
|
|
204
|
-
const scopedContextKeyService = this.contextKeyService.createScoped(this.element);
|
|
205
|
-
StatusBarFocused.bindTo(scopedContextKeyService).set(true);
|
|
206
|
-
this.leftItemsContainer = document.createElement('div');
|
|
207
|
-
this.leftItemsContainer.classList.add('left-items', 'items-container');
|
|
208
|
-
this.element.appendChild(this.leftItemsContainer);
|
|
209
|
-
this.element.tabIndex = 0;
|
|
210
|
-
this.rightItemsContainer = document.createElement('div');
|
|
211
|
-
this.rightItemsContainer.classList.add('right-items', 'items-container');
|
|
212
|
-
this.element.appendChild(this.rightItemsContainer);
|
|
213
|
-
this._register(addDisposableListener(parent, EventType.CONTEXT_MENU, e => this.showContextMenu(e)));
|
|
214
|
-
this._register(Gesture.addTarget(parent));
|
|
215
|
-
this._register(addDisposableListener(parent, EventType$1.Contextmenu, e => this.showContextMenu(e)));
|
|
216
|
-
this.createInitialStatusbarEntries();
|
|
217
|
-
return this.element;
|
|
218
|
-
}
|
|
219
|
-
createInitialStatusbarEntries() {
|
|
220
|
-
this.appendStatusbarEntries();
|
|
221
|
-
while (this.pendingEntries.length) {
|
|
222
|
-
const pending = this.pendingEntries.shift();
|
|
223
|
-
if (pending) {
|
|
224
|
-
pending.accessor = this.addEntry(pending.entry, pending.id, pending.alignment, pending.priority.primary);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
appendStatusbarEntries() {
|
|
229
|
-
const leftItemsContainer = assertIsDefined(this.leftItemsContainer);
|
|
230
|
-
const rightItemsContainer = assertIsDefined(this.rightItemsContainer);
|
|
231
|
-
clearNode(leftItemsContainer);
|
|
232
|
-
clearNode(rightItemsContainer);
|
|
233
|
-
for (const entry of [
|
|
234
|
-
...this.viewModel.getEntries(0 ),
|
|
235
|
-
...this.viewModel.getEntries(1 ).reverse()
|
|
236
|
-
]) {
|
|
237
|
-
const target = entry.alignment === 0 ? leftItemsContainer : rightItemsContainer;
|
|
238
|
-
target.appendChild(entry.container);
|
|
239
|
-
}
|
|
240
|
-
this.updateCompactEntries();
|
|
241
|
-
}
|
|
242
|
-
appendStatusbarEntry(entry) {
|
|
243
|
-
const entries = this.viewModel.getEntries(entry.alignment);
|
|
244
|
-
if (entry.alignment === 1 ) {
|
|
245
|
-
entries.reverse();
|
|
246
|
-
}
|
|
247
|
-
const target = assertIsDefined(entry.alignment === 0 ? this.leftItemsContainer : this.rightItemsContainer);
|
|
248
|
-
const index = entries.indexOf(entry);
|
|
249
|
-
if (index + 1 === entries.length) {
|
|
250
|
-
target.appendChild(entry.container);
|
|
251
|
-
}
|
|
252
|
-
else {
|
|
253
|
-
target.insertBefore(entry.container, entries[index + 1].container);
|
|
254
|
-
}
|
|
255
|
-
this.updateCompactEntries();
|
|
256
|
-
}
|
|
257
|
-
updateCompactEntries() {
|
|
258
|
-
const entries = this.viewModel.entries;
|
|
259
|
-
const mapIdToVisibleEntry = ( new Map());
|
|
260
|
-
for (const entry of entries) {
|
|
261
|
-
if (!this.viewModel.isHidden(entry.id)) {
|
|
262
|
-
mapIdToVisibleEntry.set(entry.id, entry);
|
|
263
|
-
}
|
|
264
|
-
entry.container.classList.remove('compact-left', 'compact-right');
|
|
265
|
-
}
|
|
266
|
-
const compactEntryGroups = ( new Map());
|
|
267
|
-
for (const entry of ( mapIdToVisibleEntry.values())) {
|
|
268
|
-
if (isStatusbarEntryLocation(entry.priority.primary) &&
|
|
269
|
-
entry.priority.primary.compact
|
|
270
|
-
) {
|
|
271
|
-
const locationId = entry.priority.primary.id;
|
|
272
|
-
const location = mapIdToVisibleEntry.get(locationId);
|
|
273
|
-
if (!location) {
|
|
274
|
-
continue;
|
|
275
|
-
}
|
|
276
|
-
let compactEntryGroup = compactEntryGroups.get(locationId);
|
|
277
|
-
if (!compactEntryGroup) {
|
|
278
|
-
compactEntryGroup = ( new Set([entry, location]));
|
|
279
|
-
compactEntryGroups.set(locationId, compactEntryGroup);
|
|
280
|
-
}
|
|
281
|
-
else {
|
|
282
|
-
compactEntryGroup.add(entry);
|
|
283
|
-
}
|
|
284
|
-
if (entry.priority.primary.alignment === 0 ) {
|
|
285
|
-
location.container.classList.add('compact-left');
|
|
286
|
-
entry.container.classList.add('compact-right');
|
|
287
|
-
}
|
|
288
|
-
else {
|
|
289
|
-
location.container.classList.add('compact-right');
|
|
290
|
-
entry.container.classList.add('compact-left');
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
const statusBarItemHoverBackground = this.getColor(STATUS_BAR_ITEM_HOVER_BACKGROUND);
|
|
295
|
-
const statusBarItemCompactHoverBackground = this.getColor(STATUS_BAR_ITEM_COMPACT_HOVER_BACKGROUND);
|
|
296
|
-
this.compactEntriesDisposable.value = ( new DisposableStore());
|
|
297
|
-
if (statusBarItemHoverBackground && statusBarItemCompactHoverBackground && !isHighContrast(this.theme.type)) {
|
|
298
|
-
for (const [, compactEntryGroup] of compactEntryGroups) {
|
|
299
|
-
for (const compactEntry of compactEntryGroup) {
|
|
300
|
-
if (!compactEntry.hasCommand) {
|
|
301
|
-
continue;
|
|
302
|
-
}
|
|
303
|
-
this.compactEntriesDisposable.value.add(addDisposableListener(compactEntry.labelContainer, EventType.MOUSE_OVER, () => {
|
|
304
|
-
compactEntryGroup.forEach(compactEntry => compactEntry.labelContainer.style.backgroundColor = statusBarItemHoverBackground);
|
|
305
|
-
compactEntry.labelContainer.style.backgroundColor = statusBarItemCompactHoverBackground;
|
|
306
|
-
}));
|
|
307
|
-
this.compactEntriesDisposable.value.add(addDisposableListener(compactEntry.labelContainer, EventType.MOUSE_OUT, () => {
|
|
308
|
-
compactEntryGroup.forEach(compactEntry => compactEntry.labelContainer.style.backgroundColor = '');
|
|
309
|
-
}));
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
showContextMenu(e) {
|
|
315
|
-
EventHelper.stop(e, true);
|
|
316
|
-
const event = ( new StandardMouseEvent(getWindow(this.element), e));
|
|
317
|
-
let actions = undefined;
|
|
318
|
-
this.contextMenuService.showContextMenu({
|
|
319
|
-
getAnchor: () => event,
|
|
320
|
-
getActions: () => {
|
|
321
|
-
actions = this.getContextMenuActions(event);
|
|
322
|
-
return actions;
|
|
323
|
-
},
|
|
324
|
-
onHide: () => {
|
|
325
|
-
if (actions) {
|
|
326
|
-
disposeIfDisposable(actions);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
getContextMenuActions(event) {
|
|
332
|
-
const actions = [];
|
|
333
|
-
actions.push(toAction({ id: ToggleStatusbarVisibilityAction.ID, label: ( localizeWithPath(
|
|
334
|
-
'vs/workbench/browser/parts/statusbar/statusbarPart',
|
|
335
|
-
'hideStatusBar',
|
|
336
|
-
"Hide Status Bar"
|
|
337
|
-
)), run: () => this.instantiationService.invokeFunction(accessor => ( new ToggleStatusbarVisibilityAction()).run(accessor)) }));
|
|
338
|
-
actions.push(( new Separator()));
|
|
339
|
-
const handledEntries = ( new Set());
|
|
340
|
-
for (const entry of this.viewModel.entries) {
|
|
341
|
-
if (!( handledEntries.has(entry.id))) {
|
|
342
|
-
actions.push(( new ToggleStatusbarEntryVisibilityAction(entry.id, entry.name, this.viewModel)));
|
|
343
|
-
handledEntries.add(entry.id);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
let statusEntryUnderMouse = undefined;
|
|
347
|
-
for (let element = event.target; element; element = element.parentElement) {
|
|
348
|
-
const entry = this.viewModel.findEntry(element);
|
|
349
|
-
if (entry) {
|
|
350
|
-
statusEntryUnderMouse = entry;
|
|
351
|
-
break;
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
if (statusEntryUnderMouse) {
|
|
355
|
-
actions.push(( new Separator()));
|
|
356
|
-
actions.push(( new HideStatusbarEntryAction(statusEntryUnderMouse.id, statusEntryUnderMouse.name, this.viewModel)));
|
|
357
|
-
}
|
|
358
|
-
return actions;
|
|
359
|
-
}
|
|
360
|
-
updateStyles() {
|
|
361
|
-
super.updateStyles();
|
|
362
|
-
const container = assertIsDefined(this.getContainer());
|
|
363
|
-
const styleOverride = [...this.styleOverrides].sort((a, b) => a.priority - b.priority)[0];
|
|
364
|
-
const backgroundColor = this.getColor(styleOverride?.background ?? (this.contextService.getWorkbenchState() !== 1 ? STATUS_BAR_BACKGROUND : STATUS_BAR_NO_FOLDER_BACKGROUND)) || '';
|
|
365
|
-
container.style.backgroundColor = backgroundColor;
|
|
366
|
-
const foregroundColor = this.getColor(styleOverride?.foreground ?? (this.contextService.getWorkbenchState() !== 1 ? STATUS_BAR_FOREGROUND : STATUS_BAR_NO_FOLDER_FOREGROUND)) || '';
|
|
367
|
-
container.style.color = foregroundColor;
|
|
368
|
-
const itemBorderColor = this.getColor(STATUS_BAR_ITEM_FOCUS_BORDER);
|
|
369
|
-
const borderColor = this.getColor(styleOverride?.border ?? (this.contextService.getWorkbenchState() !== 1 ? STATUS_BAR_BORDER : STATUS_BAR_NO_FOLDER_BORDER)) || this.getColor(contrastBorder);
|
|
370
|
-
if (borderColor) {
|
|
371
|
-
container.classList.add('status-border-top');
|
|
372
|
-
container.style.setProperty('--status-border-top-color', borderColor);
|
|
373
|
-
}
|
|
374
|
-
else {
|
|
375
|
-
container.classList.remove('status-border-top');
|
|
376
|
-
container.style.removeProperty('--status-border-top-color');
|
|
377
|
-
}
|
|
378
|
-
const statusBarFocusColor = this.getColor(STATUS_BAR_FOCUS_BORDER);
|
|
379
|
-
if (!this.styleElement) {
|
|
380
|
-
this.styleElement = createStyleSheet(container);
|
|
381
|
-
}
|
|
382
|
-
this.styleElement.textContent = `
|
|
383
|
-
|
|
384
|
-
/* Status bar focus outline */
|
|
385
|
-
.monaco-workbench .part.statusbar:focus {
|
|
386
|
-
outline-color: ${statusBarFocusColor};
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
/* Status bar item focus outline */
|
|
390
|
-
.monaco-workbench .part.statusbar > .items-container > .statusbar-item a:focus-visible {
|
|
391
|
-
outline: 1px solid ${this.getColor(activeContrastBorder) ?? itemBorderColor};
|
|
392
|
-
outline-offset: ${borderColor ? '-2px' : '-1px'};
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
/* Notification Beak */
|
|
396
|
-
.monaco-workbench .part.statusbar > .items-container > .statusbar-item.has-beak > .status-bar-item-beak-container:before {
|
|
397
|
-
border-bottom-color: ${backgroundColor};
|
|
398
|
-
}
|
|
399
|
-
`;
|
|
400
|
-
}
|
|
401
|
-
layout(width, height, top, left) {
|
|
402
|
-
super.layout(width, height, top, left);
|
|
403
|
-
super.layoutContents(width, height);
|
|
404
|
-
}
|
|
405
|
-
overrideStyle(style) {
|
|
406
|
-
this.styleOverrides.add(style);
|
|
407
|
-
this.updateStyles();
|
|
408
|
-
return toDisposable(() => {
|
|
409
|
-
this.styleOverrides.delete(style);
|
|
410
|
-
this.updateStyles();
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
toJSON() {
|
|
414
|
-
return {
|
|
415
|
-
type: "workbench.parts.statusbar"
|
|
416
|
-
};
|
|
417
|
-
}
|
|
418
|
-
dispose() {
|
|
419
|
-
this._onWillDispose.fire();
|
|
420
|
-
super.dispose();
|
|
421
|
-
}
|
|
422
|
-
};
|
|
423
|
-
StatusbarPart = StatusbarPart_1 = ( __decorate([
|
|
424
|
-
( __param(1, IInstantiationService)),
|
|
425
|
-
( __param(2, IThemeService)),
|
|
426
|
-
( __param(3, IWorkspaceContextService)),
|
|
427
|
-
( __param(4, IStorageService)),
|
|
428
|
-
( __param(5, IWorkbenchLayoutService)),
|
|
429
|
-
( __param(6, IContextMenuService)),
|
|
430
|
-
( __param(7, IContextKeyService))
|
|
431
|
-
], StatusbarPart));
|
|
432
|
-
let MainStatusbarPart = class MainStatusbarPart extends StatusbarPart {
|
|
433
|
-
constructor(instantiationService, themeService, contextService, storageService, layoutService, contextMenuService, contextKeyService) {
|
|
434
|
-
super("workbench.parts.statusbar" , instantiationService, themeService, contextService, storageService, layoutService, contextMenuService, contextKeyService);
|
|
435
|
-
}
|
|
436
|
-
};
|
|
437
|
-
MainStatusbarPart = ( __decorate([
|
|
438
|
-
( __param(0, IInstantiationService)),
|
|
439
|
-
( __param(1, IThemeService)),
|
|
440
|
-
( __param(2, IWorkspaceContextService)),
|
|
441
|
-
( __param(3, IStorageService)),
|
|
442
|
-
( __param(4, IWorkbenchLayoutService)),
|
|
443
|
-
( __param(5, IContextMenuService)),
|
|
444
|
-
( __param(6, IContextKeyService))
|
|
445
|
-
], MainStatusbarPart));
|
|
446
|
-
let AuxiliaryStatusbarPart = class AuxiliaryStatusbarPart extends StatusbarPart {
|
|
447
|
-
static { AuxiliaryStatusbarPart_1 = this; }
|
|
448
|
-
static { this.COUNTER = 1; }
|
|
449
|
-
constructor(container, instantiationService, themeService, contextService, storageService, layoutService, contextMenuService, contextKeyService) {
|
|
450
|
-
const id = AuxiliaryStatusbarPart_1.COUNTER++;
|
|
451
|
-
super(`workbench.parts.auxiliaryStatus.${id}`, instantiationService, themeService, contextService, storageService, layoutService, contextMenuService, contextKeyService);
|
|
452
|
-
this.container = container;
|
|
453
|
-
this.height = StatusbarPart.HEIGHT;
|
|
454
|
-
}
|
|
455
|
-
};
|
|
456
|
-
AuxiliaryStatusbarPart = AuxiliaryStatusbarPart_1 = ( __decorate([
|
|
457
|
-
( __param(1, IInstantiationService)),
|
|
458
|
-
( __param(2, IThemeService)),
|
|
459
|
-
( __param(3, IWorkspaceContextService)),
|
|
460
|
-
( __param(4, IStorageService)),
|
|
461
|
-
( __param(5, IWorkbenchLayoutService)),
|
|
462
|
-
( __param(6, IContextMenuService)),
|
|
463
|
-
( __param(7, IContextKeyService))
|
|
464
|
-
], AuxiliaryStatusbarPart));
|
|
465
|
-
let StatusbarService = class StatusbarService extends MultiWindowParts {
|
|
466
|
-
constructor(instantiationService, storageService, themeService) {
|
|
467
|
-
super('workbench.statusBarService', themeService, storageService);
|
|
468
|
-
this.instantiationService = instantiationService;
|
|
469
|
-
this.mainPart = this._register(this.instantiationService.createInstance(MainStatusbarPart));
|
|
470
|
-
this.onDidChangeEntryVisibility = this.mainPart.onDidChangeEntryVisibility;
|
|
471
|
-
this._register(this.registerPart(this.mainPart));
|
|
472
|
-
}
|
|
473
|
-
createAuxiliaryStatusbarPart(container) {
|
|
474
|
-
const statusbarPartContainer = document.createElement('footer');
|
|
475
|
-
statusbarPartContainer.classList.add('part', 'statusbar');
|
|
476
|
-
statusbarPartContainer.setAttribute('role', 'status');
|
|
477
|
-
statusbarPartContainer.style.position = 'relative';
|
|
478
|
-
statusbarPartContainer.setAttribute('aria-live', 'off');
|
|
479
|
-
statusbarPartContainer.setAttribute('tabindex', '0');
|
|
480
|
-
container.appendChild(statusbarPartContainer);
|
|
481
|
-
const statusbarPart = this.instantiationService.createInstance(AuxiliaryStatusbarPart, statusbarPartContainer);
|
|
482
|
-
const disposable = this.registerPart(statusbarPart);
|
|
483
|
-
statusbarPart.create(statusbarPartContainer);
|
|
484
|
-
Event.once(statusbarPart.onWillDispose)(() => disposable.dispose());
|
|
485
|
-
return statusbarPart;
|
|
486
|
-
}
|
|
487
|
-
createScoped(statusbarEntryContainer, disposables) {
|
|
488
|
-
return disposables.add(this.instantiationService.createInstance(ScopedStatusbarService, statusbarEntryContainer));
|
|
489
|
-
}
|
|
490
|
-
addEntry(entry, id, alignment, priorityOrLocation = 0) {
|
|
491
|
-
return this.mainPart.addEntry(entry, id, alignment, priorityOrLocation);
|
|
492
|
-
}
|
|
493
|
-
isEntryVisible(id) {
|
|
494
|
-
return this.mainPart.isEntryVisible(id);
|
|
495
|
-
}
|
|
496
|
-
updateEntryVisibility(id, visible) {
|
|
497
|
-
for (const part of this.parts) {
|
|
498
|
-
part.updateEntryVisibility(id, visible);
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
focus(preserveEntryFocus) {
|
|
502
|
-
this.activePart.focus(preserveEntryFocus);
|
|
503
|
-
}
|
|
504
|
-
focusNextEntry() {
|
|
505
|
-
this.activePart.focusNextEntry();
|
|
506
|
-
}
|
|
507
|
-
focusPreviousEntry() {
|
|
508
|
-
this.activePart.focusPreviousEntry();
|
|
509
|
-
}
|
|
510
|
-
isEntryFocused() {
|
|
511
|
-
return this.activePart.isEntryFocused();
|
|
512
|
-
}
|
|
513
|
-
overrideStyle(style) {
|
|
514
|
-
const disposables = ( new DisposableStore());
|
|
515
|
-
for (const part of this.parts) {
|
|
516
|
-
disposables.add(part.overrideStyle(style));
|
|
517
|
-
}
|
|
518
|
-
return disposables;
|
|
519
|
-
}
|
|
520
|
-
};
|
|
521
|
-
StatusbarService = ( __decorate([
|
|
522
|
-
( __param(0, IInstantiationService)),
|
|
523
|
-
( __param(1, IStorageService)),
|
|
524
|
-
( __param(2, IThemeService))
|
|
525
|
-
], StatusbarService));
|
|
526
|
-
let ScopedStatusbarService = class ScopedStatusbarService extends Disposable {
|
|
527
|
-
constructor(statusbarEntryContainer, statusbarService) {
|
|
528
|
-
super();
|
|
529
|
-
this.statusbarEntryContainer = statusbarEntryContainer;
|
|
530
|
-
this.statusbarService = statusbarService;
|
|
531
|
-
this.onDidChangeEntryVisibility = this.statusbarEntryContainer.onDidChangeEntryVisibility;
|
|
532
|
-
}
|
|
533
|
-
createAuxiliaryStatusbarPart(container) {
|
|
534
|
-
return this.statusbarService.createAuxiliaryStatusbarPart(container);
|
|
535
|
-
}
|
|
536
|
-
createScoped(statusbarEntryContainer, disposables) {
|
|
537
|
-
return this.statusbarService.createScoped(statusbarEntryContainer, disposables);
|
|
538
|
-
}
|
|
539
|
-
getPart() {
|
|
540
|
-
return this.statusbarEntryContainer;
|
|
541
|
-
}
|
|
542
|
-
addEntry(entry, id, alignment, priorityOrLocation = 0) {
|
|
543
|
-
return this.statusbarEntryContainer.addEntry(entry, id, alignment, priorityOrLocation);
|
|
544
|
-
}
|
|
545
|
-
isEntryVisible(id) {
|
|
546
|
-
return this.statusbarEntryContainer.isEntryVisible(id);
|
|
547
|
-
}
|
|
548
|
-
updateEntryVisibility(id, visible) {
|
|
549
|
-
this.statusbarEntryContainer.updateEntryVisibility(id, visible);
|
|
550
|
-
}
|
|
551
|
-
focus(preserveEntryFocus) {
|
|
552
|
-
this.statusbarEntryContainer.focus(preserveEntryFocus);
|
|
553
|
-
}
|
|
554
|
-
focusNextEntry() {
|
|
555
|
-
this.statusbarEntryContainer.focusNextEntry();
|
|
556
|
-
}
|
|
557
|
-
focusPreviousEntry() {
|
|
558
|
-
this.statusbarEntryContainer.focusPreviousEntry();
|
|
559
|
-
}
|
|
560
|
-
isEntryFocused() {
|
|
561
|
-
return this.statusbarEntryContainer.isEntryFocused();
|
|
562
|
-
}
|
|
563
|
-
overrideStyle(style) {
|
|
564
|
-
return this.statusbarEntryContainer.overrideStyle(style);
|
|
565
|
-
}
|
|
566
|
-
};
|
|
567
|
-
ScopedStatusbarService = ( __decorate([
|
|
568
|
-
( __param(1, IStatusbarService))
|
|
569
|
-
], ScopedStatusbarService));
|
|
570
|
-
|
|
571
|
-
export { AuxiliaryStatusbarPart, MainStatusbarPart, ScopedStatusbarService, StatusbarService };
|