@codingame/monaco-vscode-api 1.82.2 → 1.82.4-next.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.
Files changed (58) hide show
  1. package/README.md +2 -0
  2. package/missing-services.js +23 -6
  3. package/monaco-editor-treemending.patch +1026 -1026
  4. package/package.json +1 -1
  5. package/service-override/keybindings.js +11 -0
  6. package/service-override/quickaccess.js +1 -1
  7. package/service-override/tools/editor.d.ts +1 -1
  8. package/service-override/viewBanner.d.ts +6 -0
  9. package/service-override/viewBanner.js +10 -0
  10. package/service-override/viewStatusBar.d.ts +6 -0
  11. package/service-override/viewStatusBar.js +10 -0
  12. package/service-override/viewTitleBar.d.ts +6 -0
  13. package/service-override/viewTitleBar.js +10 -0
  14. package/service-override/views.d.ts +0 -1
  15. package/service-override/views.js +14 -6
  16. package/service-override/workspaceTrust.d.ts +5 -0
  17. package/service-override/workspaceTrust.js +13 -0
  18. package/services.d.ts +3 -0
  19. package/services.js +3 -0
  20. package/vscode/src/vs/base/common/actions.d.ts +15 -1
  21. package/vscode/src/vs/base/common/async.d.ts +31 -1
  22. package/vscode/src/vs/base/common/htmlContent.d.ts +23 -2
  23. package/vscode/src/vs/platform/backup/common/backup.d.ts +14 -0
  24. package/vscode/src/vs/platform/extensionManagement/common/extensionManagementUtil.js +16 -1
  25. package/vscode/src/vs/platform/label/common/label.d.ts +62 -0
  26. package/vscode/src/vs/platform/opener/browser/link.d.ts +8 -0
  27. package/vscode/src/vs/platform/update/common/update.d.ts +112 -0
  28. package/vscode/src/vs/platform/window/common/window.d.ts +2 -1
  29. package/vscode/src/vs/platform/workspace/common/workspaceTrust.d.ts +34 -1
  30. package/vscode/src/vs/platform/workspaces/common/workspaces.d.ts +43 -1
  31. package/vscode/src/vs/workbench/browser/contextkeys.js +249 -0
  32. package/vscode/src/vs/workbench/browser/parts/banner/bannerPart.d.ts +45 -0
  33. package/vscode/src/vs/workbench/browser/parts/banner/bannerPart.js +228 -0
  34. package/vscode/src/vs/workbench/browser/parts/banner/media/bannerpart.css.js +4 -0
  35. package/vscode/src/vs/workbench/browser/parts/panel/panelActions.js +21 -0
  36. package/vscode/src/vs/workbench/browser/parts/titlebar/commandCenterControl.js +134 -0
  37. package/vscode/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css.js +4 -0
  38. package/vscode/src/vs/workbench/browser/parts/titlebar/menubarControl.d.ts +115 -0
  39. package/vscode/src/vs/workbench/browser/parts/titlebar/titlebarPart.d.ts +77 -0
  40. package/vscode/src/vs/workbench/browser/parts/titlebar/titlebarPart.js +365 -0
  41. package/vscode/src/vs/workbench/browser/parts/titlebar/windowTitle.js +216 -0
  42. package/vscode/src/vs/workbench/common/contextkeys.js +21 -1
  43. package/vscode/src/vs/workbench/common/theme.js +6 -6
  44. package/vscode/src/vs/workbench/contrib/extensions/common/extensions.js +2 -1
  45. package/vscode/src/vs/workbench/contrib/preferences/browser/preferences.contribution.js +108 -4
  46. package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +2 -2
  47. package/vscode/src/vs/workbench/contrib/workspace/browser/media/workspaceTrustEditor.css.js +4 -0
  48. package/vscode/src/vs/workbench/contrib/workspace/browser/workspace.contribution.js +842 -0
  49. package/vscode/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.js +1047 -0
  50. package/vscode/src/vs/workbench/contrib/workspace/common/workspace.js +14 -0
  51. package/vscode/src/vs/workbench/services/banner/browser/bannerService.d.ts +25 -0
  52. package/vscode/src/vs/workbench/services/banner/browser/bannerService.js +3 -0
  53. package/vscode/src/vs/workbench/services/themes/common/themeCompatibility.js +10 -10
  54. package/vscode/src/vs/workbench/services/title/common/titleService.d.ts +31 -0
  55. package/vscode/src/vs/workbench/services/title/common/titleService.js +3 -0
  56. package/vscode/src/vs/workbench/services/userDataProfile/common/userDataProfile.js +3 -1
  57. package/vscode/src/vs/workbench/services/workspaces/browser/workspaceTrustEditorInput.js +27 -0
  58. package/vscode/src/vs/workbench/services/workspaces/common/workspaceTrust.js +649 -1
