@codingame/monaco-vscode-api 1.82.2 → 1.82.3
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/README.md +2 -0
- package/missing-services.js +17 -0
- package/monaco-editor-treemending.patch +551 -551
- package/package.json +1 -1
- package/service-override/quickaccess.js +1 -1
- package/service-override/tools/editor.d.ts +1 -1
- package/service-override/views.js +10 -0
- package/service-override/workspaceTrust.d.ts +5 -0
- package/service-override/workspaceTrust.js +13 -0
- package/services.d.ts +3 -0
- package/services.js +3 -0
- package/vscode/src/vs/base/common/htmlContent.d.ts +23 -2
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagementUtil.js +16 -1
- package/vscode/src/vs/platform/opener/browser/link.d.ts +8 -0
- package/vscode/src/vs/platform/workspace/common/workspaceTrust.d.ts +34 -1
- package/vscode/src/vs/workbench/browser/parts/banner/bannerPart.js +228 -0
- package/vscode/src/vs/workbench/browser/parts/banner/media/bannerpart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/panel/panelActions.js +21 -0
- package/vscode/src/vs/workbench/browser/parts/titlebar/commandCenterControl.js +134 -0
- package/vscode/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/titlebar/titlebarPart.js +365 -0
- package/vscode/src/vs/workbench/browser/parts/titlebar/windowTitle.js +216 -0
- package/vscode/src/vs/workbench/common/contextkeys.js +2 -1
- package/vscode/src/vs/workbench/common/theme.js +6 -6
- package/vscode/src/vs/workbench/contrib/extensions/common/extensions.js +2 -1
- package/vscode/src/vs/workbench/contrib/preferences/browser/preferences.contribution.js +108 -4
- package/vscode/src/vs/workbench/contrib/workspace/browser/media/workspaceTrustEditor.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/workspace/browser/workspace.contribution.js +842 -0
- package/vscode/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.js +1047 -0
- package/vscode/src/vs/workbench/contrib/workspace/common/workspace.js +14 -0
- package/vscode/src/vs/workbench/services/banner/browser/bannerService.d.ts +25 -0
- package/vscode/src/vs/workbench/services/banner/browser/bannerService.js +3 -0
- package/vscode/src/vs/workbench/services/title/common/titleService.d.ts +31 -0
- package/vscode/src/vs/workbench/services/title/common/titleService.js +3 -0
- package/vscode/src/vs/workbench/services/userDataProfile/common/userDataProfile.js +3 -1
- package/vscode/src/vs/workbench/services/workspaces/browser/workspaceTrustEditorInput.js +27 -0
- package/vscode/src/vs/workbench/services/workspaces/common/workspaceTrust.js +649 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import n from '../../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
|
|
2
|
+
var css = ".monaco-workbench .part.titlebar{display:flex;flex-direction:row}.monaco-workbench.mac .part.titlebar{flex-direction:row-reverse}.monaco-workbench .part.titlebar>.titlebar-container{align-items:center;box-sizing:border-box;display:flex;flex-grow:1;flex-shrink:1;height:100%;justify-content:space-between;overflow:hidden;user-select:none;-webkit-user-select:none;width:100%}.monaco-workbench .part.titlebar>.titlebar-container.counter-zoom{zoom:calc(1/var(--zoom-factor))}.monaco-workbench.mac .part.titlebar>.titlebar-container{line-height:22px}.monaco-workbench.linux .part.titlebar>.titlebar-container,.monaco-workbench.web .part.titlebar>.titlebar-container,.monaco-workbench.windows .part.titlebar>.titlebar-container{justify-content:left;line-height:22px}.monaco-workbench.web.safari .part.titlebar,.monaco-workbench.web.safari .part.titlebar>.titlebar-container{overflow:visible}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-drag-region{-webkit-app-region:drag;display:block;height:100%;left:0;position:absolute;top:0;width:100%}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center,.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-left,.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-right{align-items:center;display:flex;height:100%}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-left{flex-grow:2;justify-content:flex-start;order:0;width:20%}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center{justify-content:center;margin:0 10px;max-width:fit-content;min-width:0;order:1;width:60%}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-right{flex-grow:2;justify-content:flex-end;min-width:min-content;order:2;width:20%}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title{flex:0 1 auto;font-size:12px;margin-left:auto;margin-right:auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.monaco-workbench.linux .part.titlebar>.titlebar-container>.titlebar-center>.window-title,.monaco-workbench.web .part.titlebar>.titlebar-container>.titlebar-center>.window-title,.monaco-workbench.windows .part.titlebar>.titlebar-container>.titlebar-center>.window-title{cursor:default}.monaco-workbench.linux .part.titlebar>.titlebar-container>.titlebar-center>.window-title{font-size:inherit}.monaco-workbench .part.titlebar>.titlebar-container .monaco-toolbar .actions-container{gap:4px}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title>.command-center{-webkit-app-region:no-drag;z-index:2500}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title>.command-center.hide{visibility:hidden}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title>.command-center .action-item>.action-label{color:var(--vscode-titleBar-activeForeground)}.monaco-workbench .part.titlebar.inactive>.titlebar-container>.titlebar-center>.window-title>.command-center .action-item>.action-label{color:var(--vscode-titleBar-inactiveForeground)}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title>.command-center .codicon{color:inherit}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title>.command-center .action-item.command-center{align-items:stretch;background-color:var(--vscode-commandCenter-background);border:1px solid var(--vscode-commandCenter-border);border-bottom-left-radius:6px;border-bottom-right-radius:6px;border-top-left-radius:6px;border-top-right-radius:6px;color:var(--vscode-commandCenter-foreground);display:flex;height:22px;margin-left:6px;max-width:600px;overflow:hidden;width:38vw}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title>.command-center .action-item.command-center:only-child{margin-left:0}.monaco-workbench .part.titlebar.inactive>.titlebar-container>.titlebar-center>.window-title>.command-center .action-item.command-center{border-color:var(--vscode-commandCenter-inactiveBorder)!important;color:var(--vscode-titleBar-inactiveForeground)}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title>.command-center .action-item.command-center .search-icon{font-size:14px;margin:auto 3px;opacity:.8}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title>.command-center .action-item.command-center .search-label{overflow:hidden;text-overflow:ellipsis}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title>.command-center .action-item.command-center:HOVER{background-color:var(--vscode-commandCenter-activeBackground);border-color:var(--vscode-commandCenter-activeBorder);color:var(--vscode-commandCenter-activeForeground)}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-left>.menubar{flex-wrap:nowrap;min-width:36px;order:2;z-index:2500}.monaco-workbench.web .part.titlebar>.titlebar-container>.titlebar-left>.menubar{margin-left:4px}.monaco-workbench .part.titlebar>.titlebar-container.counter-zoom .menubar .menubar-menu-button>.menubar-menu-items-holder.monaco-menu-container{zoom:var(--zoom-factor)}.monaco-workbench.linux .part.titlebar>.titlebar-container>.resizer,.monaco-workbench.windows .part.titlebar>.titlebar-container>.resizer{-webkit-app-region:no-drag;height:4px;position:absolute;top:0;width:100%}.monaco-workbench.linux.fullscreen .part.titlebar>.titlebar-container>.resizer,.monaco-workbench.windows.fullscreen .part.titlebar>.titlebar-container>.resizer{display:none}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-left>.window-appicon{flex-shrink:0;height:100%;order:1;position:relative;width:35px;z-index:2500}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-left>.window-appicon:not(.codicon){background-image:url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiPjxwYXRoIGQ9Ik0xMDI0IDEwMjRIMFYwaDEwMjR2MTAyNHoiIHN0eWxlPSJmaWxsOiNmNmY2ZjY7ZmlsbC1vcGFjaXR5OjAiIGZpbGw9Im5vbmUiLz48cGF0aCBkPSJNMTAyNCA4NS4zMzN2ODUzLjMzM0gwVjg1LjMzM2gxMDI0eiIgc3R5bGU9ImZpbGw6I2ZmZiIvPjxwYXRoIGQ9Ik0wIDg1LjMzM2gyOTguNjY3djg1My4zMzNIMFY4NS4zMzN6bTEwMjQgMHY4NTMuMzMzSDM4NFY4NS4zMzNoNjQwem0tNTU0LjY2NyAxNjBoMzQxLjMzM3YtNjRINDY5LjMzM3Y2NHptMzQxLjMzNCA1MzMuMzM0SDQ2OS4zMzN2NjRoMzQxLjMzM2wuMDAxLTY0em0xMjgtMTQ5LjMzNEg1OTcuMzMzdjY0aDM0MS4zMzNsLjAwMS02NHptMC0xNDkuMzMzSDU5Ny4zMzN2NjRoMzQxLjMzM2wuMDAxLTY0em0wLTE0OS4zMzNINTk3LjMzM3Y2NGgzNDEuMzMzbC4wMDEtNjR6IiBzdHlsZT0iZmlsbDojMTY3YWJmIi8+PC9zdmc+\");background-position:50%;background-repeat:no-repeat;background-size:16px}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-left>.window-appicon.codicon{line-height:30px}.monaco-workbench.fullscreen .part.titlebar>.titlebar-container>.titlebar-left>.window-appicon{display:none}.monaco-workbench .part.titlebar>.titlebar-container .window-appicon>.home-bar-icon-badge{background-image:url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiPjxwYXRoIGQ9Ik0xMDI0IDEwMjRIMFYwaDEwMjR2MTAyNHoiIHN0eWxlPSJmaWxsOiNmNmY2ZjY7ZmlsbC1vcGFjaXR5OjAiIGZpbGw9Im5vbmUiLz48cGF0aCBkPSJNMTAyNCA4NS4zMzN2ODUzLjMzM0gwVjg1LjMzM2gxMDI0eiIgc3R5bGU9ImZpbGw6I2ZmZiIvPjxwYXRoIGQ9Ik0wIDg1LjMzM2gyOTguNjY3djg1My4zMzNIMFY4NS4zMzN6bTEwMjQgMHY4NTMuMzMzSDM4NFY4NS4zMzNoNjQwem0tNTU0LjY2NyAxNjBoMzQxLjMzM3YtNjRINDY5LjMzM3Y2NHptMzQxLjMzNCA1MzMuMzM0SDQ2OS4zMzN2NjRoMzQxLjMzM2wuMDAxLTY0em0xMjgtMTQ5LjMzNEg1OTcuMzMzdjY0aDM0MS4zMzNsLjAwMS02NHptMC0xNDkuMzMzSDU5Ny4zMzN2NjRoMzQxLjMzM2wuMDAxLTY0em0wLTE0OS4zMzNINTk3LjMzM3Y2NGgzNDEuMzMzbC4wMDEtNjR6IiBzdHlsZT0iZmlsbDojMTY3YWJmIi8+PC9zdmc+\");background-position:50%;background-repeat:no-repeat;background-size:8px;border-left:1px solid transparent;border-top:1px solid transparent;bottom:6px;height:8px;pointer-events:none;position:absolute;right:9px;width:8px;z-index:1}.monaco-workbench .part.titlebar .window-controls-container{-webkit-app-region:no-drag;display:flex;flex-grow:0;flex-shrink:0;height:100%;text-align:center;width:0;z-index:3000}.monaco-workbench.web .part.titlebar .titlebar-right .window-controls-container{height:env(titlebar-area-height,35px);width:calc(100vw - env(titlebar-area-width, 100vw) - env(titlebar-area-x, 0px))}.monaco-workbench.web .part.titlebar .titlebar-left .window-controls-container{height:env(titlebar-area-height,35px);width:env(titlebar-area-x,0)}.monaco-workbench.web.mac .part.titlebar .titlebar-left .window-controls-container{order:0}.monaco-workbench.web.mac .part.titlebar .titlebar-right .window-controls-container{order:1}.monaco-workbench:not(.web):not(.mac) .part.titlebar .window-controls-container.primary{width:calc(138px/var(--zoom-factor, 1))}.monaco-workbench:not(.web):not(.mac) .part.titlebar .titlebar-container.counter-zoom .window-controls-container.primary{width:138px}.monaco-workbench:not(.web):not(.mac) .part.titlebar .titlebar-container:not(.counter-zoom) .window-controls-container *{zoom:calc(1/var(--zoom-factor, 1))}.monaco-workbench:not(.web).mac .part.titlebar .window-controls-container.primary{width:70px}.monaco-workbench.fullscreen .part.titlebar .window-controls-container{background-color:transparent;display:none}.monaco-workbench .part.titlebar .window-controls-container>.window-icon{align-items:center;display:flex;font-size:16px;height:100%;justify-content:center;width:46px}.monaco-workbench .part.titlebar .window-controls-container>.window-icon:before{height:16px;line-height:16px}.monaco-workbench .part.titlebar .window-controls-container>.window-icon:hover{background-color:hsla(0,0%,100%,.1)}.monaco-workbench .part.titlebar.light>.window-controls-container>.window-icon:hover{background-color:rgba(0,0,0,.1)}.monaco-workbench .part.titlebar .window-controls-container>.window-icon.window-close:hover{background-color:rgba(232,17,35,.9)}.monaco-workbench .part.titlebar .window-controls-container .window-icon.window-close:hover{color:#fff}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-right>.layout-controls-container{-webkit-app-region:no-drag;display:none;flex-grow:0;flex-shrink:0;height:100%;margin-left:auto;min-width:28px;padding-right:2px;position:relative;text-align:center;z-index:2500}.monaco-workbench.mac:not(.web) .part.titlebar>.titlebar-container>.titlebar-right>.layout-controls-container{right:8px}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-right>.layout-controls-container.show-layout-control{display:flex;justify-content:center}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-right>.layout-controls-container .codicon{color:inherit}.monaco-workbench .part.titlebar .window-controls-container .window-icon{color:var(--vscode-titleBar-activeForeground)}.monaco-workbench .part.titlebar.inactive .window-controls-container .window-icon{color:var(--vscode-titleBar-inactiveForeground)}";
|
|
3
|
+
n(css,{});
|
|
4
|
+
export { css, css as default };
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import './media/titlebarpart.css.js';
|
|
3
|
+
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
4
|
+
import { Part } from '../../part.js';
|
|
5
|
+
import { isWCOEnabled, getZoomFactor } from 'monaco-editor/esm/vs/base/browser/browser.js';
|
|
6
|
+
import { getTitleBarStyle, getMenuBarVisibility } from '../../../../platform/window/common/window.js';
|
|
7
|
+
import { IContextMenuService } from 'monaco-editor/esm/vs/platform/contextview/browser/contextView.js';
|
|
8
|
+
import { StandardMouseEvent } from 'monaco-editor/esm/vs/base/browser/mouseEvent.js';
|
|
9
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
10
|
+
import { DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
11
|
+
import { IBrowserWorkbenchEnvironmentService } from '../../../services/environment/browser/environmentService.js';
|
|
12
|
+
import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
13
|
+
import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
|
|
14
|
+
import { TITLE_BAR_INACTIVE_BACKGROUND, TITLE_BAR_ACTIVE_BACKGROUND, WORKBENCH_BACKGROUND, TITLE_BAR_INACTIVE_FOREGROUND, TITLE_BAR_ACTIVE_FOREGROUND, TITLE_BAR_BORDER } from '../../../common/theme.js';
|
|
15
|
+
import { isWeb, isMacintosh, isWindows, isLinux, isNative, platformLocale } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
16
|
+
import { Color } from 'monaco-editor/esm/vs/base/common/color.js';
|
|
17
|
+
import { append, $, reset, prepend, EventType, addDisposableListener, EventHelper, isAncestor, Dimension } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
18
|
+
import { CustomMenubarControl } from './menubarControl.js';
|
|
19
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
20
|
+
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
21
|
+
import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
|
|
22
|
+
import { IWorkbenchLayoutService } from '../../../services/layout/browser/layoutService.js';
|
|
23
|
+
import { createActionViewItem } from 'monaco-editor/esm/vs/platform/actions/browser/menuEntryActionViewItem.js';
|
|
24
|
+
import { MenuId, registerAction2, Action2 } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
|
|
25
|
+
import { ContextKeyExpr, IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
26
|
+
import { IHostService } from '../../../services/host/browser/host.js';
|
|
27
|
+
import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
|
|
28
|
+
import { getIconRegistry } from 'monaco-editor/esm/vs/platform/theme/common/iconRegistry.js';
|
|
29
|
+
import { WindowTitle } from './windowTitle.js';
|
|
30
|
+
import { CommandCenterControl } from './commandCenterControl.js';
|
|
31
|
+
import { IHoverService } from '../../../services/hover/browser/hover.js';
|
|
32
|
+
import { Categories } from 'monaco-editor/esm/vs/platform/action/common/actionCommonCategories.js';
|
|
33
|
+
import { MenuWorkbenchToolBar } from 'monaco-editor/esm/vs/platform/actions/browser/toolbar.js';
|
|
34
|
+
var TitlebarPart_1;
|
|
35
|
+
let TitlebarPart = class TitlebarPart extends Part {
|
|
36
|
+
static { TitlebarPart_1 = this; }
|
|
37
|
+
static { this.configCommandCenter = 'window.commandCenter'; }
|
|
38
|
+
get minimumHeight() {
|
|
39
|
+
const value = this.isCommandCenterVisible || (isWeb && isWCOEnabled()) ? 35 : 30;
|
|
40
|
+
return value / (this.useCounterZoom ? getZoomFactor() : 1);
|
|
41
|
+
}
|
|
42
|
+
get maximumHeight() { return this.minimumHeight; }
|
|
43
|
+
constructor(contextMenuService, configurationService, environmentService, instantiationService, themeService, storageService, layoutService, contextKeyService, hostService, hoverService) {
|
|
44
|
+
super("workbench.parts.titlebar" , { hasTitle: false }, themeService, storageService, layoutService);
|
|
45
|
+
this.contextMenuService = contextMenuService;
|
|
46
|
+
this.configurationService = configurationService;
|
|
47
|
+
this.environmentService = environmentService;
|
|
48
|
+
this.instantiationService = instantiationService;
|
|
49
|
+
this.contextKeyService = contextKeyService;
|
|
50
|
+
this.hostService = hostService;
|
|
51
|
+
this.minimumWidth = 0;
|
|
52
|
+
this.maximumWidth = Number.POSITIVE_INFINITY;
|
|
53
|
+
this._onMenubarVisibilityChange = this._register(( new Emitter()));
|
|
54
|
+
this.onMenubarVisibilityChange = this._onMenubarVisibilityChange.event;
|
|
55
|
+
this._onDidChangeCommandCenterVisibility = ( new Emitter());
|
|
56
|
+
this.onDidChangeCommandCenterVisibility = this._onDidChangeCommandCenterVisibility.event;
|
|
57
|
+
this.titleDisposables = this._register(( new DisposableStore()));
|
|
58
|
+
this.isInactive = false;
|
|
59
|
+
this.windowTitle = this._register(instantiationService.createInstance(WindowTitle));
|
|
60
|
+
this.titleBarStyle = getTitleBarStyle(this.configurationService);
|
|
61
|
+
this.hoverDelegate = new (class {
|
|
62
|
+
constructor() {
|
|
63
|
+
this._lastHoverHideTime = 0;
|
|
64
|
+
this.showHover = hoverService.showHover.bind(hoverService);
|
|
65
|
+
this.placement = 'element';
|
|
66
|
+
}
|
|
67
|
+
get delay() {
|
|
68
|
+
return Date.now() - this._lastHoverHideTime < 200
|
|
69
|
+
? 0
|
|
70
|
+
: configurationService.getValue('workbench.hover.delay');
|
|
71
|
+
}
|
|
72
|
+
onDidHideHover() {
|
|
73
|
+
this._lastHoverHideTime = Date.now();
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
this.registerListeners();
|
|
77
|
+
}
|
|
78
|
+
updateProperties(properties) {
|
|
79
|
+
this.windowTitle.updateProperties(properties);
|
|
80
|
+
}
|
|
81
|
+
get isCommandCenterVisible() {
|
|
82
|
+
return this.configurationService.getValue(TitlebarPart_1.configCommandCenter);
|
|
83
|
+
}
|
|
84
|
+
registerListeners() {
|
|
85
|
+
this._register(this.hostService.onDidChangeFocus(focused => focused ? this.onFocus() : this.onBlur()));
|
|
86
|
+
this._register(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationChanged(e)));
|
|
87
|
+
}
|
|
88
|
+
onBlur() {
|
|
89
|
+
this.isInactive = true;
|
|
90
|
+
this.updateStyles();
|
|
91
|
+
}
|
|
92
|
+
onFocus() {
|
|
93
|
+
this.isInactive = false;
|
|
94
|
+
this.updateStyles();
|
|
95
|
+
}
|
|
96
|
+
onConfigurationChanged(event) {
|
|
97
|
+
if (this.titleBarStyle !== 'native' && (!isMacintosh || isWeb)) {
|
|
98
|
+
if (event.affectsConfiguration('window.menuBarVisibility')) {
|
|
99
|
+
if (this.currentMenubarVisibility === 'compact') {
|
|
100
|
+
this.uninstallMenubar();
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
this.installMenubar();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (this.titleBarStyle !== 'native' && this.layoutControls && event.affectsConfiguration('workbench.layoutControl.enabled')) {
|
|
108
|
+
this.layoutControls.classList.toggle('show-layout-control', this.layoutControlEnabled);
|
|
109
|
+
this._onDidChange.fire(undefined);
|
|
110
|
+
}
|
|
111
|
+
if (event.affectsConfiguration(TitlebarPart_1.configCommandCenter)) {
|
|
112
|
+
this.updateTitle();
|
|
113
|
+
this._onDidChangeCommandCenterVisibility.fire();
|
|
114
|
+
this._onDidChange.fire(undefined);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
onMenubarVisibilityChanged(visible) {
|
|
118
|
+
if (isWeb || isWindows || isLinux) {
|
|
119
|
+
if (this.lastLayoutDimensions) {
|
|
120
|
+
this.layout(this.lastLayoutDimensions.width, this.lastLayoutDimensions.height);
|
|
121
|
+
}
|
|
122
|
+
this._onMenubarVisibilityChange.fire(visible);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
uninstallMenubar() {
|
|
126
|
+
if (this.customMenubar) {
|
|
127
|
+
this.customMenubar.dispose();
|
|
128
|
+
this.customMenubar = undefined;
|
|
129
|
+
}
|
|
130
|
+
if (this.menubar) {
|
|
131
|
+
this.menubar.remove();
|
|
132
|
+
this.menubar = undefined;
|
|
133
|
+
}
|
|
134
|
+
this.onMenubarVisibilityChanged(false);
|
|
135
|
+
}
|
|
136
|
+
installMenubar() {
|
|
137
|
+
if (this.menubar) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
this.customMenubar = this._register(this.instantiationService.createInstance(CustomMenubarControl));
|
|
141
|
+
this.menubar = append(this.leftContent, $('div.menubar'));
|
|
142
|
+
this.menubar.setAttribute('role', 'menubar');
|
|
143
|
+
this._register(this.customMenubar.onVisibilityChange(e => this.onMenubarVisibilityChanged(e)));
|
|
144
|
+
this.customMenubar.create(this.menubar);
|
|
145
|
+
}
|
|
146
|
+
updateTitle() {
|
|
147
|
+
this.titleDisposables.clear();
|
|
148
|
+
if (!this.isCommandCenterVisible) {
|
|
149
|
+
this.title.innerText = this.windowTitle.value;
|
|
150
|
+
this.titleDisposables.add(this.windowTitle.onDidChange(() => {
|
|
151
|
+
this.title.innerText = this.windowTitle.value;
|
|
152
|
+
}));
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
const commandCenter = this.instantiationService.createInstance(CommandCenterControl, this.windowTitle, this.hoverDelegate);
|
|
156
|
+
reset(this.title, commandCenter.element);
|
|
157
|
+
this.titleDisposables.add(commandCenter);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
createContentArea(parent) {
|
|
161
|
+
this.element = parent;
|
|
162
|
+
this.rootContainer = append(parent, $('.titlebar-container'));
|
|
163
|
+
this.leftContent = append(this.rootContainer, $('.titlebar-left'));
|
|
164
|
+
this.centerContent = append(this.rootContainer, $('.titlebar-center'));
|
|
165
|
+
this.rightContent = append(this.rootContainer, $('.titlebar-right'));
|
|
166
|
+
if (!isMacintosh && !isWeb) {
|
|
167
|
+
this.appIcon = prepend(this.leftContent, $('a.window-appicon'));
|
|
168
|
+
if (isWeb) {
|
|
169
|
+
const homeIndicator = this.environmentService.options?.homeIndicator;
|
|
170
|
+
if (homeIndicator) {
|
|
171
|
+
const icon = getIconRegistry().getIcon(homeIndicator.icon) ? { id: homeIndicator.icon } : Codicon.code;
|
|
172
|
+
this.appIcon.setAttribute('href', homeIndicator.href);
|
|
173
|
+
this.appIcon.classList.add(...ThemeIcon.asClassNameArray(icon));
|
|
174
|
+
this.appIconBadge = document.createElement('div');
|
|
175
|
+
this.appIconBadge.classList.add('home-bar-icon-badge');
|
|
176
|
+
this.appIcon.appendChild(this.appIconBadge);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
this.dragRegion = prepend(this.rootContainer, $('div.titlebar-drag-region'));
|
|
181
|
+
if (this.titleBarStyle !== 'native'
|
|
182
|
+
&& (!isMacintosh || isWeb)
|
|
183
|
+
&& this.currentMenubarVisibility !== 'compact') {
|
|
184
|
+
this.installMenubar();
|
|
185
|
+
}
|
|
186
|
+
this.title = append(this.centerContent, $('div.window-title'));
|
|
187
|
+
this.updateTitle();
|
|
188
|
+
if (this.titleBarStyle !== 'native') {
|
|
189
|
+
this.layoutControls = append(this.rightContent, $('div.layout-controls-container'));
|
|
190
|
+
this.layoutControls.classList.toggle('show-layout-control', this.layoutControlEnabled);
|
|
191
|
+
this.layoutToolbar = this.instantiationService.createInstance(MenuWorkbenchToolBar, this.layoutControls, MenuId.LayoutControlMenu, {
|
|
192
|
+
contextMenu: MenuId.TitleBarContext,
|
|
193
|
+
toolbarOptions: { primaryGroup: () => true },
|
|
194
|
+
actionViewItemProvider: action => {
|
|
195
|
+
return createActionViewItem(this.instantiationService, action, { hoverDelegate: this.hoverDelegate });
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
let primaryControlLocation = isMacintosh ? 'left' : 'right';
|
|
200
|
+
if (isMacintosh && isNative) {
|
|
201
|
+
const localeInfo = new Intl.Locale(platformLocale);
|
|
202
|
+
if (localeInfo?.textInfo?.direction === 'rtl') {
|
|
203
|
+
primaryControlLocation = 'right';
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
this.primaryWindowControls = append(primaryControlLocation === 'left' ? this.leftContent : this.rightContent, $('div.window-controls-container.primary'));
|
|
207
|
+
append(primaryControlLocation === 'left' ? this.rightContent : this.leftContent, $('div.window-controls-container.secondary'));
|
|
208
|
+
[EventType.CONTEXT_MENU, EventType.MOUSE_DOWN].forEach(event => {
|
|
209
|
+
this._register(addDisposableListener(this.rootContainer, event, e => {
|
|
210
|
+
if (e.type === EventType.CONTEXT_MENU || (e.target === this.title && e.metaKey)) {
|
|
211
|
+
EventHelper.stop(e);
|
|
212
|
+
this.onContextMenu(e, e.target === this.title ? MenuId.TitleBarTitleContext : MenuId.TitleBarContext);
|
|
213
|
+
}
|
|
214
|
+
}));
|
|
215
|
+
});
|
|
216
|
+
this._register(addDisposableListener(this.element, EventType.MOUSE_DOWN, e => {
|
|
217
|
+
if (e.target && this.menubar && isAncestor(e.target, this.menubar)) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
if (e.target && this.layoutToolbar && isAncestor(e.target, this.layoutToolbar.getElement())) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (e.target && isAncestor(e.target, this.title)) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const active = document.activeElement;
|
|
227
|
+
setTimeout(() => {
|
|
228
|
+
if (active instanceof HTMLElement) {
|
|
229
|
+
active.focus();
|
|
230
|
+
}
|
|
231
|
+
}, 0 );
|
|
232
|
+
}, true ));
|
|
233
|
+
this.updateStyles();
|
|
234
|
+
const that = this;
|
|
235
|
+
registerAction2(class FocusTitleBar extends Action2 {
|
|
236
|
+
constructor() {
|
|
237
|
+
super({
|
|
238
|
+
id: `workbench.action.focusTitleBar`,
|
|
239
|
+
title: { value: ( localize('focusTitleBar', "Focus Title Bar")), original: 'Focus Title Bar' },
|
|
240
|
+
category: Categories.View,
|
|
241
|
+
f1: true,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
run(accessor, ...args) {
|
|
245
|
+
if (that.customMenubar) {
|
|
246
|
+
that.customMenubar.toggleFocus();
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
that.element.querySelector('[tabindex]:not([tabindex="-1"])').focus();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
return this.element;
|
|
254
|
+
}
|
|
255
|
+
updateStyles() {
|
|
256
|
+
super.updateStyles();
|
|
257
|
+
if (this.element) {
|
|
258
|
+
if (this.isInactive) {
|
|
259
|
+
this.element.classList.add('inactive');
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
this.element.classList.remove('inactive');
|
|
263
|
+
}
|
|
264
|
+
const titleBackground = this.getColor(this.isInactive ? TITLE_BAR_INACTIVE_BACKGROUND : TITLE_BAR_ACTIVE_BACKGROUND, (color, theme) => {
|
|
265
|
+
return color.isOpaque() ? color : color.makeOpaque(WORKBENCH_BACKGROUND(theme));
|
|
266
|
+
}) || '';
|
|
267
|
+
this.element.style.backgroundColor = titleBackground;
|
|
268
|
+
if (this.appIconBadge) {
|
|
269
|
+
this.appIconBadge.style.backgroundColor = titleBackground;
|
|
270
|
+
}
|
|
271
|
+
if (titleBackground && ( Color.fromHex(titleBackground)).isLighter()) {
|
|
272
|
+
this.element.classList.add('light');
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
this.element.classList.remove('light');
|
|
276
|
+
}
|
|
277
|
+
const titleForeground = this.getColor(this.isInactive ? TITLE_BAR_INACTIVE_FOREGROUND : TITLE_BAR_ACTIVE_FOREGROUND);
|
|
278
|
+
this.element.style.color = titleForeground || '';
|
|
279
|
+
const titleBorder = this.getColor(TITLE_BAR_BORDER);
|
|
280
|
+
this.element.style.borderBottom = titleBorder ? `1px solid ${titleBorder}` : '';
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
onContextMenu(e, menuId) {
|
|
284
|
+
const event = ( new StandardMouseEvent(e));
|
|
285
|
+
this.contextMenuService.showContextMenu({
|
|
286
|
+
getAnchor: () => event,
|
|
287
|
+
menuId,
|
|
288
|
+
contextKeyService: this.contextKeyService,
|
|
289
|
+
domForShadowRoot: isMacintosh && isNative ? event.target : undefined
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
get currentMenubarVisibility() {
|
|
293
|
+
return getMenuBarVisibility(this.configurationService);
|
|
294
|
+
}
|
|
295
|
+
get layoutControlEnabled() {
|
|
296
|
+
return this.configurationService.getValue('workbench.layoutControl.enabled');
|
|
297
|
+
}
|
|
298
|
+
get useCounterZoom() {
|
|
299
|
+
const zoomFactor = getZoomFactor();
|
|
300
|
+
const noMenubar = this.currentMenubarVisibility === 'hidden' || (!isWeb && isMacintosh);
|
|
301
|
+
const noCommandCenter = !this.isCommandCenterVisible;
|
|
302
|
+
const noLayoutControls = !this.layoutControlEnabled;
|
|
303
|
+
return zoomFactor < 1 || (noMenubar && noCommandCenter && noLayoutControls);
|
|
304
|
+
}
|
|
305
|
+
updateLayout(dimension) {
|
|
306
|
+
this.lastLayoutDimensions = dimension;
|
|
307
|
+
if (getTitleBarStyle(this.configurationService) === 'custom') {
|
|
308
|
+
const zoomFactor = getZoomFactor();
|
|
309
|
+
this.element.style.setProperty('--zoom-factor', ( zoomFactor.toString()));
|
|
310
|
+
this.rootContainer.classList.toggle('counter-zoom', this.useCounterZoom);
|
|
311
|
+
if (this.customMenubar) {
|
|
312
|
+
const menubarDimension = ( new Dimension(0, dimension.height));
|
|
313
|
+
this.customMenubar.layout(menubarDimension);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
layout(width, height) {
|
|
318
|
+
this.updateLayout(( new Dimension(width, height)));
|
|
319
|
+
super.layoutContents(width, height);
|
|
320
|
+
}
|
|
321
|
+
toJSON() {
|
|
322
|
+
return {
|
|
323
|
+
type: "workbench.parts.titlebar"
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
TitlebarPart = TitlebarPart_1 = ( __decorate([
|
|
328
|
+
( __param(0, IContextMenuService)),
|
|
329
|
+
( __param(1, IConfigurationService)),
|
|
330
|
+
( __param(2, IBrowserWorkbenchEnvironmentService)),
|
|
331
|
+
( __param(3, IInstantiationService)),
|
|
332
|
+
( __param(4, IThemeService)),
|
|
333
|
+
( __param(5, IStorageService)),
|
|
334
|
+
( __param(6, IWorkbenchLayoutService)),
|
|
335
|
+
( __param(7, IContextKeyService)),
|
|
336
|
+
( __param(8, IHostService)),
|
|
337
|
+
( __param(9, IHoverService))
|
|
338
|
+
], TitlebarPart));
|
|
339
|
+
class ToogleConfigAction extends Action2 {
|
|
340
|
+
constructor(section, title, order) {
|
|
341
|
+
super({
|
|
342
|
+
id: `toggle.${section}`,
|
|
343
|
+
title,
|
|
344
|
+
toggled: ( ContextKeyExpr.equals(`config.${section}`, true)),
|
|
345
|
+
menu: { id: MenuId.TitleBarContext, order }
|
|
346
|
+
});
|
|
347
|
+
this.section = section;
|
|
348
|
+
}
|
|
349
|
+
run(accessor, ...args) {
|
|
350
|
+
const configService = accessor.get(IConfigurationService);
|
|
351
|
+
const value = configService.getValue(this.section);
|
|
352
|
+
configService.updateValue(this.section, !value);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
registerAction2(class ToogleCommandCenter extends ToogleConfigAction {
|
|
356
|
+
constructor() {
|
|
357
|
+
super('window.commandCenter', ( localize('toggle.commandCenter', 'Command Center')), 1);
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
registerAction2(class ToogleLayoutControl extends ToogleConfigAction {
|
|
361
|
+
constructor() {
|
|
362
|
+
super('workbench.layoutControl.enabled', ( localize('toggle.layout', 'Layout Controls')), 2);
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
export { TitlebarPart };
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
3
|
+
import { dirname, basename } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
4
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
5
|
+
import { IEditorService } from '../../../services/editor/common/editorService.js';
|
|
6
|
+
import { Disposable, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
7
|
+
import { EditorResourceAccessor, SideBySideEditor } from '../../../common/editor.js';
|
|
8
|
+
import { IBrowserWorkbenchEnvironmentService } from '../../../services/environment/browser/environmentService.js';
|
|
9
|
+
import { IWorkspaceContextService } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
|
|
10
|
+
import { isWindows, isMacintosh, isWeb } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
11
|
+
import { trim } from 'monaco-editor/esm/vs/base/common/strings.js';
|
|
12
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
13
|
+
import { template } from 'monaco-editor/esm/vs/base/common/labels.js';
|
|
14
|
+
import { ILabelService } from 'monaco-editor/esm/vs/platform/label/common/label.js';
|
|
15
|
+
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
16
|
+
import { RunOnceScheduler } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
17
|
+
import { IProductService } from 'monaco-editor/esm/vs/platform/product/common/productService.js';
|
|
18
|
+
import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
|
|
19
|
+
import { getVirtualWorkspaceLocation } from '../../../../platform/workspace/common/virtualWorkspace.js';
|
|
20
|
+
import { IUserDataProfileService } from '../../../services/userDataProfile/common/userDataProfile.js';
|
|
21
|
+
import { IViewsService } from '../../../common/views.js';
|
|
22
|
+
var WindowTitle_1;
|
|
23
|
+
let WindowTitle = class WindowTitle extends Disposable {
|
|
24
|
+
static { WindowTitle_1 = this; }
|
|
25
|
+
static { this.NLS_USER_IS_ADMIN = isWindows ? ( localize('userIsAdmin', "[Administrator]")) : ( localize('userIsSudo', "[Superuser]")); }
|
|
26
|
+
static { this.NLS_EXTENSION_HOST = ( localize('devExtensionWindowTitlePrefix', "[Extension Development Host]")); }
|
|
27
|
+
static { this.TITLE_DIRTY = '\u25cf '; }
|
|
28
|
+
constructor(configurationService, editorService, environmentService, contextService, instantiationService, labelService, userDataProfileService, productService, viewsService) {
|
|
29
|
+
super();
|
|
30
|
+
this.configurationService = configurationService;
|
|
31
|
+
this.editorService = editorService;
|
|
32
|
+
this.environmentService = environmentService;
|
|
33
|
+
this.contextService = contextService;
|
|
34
|
+
this.instantiationService = instantiationService;
|
|
35
|
+
this.labelService = labelService;
|
|
36
|
+
this.userDataProfileService = userDataProfileService;
|
|
37
|
+
this.productService = productService;
|
|
38
|
+
this.viewsService = viewsService;
|
|
39
|
+
this.properties = { isPure: true, isAdmin: false, prefix: undefined };
|
|
40
|
+
this.activeEditorListeners = this._register(( new DisposableStore()));
|
|
41
|
+
this.titleUpdater = this._register(( new RunOnceScheduler(() => this.doUpdateTitle(), 0)));
|
|
42
|
+
this.onDidChangeEmitter = ( new Emitter());
|
|
43
|
+
this.onDidChange = this.onDidChangeEmitter.event;
|
|
44
|
+
this.registerListeners();
|
|
45
|
+
}
|
|
46
|
+
get value() {
|
|
47
|
+
return this.title ?? '';
|
|
48
|
+
}
|
|
49
|
+
get workspaceName() {
|
|
50
|
+
return this.labelService.getWorkspaceLabel(this.contextService.getWorkspace());
|
|
51
|
+
}
|
|
52
|
+
registerListeners() {
|
|
53
|
+
this._register(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationChanged(e)));
|
|
54
|
+
this._register(this.editorService.onDidActiveEditorChange(() => this.onActiveEditorChange()));
|
|
55
|
+
this._register(this.contextService.onDidChangeWorkspaceFolders(() => this.titleUpdater.schedule()));
|
|
56
|
+
this._register(this.contextService.onDidChangeWorkbenchState(() => this.titleUpdater.schedule()));
|
|
57
|
+
this._register(this.contextService.onDidChangeWorkspaceName(() => this.titleUpdater.schedule()));
|
|
58
|
+
this._register(this.labelService.onDidChangeFormatters(() => this.titleUpdater.schedule()));
|
|
59
|
+
this._register(this.userDataProfileService.onDidChangeCurrentProfile(() => this.titleUpdater.schedule()));
|
|
60
|
+
this._register(this.viewsService.onDidChangeFocusedView(() => this.titleUpdater.schedule()));
|
|
61
|
+
}
|
|
62
|
+
onConfigurationChanged(event) {
|
|
63
|
+
if (event.affectsConfiguration("window.title" ) || event.affectsConfiguration("window.titleSeparator" )) {
|
|
64
|
+
this.titleUpdater.schedule();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
onActiveEditorChange() {
|
|
68
|
+
this.activeEditorListeners.clear();
|
|
69
|
+
this.titleUpdater.schedule();
|
|
70
|
+
const activeEditor = this.editorService.activeEditor;
|
|
71
|
+
if (activeEditor) {
|
|
72
|
+
this.activeEditorListeners.add(activeEditor.onDidChangeDirty(() => this.titleUpdater.schedule()));
|
|
73
|
+
this.activeEditorListeners.add(activeEditor.onDidChangeLabel(() => this.titleUpdater.schedule()));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
doUpdateTitle() {
|
|
77
|
+
const title = this.getFullWindowTitle();
|
|
78
|
+
if (title !== this.title) {
|
|
79
|
+
let nativeTitle = title;
|
|
80
|
+
if (!trim(nativeTitle)) {
|
|
81
|
+
nativeTitle = this.productService.nameLong;
|
|
82
|
+
}
|
|
83
|
+
if (!window.document.title && isMacintosh && nativeTitle === this.productService.nameLong) {
|
|
84
|
+
window.document.title = `${this.productService.nameLong} ${WindowTitle_1.TITLE_DIRTY}`;
|
|
85
|
+
}
|
|
86
|
+
window.document.title = nativeTitle;
|
|
87
|
+
this.title = title;
|
|
88
|
+
this.onDidChangeEmitter.fire();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
getFullWindowTitle() {
|
|
92
|
+
let title = this.getWindowTitle() || this.productService.nameLong;
|
|
93
|
+
const { prefix, suffix } = this.getTitleDecorations();
|
|
94
|
+
if (prefix) {
|
|
95
|
+
title = `${prefix} ${title}`;
|
|
96
|
+
}
|
|
97
|
+
if (suffix) {
|
|
98
|
+
title = `${title} ${suffix}`;
|
|
99
|
+
}
|
|
100
|
+
title = title.replace(/[^\S ]/g, ' ');
|
|
101
|
+
return title;
|
|
102
|
+
}
|
|
103
|
+
getTitleDecorations() {
|
|
104
|
+
let prefix;
|
|
105
|
+
let suffix;
|
|
106
|
+
if (this.properties.prefix) {
|
|
107
|
+
prefix = this.properties.prefix;
|
|
108
|
+
}
|
|
109
|
+
if (this.environmentService.isExtensionDevelopment) {
|
|
110
|
+
prefix = !prefix
|
|
111
|
+
? WindowTitle_1.NLS_EXTENSION_HOST
|
|
112
|
+
: `${WindowTitle_1.NLS_EXTENSION_HOST} - ${prefix}`;
|
|
113
|
+
}
|
|
114
|
+
if (this.properties.isAdmin) {
|
|
115
|
+
suffix = WindowTitle_1.NLS_USER_IS_ADMIN;
|
|
116
|
+
}
|
|
117
|
+
return { prefix, suffix };
|
|
118
|
+
}
|
|
119
|
+
updateProperties(properties) {
|
|
120
|
+
const isAdmin = typeof properties.isAdmin === 'boolean' ? properties.isAdmin : this.properties.isAdmin;
|
|
121
|
+
const isPure = typeof properties.isPure === 'boolean' ? properties.isPure : this.properties.isPure;
|
|
122
|
+
const prefix = typeof properties.prefix === 'string' ? properties.prefix : this.properties.prefix;
|
|
123
|
+
if (isAdmin !== this.properties.isAdmin || isPure !== this.properties.isPure || prefix !== this.properties.prefix) {
|
|
124
|
+
this.properties.isAdmin = isAdmin;
|
|
125
|
+
this.properties.isPure = isPure;
|
|
126
|
+
this.properties.prefix = prefix;
|
|
127
|
+
this.titleUpdater.schedule();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
getWindowTitle() {
|
|
131
|
+
const editor = this.editorService.activeEditor;
|
|
132
|
+
const workspace = this.contextService.getWorkspace();
|
|
133
|
+
let root;
|
|
134
|
+
if (workspace.configuration) {
|
|
135
|
+
root = workspace.configuration;
|
|
136
|
+
}
|
|
137
|
+
else if (workspace.folders.length) {
|
|
138
|
+
root = workspace.folders[0].uri;
|
|
139
|
+
}
|
|
140
|
+
const editorResource = EditorResourceAccessor.getOriginalUri(editor, { supportSideBySide: SideBySideEditor.PRIMARY });
|
|
141
|
+
let editorFolderResource = editorResource ? dirname(editorResource) : undefined;
|
|
142
|
+
if (editorFolderResource?.path === '.') {
|
|
143
|
+
editorFolderResource = undefined;
|
|
144
|
+
}
|
|
145
|
+
let folder = undefined;
|
|
146
|
+
if (this.contextService.getWorkbenchState() === 2 ) {
|
|
147
|
+
folder = workspace.folders[0];
|
|
148
|
+
}
|
|
149
|
+
else if (editorResource) {
|
|
150
|
+
folder = this.contextService.getWorkspaceFolder(editorResource) ?? undefined;
|
|
151
|
+
}
|
|
152
|
+
let remoteName = undefined;
|
|
153
|
+
if (this.environmentService.remoteAuthority && !isWeb) {
|
|
154
|
+
remoteName = this.labelService.getHostLabel(Schemas.vscodeRemote, this.environmentService.remoteAuthority);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
const virtualWorkspaceLocation = getVirtualWorkspaceLocation(workspace);
|
|
158
|
+
if (virtualWorkspaceLocation) {
|
|
159
|
+
remoteName = this.labelService.getHostLabel(virtualWorkspaceLocation.scheme, virtualWorkspaceLocation.authority);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const activeEditorShort = editor ? editor.getTitle(0 ) : '';
|
|
163
|
+
const activeEditorMedium = editor ? editor.getTitle(1 ) : activeEditorShort;
|
|
164
|
+
const activeEditorLong = editor ? editor.getTitle(2 ) : activeEditorMedium;
|
|
165
|
+
const activeFolderShort = editorFolderResource ? basename(editorFolderResource) : '';
|
|
166
|
+
const activeFolderMedium = editorFolderResource ? this.labelService.getUriLabel(editorFolderResource, { relative: true }) : '';
|
|
167
|
+
const activeFolderLong = editorFolderResource ? this.labelService.getUriLabel(editorFolderResource) : '';
|
|
168
|
+
const rootName = this.labelService.getWorkspaceLabel(workspace);
|
|
169
|
+
const rootNameShort = this.labelService.getWorkspaceLabel(workspace, { verbose: 0 });
|
|
170
|
+
const rootPath = root ? this.labelService.getUriLabel(root) : '';
|
|
171
|
+
const folderName = folder ? folder.name : '';
|
|
172
|
+
const folderPath = folder ? this.labelService.getUriLabel(folder.uri) : '';
|
|
173
|
+
const dirty = editor?.isDirty() && !editor.isSaving() ? WindowTitle_1.TITLE_DIRTY : '';
|
|
174
|
+
const appName = this.productService.nameLong;
|
|
175
|
+
const profileName = this.userDataProfileService.currentProfile.isDefault ? '' : this.userDataProfileService.currentProfile.name;
|
|
176
|
+
const separator = this.configurationService.getValue("window.titleSeparator" );
|
|
177
|
+
const titleTemplate = this.configurationService.getValue("window.title" );
|
|
178
|
+
const focusedView = this.viewsService.getFocusedViewName();
|
|
179
|
+
return template(titleTemplate, {
|
|
180
|
+
activeEditorShort,
|
|
181
|
+
activeEditorLong,
|
|
182
|
+
activeEditorMedium,
|
|
183
|
+
activeFolderShort,
|
|
184
|
+
activeFolderMedium,
|
|
185
|
+
activeFolderLong,
|
|
186
|
+
rootName,
|
|
187
|
+
rootPath,
|
|
188
|
+
rootNameShort,
|
|
189
|
+
folderName,
|
|
190
|
+
folderPath,
|
|
191
|
+
dirty,
|
|
192
|
+
appName,
|
|
193
|
+
remoteName,
|
|
194
|
+
profileName,
|
|
195
|
+
focusedView,
|
|
196
|
+
separator: { label: separator }
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
isCustomTitleFormat() {
|
|
200
|
+
const title = this.configurationService.inspect("window.title" );
|
|
201
|
+
const titleSeparator = this.configurationService.inspect("window.titleSeparator" );
|
|
202
|
+
return title.value !== title.defaultValue || titleSeparator.value !== titleSeparator.defaultValue;
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
WindowTitle = WindowTitle_1 = ( __decorate([
|
|
206
|
+
( __param(0, IConfigurationService)),
|
|
207
|
+
( __param(1, IEditorService)),
|
|
208
|
+
( __param(2, IBrowserWorkbenchEnvironmentService)),
|
|
209
|
+
( __param(3, IWorkspaceContextService)),
|
|
210
|
+
( __param(4, IInstantiationService)),
|
|
211
|
+
( __param(5, ILabelService)),
|
|
212
|
+
( __param(6, IUserDataProfileService)),
|
|
213
|
+
( __param(7, IProductService)),
|
|
214
|
+
( __param(8, IViewsService))
|
|
215
|
+
], WindowTitle));
|
|
216
|
+
export { WindowTitle };
|
|
@@ -69,6 +69,7 @@ const SideBarVisibleContext = ( new RawContextKey('sideBarVisible', false, ( loc
|
|
|
69
69
|
const SidebarFocusContext = ( new RawContextKey('sideBarFocus', false, ( localize('sideBarFocus', "Whether the sidebar has keyboard focus"))));
|
|
70
70
|
const ActiveViewletContext = ( new RawContextKey('activeViewlet', '', ( localize('activeViewlet', "The identifier of the active viewlet"))));
|
|
71
71
|
const StatusBarFocused = ( new RawContextKey('statusBarFocused', false, ( localize('statusBarFocused', "Whether the status bar has keyboard focus"))));
|
|
72
|
+
const BannerFocused = ( new RawContextKey('bannerFocused', false, ( localize('bannerFocused', "Whether the banner has keyboard focus"))));
|
|
72
73
|
const NotificationFocusedContext = ( new RawContextKey('notificationFocus', true, ( localize('notificationFocus', "Whether a notification has keyboard focus"))));
|
|
73
74
|
const NotificationsCenterVisibleContext = ( new RawContextKey('notificationCenterVisible', false, ( localize('notificationCenterVisible', "Whether the notifications center is visible"))));
|
|
74
75
|
const NotificationsToastsVisibleContext = ( new RawContextKey('notificationToastsVisible', false, ( localize('notificationToastsVisible', "Whether a notification toast is visible"))));
|
|
@@ -220,4 +221,4 @@ function applyAvailableEditorIds(contextKey, editor, editorResolverService) {
|
|
|
220
221
|
contextKey.set(editors.join(','));
|
|
221
222
|
}
|
|
222
223
|
}
|
|
223
|
-
export { ActiveAuxiliaryContext, ActiveEditorAvailableEditorIdsContext, ActiveEditorCanSplitInGroupContext, ActiveEditorCanToggleReadonlyContext, ActiveEditorContext, ActiveEditorDirtyContext, ActiveEditorFirstInGroupContext, ActiveEditorGroupEmptyContext, ActiveEditorGroupLockedContext, ActiveEditorLastInGroupContext, ActiveEditorPinnedContext, ActiveEditorStickyContext, ActivePanelContext, ActiveViewletContext, AuxiliaryBarFocusContext, AuxiliaryBarVisibleContext, DirtyWorkingCopiesContext, EditorGroupEditorsCountContext, EditorTabsVisibleContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, FocusedViewContext, HasWebFileSystemAccess, InEditorZenModeContext, IsCenteredLayoutContext, IsFullscreenContext, MultipleEditorGroupsContext, NotificationFocusedContext, NotificationsCenterVisibleContext, NotificationsToastsVisibleContext, OpenFolderWorkspaceSupportContext, PanelAlignmentContext, PanelFocusContext, PanelPositionContext, PanelVisibleContext, RemoteNameContext, ResourceContextKey, SideBarVisibleContext, SideBySideEditorActiveContext, SidebarFocusContext, StatusBarFocused, TextCompareEditorActiveContext, TextCompareEditorVisibleContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, applyAvailableEditorIds, getEnabledViewContainerContextKey, getVisbileViewContextKey };
|
|
224
|
+
export { ActiveAuxiliaryContext, ActiveEditorAvailableEditorIdsContext, ActiveEditorCanSplitInGroupContext, ActiveEditorCanToggleReadonlyContext, ActiveEditorContext, ActiveEditorDirtyContext, ActiveEditorFirstInGroupContext, ActiveEditorGroupEmptyContext, ActiveEditorGroupLockedContext, ActiveEditorLastInGroupContext, ActiveEditorPinnedContext, ActiveEditorStickyContext, ActivePanelContext, ActiveViewletContext, AuxiliaryBarFocusContext, AuxiliaryBarVisibleContext, BannerFocused, DirtyWorkingCopiesContext, EditorGroupEditorsCountContext, EditorTabsVisibleContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, FocusedViewContext, HasWebFileSystemAccess, InEditorZenModeContext, IsCenteredLayoutContext, IsFullscreenContext, MultipleEditorGroupsContext, NotificationFocusedContext, NotificationsCenterVisibleContext, NotificationsToastsVisibleContext, OpenFolderWorkspaceSupportContext, PanelAlignmentContext, PanelFocusContext, PanelPositionContext, PanelVisibleContext, RemoteNameContext, ResourceContextKey, SideBarVisibleContext, SideBySideEditorActiveContext, SidebarFocusContext, StatusBarFocused, TextCompareEditorActiveContext, TextCompareEditorVisibleContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, applyAvailableEditorIds, getEnabledViewContainerContextKey, getVisbileViewContextKey };
|