@@ -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 };
@@ -29,8 +29,16 @@ const VirtualWorkspaceContext = ( new RawContextKey('virtualWorkspace', '', ( lo
29
29
  'virtualWorkspace',
30
30
  "The scheme of the current workspace is from a virtual file system or an empty string."
31
31
  ))));
32
+ const TemporaryWorkspaceContext = ( new RawContextKey('temporaryWorkspace', false, ( localize(
33
+ 'temporaryWorkspace',
34
+ "The scheme of the current workspace is from a temporary file system."
35
+ ))));
32
36
  const IsFullscreenContext = ( new RawContextKey('isFullscreen', false, ( localize('isFullscreen', "Whether the window is in fullscreen mode"))));
33
37
  const HasWebFileSystemAccess = ( new RawContextKey('hasWebFileSystemAccess', false, true));
38
+ const EmbedderIdentifierContext = ( new RawContextKey('embedderIdentifier', undefined, ( localize(
39
+ 'embedderIdentifier',
40
+ 'The identifier of the embedder according to the product service, if one is defined'
41
+ ))));
34
42
  const ActiveEditorDirtyContext = ( new RawContextKey('activeEditorIsDirty', false, ( localize('activeEditorIsDirty', "Whether the active editor has unsaved changes"))));
35
43
  const ActiveEditorPinnedContext = ( new RawContextKey('activeEditorIsNotPreview', false, ( localize(
36
44
  'activeEditorIsNotPreview',
@@ -45,10 +53,12 @@ const ActiveEditorLastInGroupContext = ( new RawContextKey('activeEditorIsLastIn
45
53
  "Whether the active editor is the last one in its group"
46
54
  ))));
47
55
  const ActiveEditorStickyContext = ( new RawContextKey('activeEditorIsPinned', false, ( localize('activeEditorIsPinned', "Whether the active editor is pinned"))));
56
+ const ActiveEditorReadonlyContext = ( new RawContextKey('activeEditorIsReadonly', false, ( localize('activeEditorIsReadonly', "Whether the active editor is read-only"))));
48
57
  const ActiveEditorCanToggleReadonlyContext = ( new RawContextKey('activeEditorCanToggleReadonly', true, ( localize(
49
58
  'activeEditorCanToggleReadonly',
50
59
  "Whether the active editor can toggle between being read-only or writeable"
51
60
  ))));
61
+ const ActiveEditorCanRevertContext = ( new RawContextKey('activeEditorCanRevert', false, ( localize('activeEditorCanRevert', "Whether the active editor can revert"))));
52
62
  const ActiveEditorCanSplitInGroupContext = ( new RawContextKey('activeEditorCanSplitInGroup', true));
53
63
  const ActiveEditorContext = ( new RawContextKey('activeEditor', null, { type: 'string', description: ( localize('activeEditor', "The identifier of the active editor")) }));
54
64
  const ActiveEditorAvailableEditorIdsContext = ( new RawContextKey('activeEditorAvailableEditorIds', '', ( localize(
@@ -60,15 +70,24 @@ const TextCompareEditorActiveContext = ( new RawContextKey('textCompareEditorAct
60
70
  const SideBySideEditorActiveContext = ( new RawContextKey('sideBySideEditorActive', false, ( localize('sideBySideEditorActive', "Whether a side by side editor is active"))));
61
71
  const EditorGroupEditorsCountContext = ( new RawContextKey('groupEditorsCount', 0, ( localize('groupEditorsCount', "The number of opened editor groups"))));
62
72
  const ActiveEditorGroupEmptyContext = ( new RawContextKey('activeEditorGroupEmpty', false, ( localize('activeEditorGroupEmpty', "Whether the active editor group is empty"))));
73
+ const ActiveEditorGroupIndexContext = ( new RawContextKey('activeEditorGroupIndex', 0, ( localize('activeEditorGroupIndex', "The index of the active editor group"))));
74
+ const ActiveEditorGroupLastContext = ( new RawContextKey('activeEditorGroupLast', false, ( localize(
75
+ 'activeEditorGroupLast',
76
+ "Whether the active editor group is the last group"
77
+ ))));
63
78
  const ActiveEditorGroupLockedContext = ( new RawContextKey('activeEditorGroupLocked', false, ( localize('activeEditorGroupLocked', "Whether the active editor group is locked"))));
64
79
  const MultipleEditorGroupsContext = ( new RawContextKey('multipleEditorGroups', false, ( localize('multipleEditorGroups', "Whether there are multiple editor groups opened"))));
80
+ const EditorsVisibleContext = ( new RawContextKey('editorIsOpen', false, ( localize('editorIsOpen', "Whether an editor is open"))));
65
81
  const InEditorZenModeContext = ( new RawContextKey('inZenMode', false, ( localize('inZenMode', "Whether Zen mode is enabled"))));
66
82
  const IsCenteredLayoutContext = ( new RawContextKey('isCenteredLayout', false, ( localize('isCenteredLayout', "Whether centered layout is enabled"))));
83
+ const SplitEditorsVertically = ( new RawContextKey('splitEditorsVertically', false, ( localize('splitEditorsVertically', "Whether editors split vertically"))));
84
+ const EditorAreaVisibleContext = ( new RawContextKey('editorAreaVisible', true, ( localize('editorAreaVisible', "Whether the editor area is visible"))));
67
85
  const EditorTabsVisibleContext = ( new RawContextKey('editorTabsVisible', true, ( localize('editorTabsVisible', "Whether editor tabs are visible"))));
68
86
  const SideBarVisibleContext = ( new RawContextKey('sideBarVisible', false, ( localize('sideBarVisible', "Whether the sidebar is visible"))));
69
87
  const SidebarFocusContext = ( new RawContextKey('sideBarFocus', false, ( localize('sideBarFocus', "Whether the sidebar has keyboard focus"))));
70
88
  const ActiveViewletContext = ( new RawContextKey('activeViewlet', '', ( localize('activeViewlet', "The identifier of the active viewlet"))));
71
89
  const StatusBarFocused = ( new RawContextKey('statusBarFocused', false, ( localize('statusBarFocused', "Whether the status bar has keyboard focus"))));
90
+ const BannerFocused = ( new RawContextKey('bannerFocused', false, ( localize('bannerFocused', "Whether the banner has keyboard focus"))));
72
91
  const NotificationFocusedContext = ( new RawContextKey('notificationFocus', true, ( localize('notificationFocus', "Whether a notification has keyboard focus"))));
73
92
  const NotificationsCenterVisibleContext = ( new RawContextKey('notificationCenterVisible', false, ( localize('notificationCenterVisible', "Whether the notifications center is visible"))));
74
93
  const NotificationsToastsVisibleContext = ( new RawContextKey('notificationToastsVisible', false, ( localize('notificationToastsVisible', "Whether a notification toast is visible"))));
@@ -83,6 +102,7 @@ const PanelAlignmentContext = ( new RawContextKey('panelAlignment', 'center', (
83
102
  "The alignment of the panel, either 'center', 'left', 'right' or 'justify'"
84
103
  ))));
85
104
  const PanelVisibleContext = ( new RawContextKey('panelVisible', false, ( localize('panelVisible', "Whether the panel is visible"))));
105
+ const PanelMaximizedContext = ( new RawContextKey('panelMaximized', false, ( localize('panelMaximized', "Whether the panel is maximized"))));
86
106
  const FocusedViewContext = ( new RawContextKey('focusedView', '', ( localize('focusedView', "The identifier of the view that has keyboard focus"))));
87
107
  function getVisbileViewContextKey(viewId) { return `view.${viewId}.visible`; }
88
108
  function getEnabledViewContainerContextKey(viewContainerId) { return `viewContainer.${viewContainerId}.enabled`; }
@@ -220,4 +240,4 @@ function applyAvailableEditorIds(contextKey, editor, editorResolverService) {
220
240
  contextKey.set(editors.join(','));
221
241
  }
222
242
  }
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 };
243
+ export { ActiveAuxiliaryContext, ActiveEditorAvailableEditorIdsContext, ActiveEditorCanRevertContext, ActiveEditorCanSplitInGroupContext, ActiveEditorCanToggleReadonlyContext, ActiveEditorContext, ActiveEditorDirtyContext, ActiveEditorFirstInGroupContext, ActiveEditorGroupEmptyContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorGroupLockedContext, ActiveEditorLastInGroupContext, ActiveEditorPinnedContext, ActiveEditorReadonlyContext, ActiveEditorStickyContext, ActivePanelContext, ActiveViewletContext, AuxiliaryBarFocusContext, AuxiliaryBarVisibleContext, BannerFocused, DirtyWorkingCopiesContext, EditorAreaVisibleContext, EditorGroupEditorsCountContext, EditorTabsVisibleContext, EditorsVisibleContext, EmbedderIdentifierContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, FocusedViewContext, HasWebFileSystemAccess, InEditorZenModeContext, IsCenteredLayoutContext, IsFullscreenContext, MultipleEditorGroupsContext, NotificationFocusedContext, NotificationsCenterVisibleContext, NotificationsToastsVisibleContext, OpenFolderWorkspaceSupportContext, PanelAlignmentContext, PanelFocusContext, PanelMaximizedContext, PanelPositionContext, PanelVisibleContext, RemoteNameContext, ResourceContextKey, SideBarVisibleContext, SideBySideEditorActiveContext, SidebarFocusContext, SplitEditorsVertically, StatusBarFocused, TemporaryWorkspaceContext, TextCompareEditorActiveContext, TextCompareEditorVisibleContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, applyAvailableEditorIds, getEnabledViewContainerContextKey, getVisbileViewContextKey };