@codingame/monaco-vscode-workbench-service-override 25.1.1 → 26.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -8
- package/vscode/src/vs/workbench/browser/layout.d.ts +6 -5
- package/vscode/src/vs/workbench/browser/layout.js +871 -560
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationAccessibleView.js +29 -33
- package/vscode/src/vs/workbench/browser/workbench.js +155 -64
|
@@ -8,52 +8,52 @@ import { coalesce } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arr
|
|
|
8
8
|
import { DeferredPromise, Promises } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
9
9
|
import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
10
10
|
import { Disposable, toDisposable, DisposableStore, DisposableMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
11
|
-
import { mark } from '@codingame/monaco-vscode-api/vscode/vs/base/common/performance';
|
|
12
11
|
import { isWindows, isLinux, isWeb, isIOS, isMacintosh } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
12
|
+
import { pathsToEditors, isResourceEditorInput, EditorInputCapabilities } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
|
|
13
|
+
import { SidebarPart } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/sidebar/sidebarPart';
|
|
14
|
+
import { PanelPart } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/panel/panelPart';
|
|
15
|
+
import { LayoutSettings, Parts, EditorActionsLocation, ActivityBarPosition, shouldShowCustomTitleBar, Position, isHorizontal, ZenModeSettings, isMultiWindowPart, partOpensMaximizedFromString, PartOpensMaximizedOptions, positionToString, positionFromString } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService';
|
|
16
|
+
import { WorkbenchState, isTemporaryWorkspace } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace';
|
|
17
|
+
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
18
|
+
import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
|
|
19
|
+
import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
|
|
16
20
|
import { isConfigured } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration';
|
|
17
21
|
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
22
|
+
import { ITitleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/title/browser/titleService.service';
|
|
23
|
+
import { StartupKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
24
|
+
import { ILifecycleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
25
|
+
import { MenuSettings, TitleBarSetting, DEFAULT_EMPTY_WINDOW_SIZE, DEFAULT_WORKSPACE_WINDOW_SIZE, CustomTitleBarVisibility, hasNativeTitlebar, getMenuBarVisibility, useWindowControlsOverlay, hasNativeMenu } from '@codingame/monaco-vscode-api/vscode/vs/platform/window/common/window';
|
|
26
|
+
import { IHostService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service';
|
|
27
|
+
import { IBrowserWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/browser/environmentService.service';
|
|
28
|
+
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
29
|
+
import { GroupsOrder, GroupOrientation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
30
|
+
import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
31
|
+
import { Part } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/part';
|
|
32
|
+
import { IStatusbarService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/statusbar/browser/statusbar.service';
|
|
18
33
|
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
19
|
-
import {
|
|
34
|
+
import { isCodeEditor } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser';
|
|
35
|
+
import { assertReturnsDefined } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
20
36
|
import { NotificationsFilter } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification';
|
|
21
37
|
import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
|
|
22
|
-
import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
|
|
23
|
-
import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
|
|
24
|
-
import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
25
38
|
import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
|
|
26
|
-
import { MenuSettings, TitleBarSetting, DEFAULT_EMPTY_WINDOW_SIZE, DEFAULT_WORKSPACE_WINDOW_SIZE, CustomTitleBarVisibility, hasNativeTitlebar, getMenuBarVisibility, useWindowControlsOverlay, hasNativeMenu } from '@codingame/monaco-vscode-api/vscode/vs/platform/window/common/window';
|
|
27
|
-
import { WorkbenchState, isTemporaryWorkspace } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace';
|
|
28
|
-
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
29
|
-
import { pathsToEditors, isResourceEditorInput, EditorInputCapabilities } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
|
|
30
|
-
import { DiffEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor/diffEditorInput';
|
|
31
39
|
import { WINDOW_ACTIVE_BORDER, WINDOW_INACTIVE_BORDER } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/theme';
|
|
40
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
32
41
|
import { ViewContainerLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views';
|
|
33
42
|
import { IViewDescriptorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views.service';
|
|
43
|
+
import { DiffEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor/diffEditorInput';
|
|
44
|
+
import { mark } from '@codingame/monaco-vscode-api/vscode/vs/base/common/performance';
|
|
45
|
+
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
46
|
+
import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
34
47
|
import { IAuxiliaryWindowService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.service';
|
|
35
48
|
import { IBannerService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/banner/browser/bannerService.service';
|
|
36
|
-
import { GroupsOrder, GroupOrientation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
37
|
-
import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
38
|
-
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
39
|
-
import { IBrowserWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/browser/environmentService.service';
|
|
40
49
|
import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
41
|
-
import { IHostService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service';
|
|
42
|
-
import { LayoutSettings, Parts, EditorActionsLocation, ActivityBarPosition, shouldShowCustomTitleBar, Position, isHorizontal, ZenModeSettings, isMultiWindowPart, partOpensMaximizedFromString, PartOpensMaximizedOptions, positionToString, positionFromString } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService';
|
|
43
|
-
import { StartupKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
44
|
-
import { ILifecycleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
45
50
|
import { IPaneCompositePartService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/panecomposite/browser/panecomposite.service';
|
|
46
|
-
import { IStatusbarService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/statusbar/browser/statusbar.service';
|
|
47
|
-
import { ITitleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/title/browser/titleService.service';
|
|
48
|
-
import { Part } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/part';
|
|
49
51
|
import { AuxiliaryBarPart } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart';
|
|
50
|
-
import { PanelPart } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/panel/panelPart';
|
|
51
|
-
import { SidebarPart } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/sidebar/sidebarPart';
|
|
52
52
|
import { Orientation } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/sash/sash';
|
|
53
53
|
import '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/grid/gridview';
|
|
54
54
|
|
|
55
55
|
var LayoutClasses;
|
|
56
|
-
(function
|
|
56
|
+
(function(LayoutClasses) {
|
|
57
57
|
LayoutClasses["SIDEBAR_HIDDEN"] = "nosidebar";
|
|
58
58
|
LayoutClasses["MAIN_EDITOR_AREA_HIDDEN"] = "nomaineditorarea";
|
|
59
59
|
LayoutClasses["PANEL_HIDDEN"] = "nopanel";
|
|
@@ -64,9 +64,10 @@ var LayoutClasses;
|
|
|
64
64
|
LayoutClasses["WINDOW_BORDER"] = "border";
|
|
65
65
|
})(LayoutClasses || (LayoutClasses = {}));
|
|
66
66
|
const COMMAND_CENTER_SETTINGS = [
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
"chat.agentsControl.enabled",
|
|
68
|
+
"chat.unifiedAgentsBar.enabled",
|
|
69
|
+
"workbench.navigationControl.enabled",
|
|
70
|
+
"workbench.experimental.share.enabled"
|
|
70
71
|
];
|
|
71
72
|
const TITLE_BAR_SETTINGS = [
|
|
72
73
|
LayoutSettings.ACTIVITY_BAR_LOCATION,
|
|
@@ -76,15 +77,19 @@ const TITLE_BAR_SETTINGS = [
|
|
|
76
77
|
LayoutSettings.LAYOUT_ACTIONS,
|
|
77
78
|
MenuSettings.MenuBarVisibility,
|
|
78
79
|
TitleBarSetting.TITLE_BAR_STYLE,
|
|
79
|
-
TitleBarSetting.CUSTOM_TITLE_BAR_VISIBILITY
|
|
80
|
+
TitleBarSetting.CUSTOM_TITLE_BAR_VISIBILITY
|
|
80
81
|
];
|
|
81
82
|
const DEFAULT_EMPTY_WINDOW_DIMENSIONS = ( new Dimension(DEFAULT_EMPTY_WINDOW_SIZE.width, DEFAULT_EMPTY_WINDOW_SIZE.height));
|
|
82
83
|
const DEFAULT_WORKSPACE_WINDOW_DIMENSIONS = ( new Dimension(DEFAULT_WORKSPACE_WINDOW_SIZE.width, DEFAULT_WORKSPACE_WINDOW_SIZE.height));
|
|
83
84
|
class Layout extends Disposable {
|
|
84
|
-
get activeContainer() {
|
|
85
|
+
get activeContainer() {
|
|
86
|
+
return this.getContainerFromDocument(getActiveDocument());
|
|
87
|
+
}
|
|
85
88
|
get containers() {
|
|
86
89
|
const containers = [];
|
|
87
|
-
for (const {
|
|
90
|
+
for (const {
|
|
91
|
+
window
|
|
92
|
+
} of getWindows()) {
|
|
88
93
|
containers.push(this.getContainerFromDocument(window.document));
|
|
89
94
|
}
|
|
90
95
|
return containers;
|
|
@@ -92,23 +97,23 @@ class Layout extends Disposable {
|
|
|
92
97
|
getContainerFromDocument(targetDocument) {
|
|
93
98
|
if (targetDocument === this.mainContainer.ownerDocument) {
|
|
94
99
|
return this.mainContainer;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return targetDocument.body.getElementsByClassName('monaco-workbench')[0];
|
|
100
|
+
} else {
|
|
101
|
+
return targetDocument.body.getElementsByClassName("monaco-workbench")[0];
|
|
98
102
|
}
|
|
99
103
|
}
|
|
100
104
|
whenContainerStylesLoaded(window) {
|
|
101
105
|
return this.containerStylesLoaded.get(window.vscodeWindowId);
|
|
102
106
|
}
|
|
103
|
-
get mainContainerDimension() {
|
|
107
|
+
get mainContainerDimension() {
|
|
108
|
+
return this._mainContainerDimension;
|
|
109
|
+
}
|
|
104
110
|
get activeContainerDimension() {
|
|
105
111
|
return this.getContainerDimension(this.activeContainer);
|
|
106
112
|
}
|
|
107
113
|
getContainerDimension(container) {
|
|
108
114
|
if (container === this.mainContainer) {
|
|
109
115
|
return this.mainContainerDimension;
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
116
|
+
} else {
|
|
112
117
|
return getClientArea(container);
|
|
113
118
|
}
|
|
114
119
|
}
|
|
@@ -134,7 +139,10 @@ class Layout extends Disposable {
|
|
|
134
139
|
if (isCommandCenterVisible) {
|
|
135
140
|
quickPickTop = 6;
|
|
136
141
|
}
|
|
137
|
-
return {
|
|
142
|
+
return {
|
|
143
|
+
top,
|
|
144
|
+
quickPickTop
|
|
145
|
+
};
|
|
138
146
|
}
|
|
139
147
|
constructor(parent, layoutOptions) {
|
|
140
148
|
super();
|
|
@@ -166,7 +174,7 @@ class Layout extends Disposable {
|
|
|
166
174
|
this.onDidAddContainer = this._onDidAddContainer.event;
|
|
167
175
|
this._onDidChangeActiveContainer = this._register(( new Emitter()));
|
|
168
176
|
this.onDidChangeActiveContainer = this._onDidChangeActiveContainer.event;
|
|
169
|
-
this.mainContainer = createElement(
|
|
177
|
+
this.mainContainer = createElement("div");
|
|
170
178
|
this.containerStylesLoaded = ( new Map());
|
|
171
179
|
this.parts = ( new Map());
|
|
172
180
|
this.initialized = false;
|
|
@@ -205,29 +213,45 @@ class Layout extends Disposable {
|
|
|
205
213
|
}
|
|
206
214
|
registerLayoutListeners() {
|
|
207
215
|
const showEditorIfHidden = () => {
|
|
208
|
-
if (
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
this.toggleMaximizedPanel();
|
|
214
|
-
}
|
|
216
|
+
if (
|
|
217
|
+
this.isVisible(Parts.EDITOR_PART, mainWindow) || this.mainPartEditorService.visibleEditors.length === 0) {
|
|
218
|
+
return;
|
|
215
219
|
}
|
|
220
|
+
if (this.isAuxiliaryBarMaximized()) {
|
|
221
|
+
this.toggleMaximizedAuxiliaryBar();
|
|
222
|
+
} else {
|
|
223
|
+
this.toggleMaximizedPanel();
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
const maybeMaximizeAuxiliaryBar = () => {
|
|
227
|
+
if (this.mainPartEditorService.visibleEditors.length === 0 && this.configurationService.getValue(WorkbenchLayoutSettings.AUXILIARYBAR_FORCE_MAXIMIZED) === true) {
|
|
228
|
+
this.setAuxiliaryBarMaximized(true);
|
|
229
|
+
return true;
|
|
230
|
+
}
|
|
231
|
+
return false;
|
|
216
232
|
};
|
|
217
233
|
this.editorGroupService.whenRestored.then(() => {
|
|
218
|
-
this._register(this.mainPartEditorService.onDidVisibleEditorsChange(
|
|
234
|
+
this._register(this.mainPartEditorService.onDidVisibleEditorsChange(() => {
|
|
235
|
+
const handled = maybeMaximizeAuxiliaryBar();
|
|
236
|
+
if (!handled) {
|
|
237
|
+
showEditorIfHidden();
|
|
238
|
+
}
|
|
239
|
+
}));
|
|
219
240
|
this._register(this.editorGroupService.mainPart.onDidActivateGroup(showEditorIfHidden));
|
|
220
|
-
this._register(this.mainPartEditorService.onDidActiveEditorChange(
|
|
241
|
+
this._register(this.mainPartEditorService.onDidActiveEditorChange(
|
|
242
|
+
() => this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED))
|
|
243
|
+
));
|
|
221
244
|
});
|
|
222
245
|
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
|
223
246
|
if (( [
|
|
224
247
|
...TITLE_BAR_SETTINGS,
|
|
225
248
|
LegacyWorkbenchLayoutSettings.SIDEBAR_POSITION,
|
|
226
|
-
LegacyWorkbenchLayoutSettings.STATUSBAR_VISIBLE
|
|
249
|
+
LegacyWorkbenchLayoutSettings.STATUSBAR_VISIBLE
|
|
227
250
|
].some(setting => e.affectsConfiguration(setting)))) {
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
251
|
+
const enabledCommandCenterAction = ( COMMAND_CENTER_SETTINGS.some(
|
|
252
|
+
setting => e.affectsConfiguration(setting) && this.configurationService.getValue(setting) === true
|
|
253
|
+
));
|
|
254
|
+
if (enabledCommandCenterAction) {
|
|
231
255
|
if (this.configurationService.getValue(LayoutSettings.COMMAND_CENTER) === false) {
|
|
232
256
|
this.configurationService.updateValue(LayoutSettings.COMMAND_CENTER, true);
|
|
233
257
|
return;
|
|
@@ -245,41 +269,85 @@ class Layout extends Disposable {
|
|
|
245
269
|
}
|
|
246
270
|
this.doUpdateLayoutConfiguration();
|
|
247
271
|
}
|
|
272
|
+
if (e.affectsConfiguration(WorkbenchLayoutSettings.AUXILIARYBAR_FORCE_MAXIMIZED)) {
|
|
273
|
+
const forceMaximized = this.configurationService.getValue(WorkbenchLayoutSettings.AUXILIARYBAR_FORCE_MAXIMIZED);
|
|
274
|
+
if (forceMaximized === true && this.mainPartEditorService.visibleEditors.length === 0) {
|
|
275
|
+
this.setAuxiliaryBarMaximized(true);
|
|
276
|
+
} else if (forceMaximized === false && this.isAuxiliaryBarMaximized()) {
|
|
277
|
+
this.setAuxiliaryBarMaximized(false);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
248
280
|
}));
|
|
249
281
|
this._register(onDidChangeFullscreen(windowId => this.onFullscreenChanged(windowId)));
|
|
250
|
-
this._register(this.editorGroupService.mainPart.onDidAddGroup(
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
this._register(
|
|
282
|
+
this._register(this.editorGroupService.mainPart.onDidAddGroup(
|
|
283
|
+
() => this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED))
|
|
284
|
+
));
|
|
285
|
+
this._register(this.editorGroupService.mainPart.onDidRemoveGroup(
|
|
286
|
+
() => this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED))
|
|
287
|
+
));
|
|
288
|
+
this._register(this.editorGroupService.mainPart.onDidChangeGroupMaximized(
|
|
289
|
+
() => this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED))
|
|
290
|
+
));
|
|
291
|
+
this._register(addDisposableListener(
|
|
292
|
+
this.mainContainer,
|
|
293
|
+
EventType.SCROLL,
|
|
294
|
+
() => this.mainContainer.scrollTop = 0
|
|
295
|
+
));
|
|
254
296
|
const showingCustomMenu = (isWindows || isLinux || isWeb) && !hasNativeTitlebar(this.configurationService);
|
|
255
297
|
if (showingCustomMenu) {
|
|
256
|
-
this._register(
|
|
298
|
+
this._register(
|
|
299
|
+
this.titleService.onMenubarVisibilityChange(visible => this.onMenubarToggled(visible))
|
|
300
|
+
);
|
|
257
301
|
}
|
|
258
302
|
this._register(this.themeService.onDidColorThemeChange(() => this.updateWindowBorder()));
|
|
259
|
-
this._register(
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
303
|
+
this._register(
|
|
304
|
+
this.hostService.onDidChangeFocus(focused => this.onWindowFocusChanged(focused))
|
|
305
|
+
);
|
|
306
|
+
this._register(
|
|
307
|
+
this.hostService.onDidChangeActiveWindow(() => this.onActiveWindowChanged())
|
|
308
|
+
);
|
|
309
|
+
if (isWeb && typeof navigator.windowControlsOverlay === "object") {
|
|
310
|
+
this._register(addDisposableListener(
|
|
311
|
+
navigator.windowControlsOverlay,
|
|
312
|
+
"geometrychange",
|
|
313
|
+
() => this.onDidChangeWCO()
|
|
314
|
+
));
|
|
315
|
+
}
|
|
316
|
+
this._register(this.auxiliaryWindowService.onDidOpenAuxiliaryWindow((
|
|
317
|
+
{
|
|
318
|
+
window,
|
|
319
|
+
disposables
|
|
320
|
+
}
|
|
321
|
+
) => {
|
|
265
322
|
const windowId = window.window.vscodeWindowId;
|
|
266
323
|
this.containerStylesLoaded.set(windowId, window.whenStylesHaveLoaded);
|
|
267
324
|
window.whenStylesHaveLoaded.then(() => this.containerStylesLoaded.delete(windowId));
|
|
268
325
|
disposables.add(toDisposable(() => this.containerStylesLoaded.delete(windowId)));
|
|
269
326
|
const eventDisposables = disposables.add(( new DisposableStore()));
|
|
270
|
-
this._onDidAddContainer.fire({
|
|
271
|
-
|
|
327
|
+
this._onDidAddContainer.fire({
|
|
328
|
+
container: window.container,
|
|
329
|
+
disposables: eventDisposables
|
|
330
|
+
});
|
|
331
|
+
disposables.add(
|
|
332
|
+
window.onDidLayout(dimension => this.handleContainerDidLayout(window.container, dimension))
|
|
333
|
+
);
|
|
272
334
|
}));
|
|
273
335
|
}
|
|
274
336
|
onMenubarToggled(visible) {
|
|
275
337
|
if (visible !== this.state.runtime.menuBar.toggled) {
|
|
276
338
|
this.state.runtime.menuBar.toggled = visible;
|
|
277
339
|
const menuBarVisibility = getMenuBarVisibility(this.configurationService);
|
|
278
|
-
if (isWeb && menuBarVisibility ===
|
|
279
|
-
this.workbenchGrid.setViewVisible(
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
340
|
+
if (isWeb && menuBarVisibility === "toggle") {
|
|
341
|
+
this.workbenchGrid.setViewVisible(
|
|
342
|
+
this.titleBarPartView,
|
|
343
|
+
shouldShowCustomTitleBar(this.configurationService, mainWindow, this.state.runtime.menuBar.toggled)
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
else if (this.state.runtime.mainWindowFullscreen && (menuBarVisibility === "toggle" || menuBarVisibility === "classic")) {
|
|
347
|
+
this.workbenchGrid.setViewVisible(
|
|
348
|
+
this.titleBarPartView,
|
|
349
|
+
shouldShowCustomTitleBar(this.configurationService, mainWindow, this.state.runtime.menuBar.toggled)
|
|
350
|
+
);
|
|
283
351
|
}
|
|
284
352
|
this.handleContainerDidLayout(this.mainContainer, this._mainContainerDimension);
|
|
285
353
|
}
|
|
@@ -291,7 +359,10 @@ class Layout extends Disposable {
|
|
|
291
359
|
if (isActiveDocument(container)) {
|
|
292
360
|
this._onDidLayoutActiveContainer.fire(dimension);
|
|
293
361
|
}
|
|
294
|
-
this._onDidLayoutContainer.fire({
|
|
362
|
+
this._onDidLayoutContainer.fire({
|
|
363
|
+
container,
|
|
364
|
+
dimension
|
|
365
|
+
});
|
|
295
366
|
}
|
|
296
367
|
onFullscreenChanged(windowId) {
|
|
297
368
|
if (windowId !== mainWindow.vscodeWindowId) {
|
|
@@ -300,8 +371,7 @@ class Layout extends Disposable {
|
|
|
300
371
|
this.state.runtime.mainWindowFullscreen = isFullscreen(mainWindow);
|
|
301
372
|
if (this.state.runtime.mainWindowFullscreen) {
|
|
302
373
|
this.mainContainer.classList.add(LayoutClasses.FULLSCREEN);
|
|
303
|
-
}
|
|
304
|
-
else {
|
|
374
|
+
} else {
|
|
305
375
|
this.mainContainer.classList.remove(LayoutClasses.FULLSCREEN);
|
|
306
376
|
const zenModeExitInfo = this.stateModel.getRuntimeValue(LayoutStateKeys.ZEN_MODE_EXIT_INFO);
|
|
307
377
|
if (zenModeExitInfo.transitionedToFullScreen && this.isZenModeActive()) {
|
|
@@ -310,7 +380,10 @@ class Layout extends Disposable {
|
|
|
310
380
|
}
|
|
311
381
|
this.workbenchGrid.edgeSnapping = this.state.runtime.mainWindowFullscreen;
|
|
312
382
|
{
|
|
313
|
-
this.workbenchGrid.setViewVisible(
|
|
383
|
+
this.workbenchGrid.setViewVisible(
|
|
384
|
+
this.titleBarPartView,
|
|
385
|
+
shouldShowCustomTitleBar(this.configurationService, mainWindow, this.state.runtime.menuBar.toggled)
|
|
386
|
+
);
|
|
314
387
|
this.updateWindowBorder(true);
|
|
315
388
|
}
|
|
316
389
|
}
|
|
@@ -335,14 +408,17 @@ class Layout extends Disposable {
|
|
|
335
408
|
doUpdateLayoutConfiguration(skipLayout) {
|
|
336
409
|
this.updateCustomTitleBarVisibility();
|
|
337
410
|
this.updateMenubarVisibility(!!skipLayout);
|
|
338
|
-
this.editorGroupService.whenRestored.then(() => this.centerMainEditorLayout(
|
|
411
|
+
this.editorGroupService.whenRestored.then(() => this.centerMainEditorLayout(
|
|
412
|
+
this.stateModel.getRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED),
|
|
413
|
+
skipLayout
|
|
414
|
+
));
|
|
339
415
|
}
|
|
340
416
|
setSideBarPosition(position) {
|
|
341
417
|
const activityBar = this.getPart(Parts.ACTIVITYBAR_PART);
|
|
342
418
|
const sideBar = this.getPart(Parts.SIDEBAR_PART);
|
|
343
419
|
const auxiliaryBar = this.getPart(Parts.AUXILIARYBAR_PART);
|
|
344
|
-
const newPositionValue = (position === Position.LEFT) ?
|
|
345
|
-
const oldPositionValue = (position === Position.RIGHT) ?
|
|
420
|
+
const newPositionValue = (position === Position.LEFT) ? "left" : "right";
|
|
421
|
+
const oldPositionValue = (position === Position.RIGHT) ? "left" : "right";
|
|
346
422
|
const panelAlignment = this.getPanelAlignment();
|
|
347
423
|
const panelPosition = this.getPanelPosition();
|
|
348
424
|
this.stateModel.setRuntimeValue(LayoutStateKeys.SIDEBAR_POSITON, position);
|
|
@@ -361,11 +437,9 @@ class Layout extends Disposable {
|
|
|
361
437
|
this.adjustPartPositions(position, panelAlignment, panelPosition);
|
|
362
438
|
}
|
|
363
439
|
updateWindowBorder(skipLayout = false) {
|
|
364
|
-
if (
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
) ||
|
|
368
|
-
hasNativeTitlebar(this.configurationService)) {
|
|
440
|
+
if (
|
|
441
|
+
isWeb || isWindows ||
|
|
442
|
+
((isWindows || isLinux) && useWindowControlsOverlay(this.configurationService)) || hasNativeTitlebar(this.configurationService)) {
|
|
369
443
|
return;
|
|
370
444
|
}
|
|
371
445
|
const theme = this.themeService.getColorTheme();
|
|
@@ -379,7 +453,7 @@ class Layout extends Disposable {
|
|
|
379
453
|
if (!this.state.runtime.mainWindowFullscreen && (activeBorder || inactiveBorder)) {
|
|
380
454
|
windowBorder = true;
|
|
381
455
|
const borderColor = isActiveContainer && this.state.runtime.hasFocus ? activeBorder : inactiveBorder ?? activeBorder;
|
|
382
|
-
container.style.setProperty(
|
|
456
|
+
container.style.setProperty("--window-border-color", borderColor?.toString() ?? "transparent");
|
|
383
457
|
}
|
|
384
458
|
if (isMainContainer) {
|
|
385
459
|
this.state.runtime.mainWindowBorder = windowBorder;
|
|
@@ -391,7 +465,10 @@ class Layout extends Disposable {
|
|
|
391
465
|
}
|
|
392
466
|
}
|
|
393
467
|
initLayoutState(lifecycleService, fileService) {
|
|
394
|
-
this._mainContainerDimension = getClientArea(
|
|
468
|
+
this._mainContainerDimension = getClientArea(
|
|
469
|
+
this.parent,
|
|
470
|
+
this.contextService.getWorkbenchState() === WorkbenchState.EMPTY ? DEFAULT_EMPTY_WINDOW_DIMENSIONS : DEFAULT_WORKSPACE_WINDOW_DIMENSIONS
|
|
471
|
+
);
|
|
395
472
|
this.stateModel = ( new LayoutStateModel(
|
|
396
473
|
this.storageService,
|
|
397
474
|
this.configurationService,
|
|
@@ -422,7 +499,7 @@ class Layout extends Disposable {
|
|
|
422
499
|
}));
|
|
423
500
|
const initialEditorsState = this.getInitialEditorsState();
|
|
424
501
|
if (initialEditorsState) {
|
|
425
|
-
this.logService.trace(
|
|
502
|
+
this.logService.trace("Initial editor state", initialEditorsState);
|
|
426
503
|
}
|
|
427
504
|
const initialLayoutState = {
|
|
428
505
|
layout: {
|
|
@@ -430,7 +507,7 @@ class Layout extends Disposable {
|
|
|
430
507
|
},
|
|
431
508
|
editor: {
|
|
432
509
|
restoreEditors: this.shouldRestoreEditors(this.contextService, initialEditorsState),
|
|
433
|
-
editorsToOpen: this.resolveEditorsToOpen(fileService, initialEditorsState)
|
|
510
|
+
editorsToOpen: this.resolveEditorsToOpen(fileService, initialEditorsState)
|
|
434
511
|
},
|
|
435
512
|
views: {
|
|
436
513
|
defaults: this.getDefaultLayoutViews(this.environmentService, this.storageService),
|
|
@@ -444,47 +521,53 @@ class Layout extends Disposable {
|
|
|
444
521
|
maximized: ( new Set()),
|
|
445
522
|
mainWindowBorder: false,
|
|
446
523
|
menuBar: {
|
|
447
|
-
toggled: false
|
|
524
|
+
toggled: false
|
|
448
525
|
},
|
|
449
526
|
zenMode: {
|
|
450
|
-
transitionDisposables: ( new DisposableMap())
|
|
527
|
+
transitionDisposables: ( new DisposableMap())
|
|
451
528
|
}
|
|
452
529
|
};
|
|
453
530
|
this.state = {
|
|
454
531
|
initialization: initialLayoutState,
|
|
455
|
-
runtime: layoutRuntimeState
|
|
532
|
+
runtime: layoutRuntimeState
|
|
456
533
|
};
|
|
457
534
|
if (this.isVisible(Parts.SIDEBAR_PART)) {
|
|
458
|
-
let viewContainerToRestore = this.storageService.get(
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
this.
|
|
462
|
-
|
|
463
|
-
|
|
535
|
+
let viewContainerToRestore = this.storageService.get(
|
|
536
|
+
SidebarPart.activeViewletSettingsKey,
|
|
537
|
+
StorageScope.WORKSPACE,
|
|
538
|
+
this.viewDescriptorService.getDefaultViewContainer(ViewContainerLocation.Sidebar)?.id
|
|
539
|
+
);
|
|
540
|
+
if (!this.environmentService.isBuilt || lifecycleService.startupKind === StartupKind.ReloadedWindow || this.environmentService.isExtensionDevelopment && !this.environmentService.extensionTestsLocationURI)
|
|
541
|
+
; else if (viewContainerToRestore !== this.viewDescriptorService.getDefaultViewContainer(ViewContainerLocation.Sidebar)?.id && viewContainerToRestore !== this.viewDescriptorService.getDefaultViewContainer(ViewContainerLocation.AuxiliaryBar)?.id) {
|
|
464
542
|
viewContainerToRestore = this.viewDescriptorService.getDefaultViewContainer(ViewContainerLocation.Sidebar)?.id;
|
|
465
543
|
}
|
|
466
544
|
if (viewContainerToRestore) {
|
|
467
545
|
this.state.initialization.views.containerToRestore.sideBar = viewContainerToRestore;
|
|
468
|
-
}
|
|
469
|
-
else {
|
|
546
|
+
} else {
|
|
470
547
|
this.stateModel.setRuntimeValue(LayoutStateKeys.SIDEBAR_HIDDEN, true);
|
|
471
548
|
}
|
|
472
549
|
}
|
|
473
550
|
if (this.isVisible(Parts.PANEL_PART)) {
|
|
474
|
-
const viewContainerToRestore = this.storageService.get(
|
|
551
|
+
const viewContainerToRestore = this.storageService.get(
|
|
552
|
+
PanelPart.activePanelSettingsKey,
|
|
553
|
+
StorageScope.WORKSPACE,
|
|
554
|
+
this.viewDescriptorService.getDefaultViewContainer(ViewContainerLocation.Panel)?.id
|
|
555
|
+
);
|
|
475
556
|
if (viewContainerToRestore) {
|
|
476
557
|
this.state.initialization.views.containerToRestore.panel = viewContainerToRestore;
|
|
477
|
-
}
|
|
478
|
-
else {
|
|
558
|
+
} else {
|
|
479
559
|
this.stateModel.setRuntimeValue(LayoutStateKeys.PANEL_HIDDEN, true);
|
|
480
560
|
}
|
|
481
561
|
}
|
|
482
562
|
if (this.isVisible(Parts.AUXILIARYBAR_PART)) {
|
|
483
|
-
const viewContainerToRestore = this.storageService.get(
|
|
563
|
+
const viewContainerToRestore = this.storageService.get(
|
|
564
|
+
AuxiliaryBarPart.activeViewSettingsKey,
|
|
565
|
+
StorageScope.WORKSPACE,
|
|
566
|
+
this.viewDescriptorService.getDefaultViewContainer(ViewContainerLocation.AuxiliaryBar)?.id
|
|
567
|
+
);
|
|
484
568
|
if (viewContainerToRestore) {
|
|
485
569
|
this.state.initialization.views.containerToRestore.auxiliaryBar = viewContainerToRestore;
|
|
486
|
-
}
|
|
487
|
-
else {
|
|
570
|
+
} else {
|
|
488
571
|
this.stateModel.setRuntimeValue(LayoutStateKeys.AUXILIARYBAR_HIDDEN, true);
|
|
489
572
|
}
|
|
490
573
|
}
|
|
@@ -498,7 +581,9 @@ class Layout extends Disposable {
|
|
|
498
581
|
if (!defaultLayout.force && !storageService.isNew(StorageScope.WORKSPACE)) {
|
|
499
582
|
return undefined;
|
|
500
583
|
}
|
|
501
|
-
const {
|
|
584
|
+
const {
|
|
585
|
+
views
|
|
586
|
+
} = defaultLayout;
|
|
502
587
|
if (views?.length) {
|
|
503
588
|
return ( views.map(view => view.id));
|
|
504
589
|
}
|
|
@@ -508,7 +593,10 @@ class Layout extends Disposable {
|
|
|
508
593
|
if (isTemporaryWorkspace(contextService.getWorkspace())) {
|
|
509
594
|
return false;
|
|
510
595
|
}
|
|
511
|
-
|
|
596
|
+
if (this.configurationService.getValue(WorkbenchLayoutSettings.EDITOR_RESTORE_EDITORS) === false) {
|
|
597
|
+
return false;
|
|
598
|
+
}
|
|
599
|
+
const forceRestoreEditors = this.configurationService.getValue("window.restoreWindows") === "preserve";
|
|
512
600
|
return !!forceRestoreEditors || initialEditorsState === undefined;
|
|
513
601
|
}
|
|
514
602
|
willRestoreEditors() {
|
|
@@ -516,27 +604,47 @@ class Layout extends Disposable {
|
|
|
516
604
|
}
|
|
517
605
|
async resolveEditorsToOpen(fileService, initialEditorsState) {
|
|
518
606
|
if (initialEditorsState) {
|
|
519
|
-
const filesToMerge = coalesce(
|
|
607
|
+
const filesToMerge = coalesce(
|
|
608
|
+
await pathsToEditors(initialEditorsState.filesToMerge, fileService, this.logService)
|
|
609
|
+
);
|
|
520
610
|
if (filesToMerge.length === 4 && isResourceEditorInput(filesToMerge[0]) && isResourceEditorInput(filesToMerge[1]) && isResourceEditorInput(filesToMerge[2]) && isResourceEditorInput(filesToMerge[3])) {
|
|
521
611
|
return [{
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
612
|
+
editor: {
|
|
613
|
+
input1: {
|
|
614
|
+
resource: filesToMerge[0].resource
|
|
615
|
+
},
|
|
616
|
+
input2: {
|
|
617
|
+
resource: filesToMerge[1].resource
|
|
618
|
+
},
|
|
619
|
+
base: {
|
|
620
|
+
resource: filesToMerge[2].resource
|
|
621
|
+
},
|
|
622
|
+
result: {
|
|
623
|
+
resource: filesToMerge[3].resource
|
|
624
|
+
},
|
|
625
|
+
options: {
|
|
626
|
+
pinned: true
|
|
528
627
|
}
|
|
529
|
-
}
|
|
628
|
+
}
|
|
629
|
+
}];
|
|
530
630
|
}
|
|
531
|
-
const filesToDiff = coalesce(
|
|
631
|
+
const filesToDiff = coalesce(
|
|
632
|
+
await pathsToEditors(initialEditorsState.filesToDiff, fileService, this.logService)
|
|
633
|
+
);
|
|
532
634
|
if (filesToDiff.length === 2) {
|
|
533
635
|
return [{
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
636
|
+
editor: {
|
|
637
|
+
original: {
|
|
638
|
+
resource: filesToDiff[0].resource
|
|
639
|
+
},
|
|
640
|
+
modified: {
|
|
641
|
+
resource: filesToDiff[1].resource
|
|
642
|
+
},
|
|
643
|
+
options: {
|
|
644
|
+
pinned: true
|
|
538
645
|
}
|
|
539
|
-
}
|
|
646
|
+
}
|
|
647
|
+
}];
|
|
540
648
|
}
|
|
541
649
|
const filesToOpenOrCreate = [];
|
|
542
650
|
const resolvedFilesToOpenOrCreate = await pathsToEditors(initialEditorsState.filesToOpenOrCreate, fileService, this.logService);
|
|
@@ -551,17 +659,21 @@ class Layout extends Disposable {
|
|
|
551
659
|
}
|
|
552
660
|
return filesToOpenOrCreate;
|
|
553
661
|
}
|
|
554
|
-
else if (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY && this.configurationService.getValue(
|
|
662
|
+
else if (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY && this.configurationService.getValue("workbench.startupEditor") === "newUntitledFile") {
|
|
555
663
|
if (this.editorGroupService.hasRestorableState) {
|
|
556
664
|
return [];
|
|
557
665
|
}
|
|
558
666
|
return [{
|
|
559
|
-
|
|
560
|
-
|
|
667
|
+
editor: {
|
|
668
|
+
resource: undefined
|
|
669
|
+
}
|
|
670
|
+
}];
|
|
561
671
|
}
|
|
562
672
|
return [];
|
|
563
673
|
}
|
|
564
|
-
get openedDefaultEditors() {
|
|
674
|
+
get openedDefaultEditors() {
|
|
675
|
+
return this._openedDefaultEditors;
|
|
676
|
+
}
|
|
565
677
|
getInitialEditorsState() {
|
|
566
678
|
const defaultLayout = this.environmentService.options?.defaultLayout;
|
|
567
679
|
if ((defaultLayout?.editors?.length || defaultLayout?.layout?.editors) && (defaultLayout.force || this.storageService.isNew(StorageScope.WORKSPACE))) {
|
|
@@ -578,9 +690,17 @@ class Layout extends Disposable {
|
|
|
578
690
|
})
|
|
579
691
|
};
|
|
580
692
|
}
|
|
581
|
-
const {
|
|
693
|
+
const {
|
|
694
|
+
filesToOpenOrCreate,
|
|
695
|
+
filesToDiff,
|
|
696
|
+
filesToMerge
|
|
697
|
+
} = this.environmentService;
|
|
582
698
|
if (filesToOpenOrCreate || filesToDiff || filesToMerge) {
|
|
583
|
-
return {
|
|
699
|
+
return {
|
|
700
|
+
filesToOpenOrCreate,
|
|
701
|
+
filesToDiff,
|
|
702
|
+
filesToMerge
|
|
703
|
+
};
|
|
584
704
|
}
|
|
585
705
|
return undefined;
|
|
586
706
|
}
|
|
@@ -591,14 +711,14 @@ class Layout extends Disposable {
|
|
|
591
711
|
const layoutReadyPromises = [];
|
|
592
712
|
const layoutRestoredPromises = [];
|
|
593
713
|
layoutReadyPromises.push((async () => {
|
|
594
|
-
mark(
|
|
714
|
+
mark("code/willRestoreEditors");
|
|
595
715
|
await this.editorGroupService.whenReady;
|
|
596
|
-
mark(
|
|
716
|
+
mark("code/restoreEditors/editorGroupsReady");
|
|
597
717
|
if (this.state.initialization.layout?.editors) {
|
|
598
718
|
this.editorGroupService.mainPart.applyLayout(this.state.initialization.layout.editors);
|
|
599
719
|
}
|
|
600
720
|
const editors = await this.state.initialization.editor.editorsToOpen;
|
|
601
|
-
mark(
|
|
721
|
+
mark("code/restoreEditors/editorsToOpenResolved");
|
|
602
722
|
let openEditorsPromise = undefined;
|
|
603
723
|
if (editors.length) {
|
|
604
724
|
const editorGroupsInVisualOrder = this.editorGroupService.mainPart.getGroups(GroupsOrder.GRID_APPEARANCE);
|
|
@@ -614,33 +734,40 @@ class Layout extends Disposable {
|
|
|
614
734
|
}
|
|
615
735
|
openEditorsPromise = Promise.all(( Array.from(mapEditorsToGroup).map(async ([groupId, editors]) => {
|
|
616
736
|
try {
|
|
617
|
-
await this.editorService.openEditors(Array.from(editors), groupId, {
|
|
618
|
-
|
|
619
|
-
|
|
737
|
+
await this.editorService.openEditors(Array.from(editors), groupId, {
|
|
738
|
+
validateTrust: true
|
|
739
|
+
});
|
|
740
|
+
} catch (error) {
|
|
620
741
|
this.logService.error(error);
|
|
621
742
|
}
|
|
622
743
|
})));
|
|
623
744
|
}
|
|
624
|
-
const customEditorRestorePromise = instantiationService.invokeFunction(
|
|
745
|
+
const customEditorRestorePromise = instantiationService.invokeFunction(
|
|
746
|
+
this.layoutOptions?.customEditorRestore ?? (async () => {}),
|
|
747
|
+
!!this.state.initialization.layout?.editors
|
|
748
|
+
);
|
|
625
749
|
layoutRestoredPromises.push(Promise.all([
|
|
626
|
-
openEditorsPromise?.finally(() => mark(
|
|
627
|
-
customEditorRestorePromise?.finally(() => mark(
|
|
628
|
-
this.editorGroupService.whenRestored.finally(() => mark(
|
|
750
|
+
openEditorsPromise?.finally(() => mark("code/restoreEditors/editorsOpened")),
|
|
751
|
+
customEditorRestorePromise?.finally(() => mark("code/restoreEditors/customEditorsOpened")),
|
|
752
|
+
this.editorGroupService.whenRestored.finally(() => mark("code/restoreEditors/editorGroupsRestored"))
|
|
629
753
|
]).finally(() => {
|
|
630
|
-
mark(
|
|
754
|
+
mark("code/didRestoreEditors");
|
|
631
755
|
}));
|
|
632
756
|
})());
|
|
633
757
|
const restoreDefaultViewsPromise = (async () => {
|
|
634
758
|
if (this.state.initialization.views.defaults?.length) {
|
|
635
|
-
mark(
|
|
759
|
+
mark("code/willOpenDefaultViews");
|
|
636
760
|
const locationsRestored = [];
|
|
637
|
-
const tryOpenView =
|
|
761
|
+
const tryOpenView = view => {
|
|
638
762
|
const location = this.viewDescriptorService.getViewLocationById(view.id);
|
|
639
763
|
if (location !== null) {
|
|
640
764
|
const container = this.viewDescriptorService.getViewContainerByViewId(view.id);
|
|
641
765
|
if (container) {
|
|
642
766
|
if (view.order >= (locationsRestored?.[location]?.order ?? 0)) {
|
|
643
|
-
locationsRestored[location] = {
|
|
767
|
+
locationsRestored[location] = {
|
|
768
|
+
id: container.id,
|
|
769
|
+
order: view.order
|
|
770
|
+
};
|
|
644
771
|
}
|
|
645
772
|
const containerModel = this.viewDescriptorService.getViewContainerModel(container);
|
|
646
773
|
containerModel.setCollapsed(view.id, false);
|
|
@@ -650,7 +777,10 @@ class Layout extends Disposable {
|
|
|
650
777
|
}
|
|
651
778
|
return false;
|
|
652
779
|
};
|
|
653
|
-
const defaultViews = ( [...this.state.initialization.views.defaults].reverse().map((v, index) => ({
|
|
780
|
+
const defaultViews = ( [...this.state.initialization.views.defaults].reverse().map((v, index) => ({
|
|
781
|
+
id: v,
|
|
782
|
+
order: index
|
|
783
|
+
})));
|
|
654
784
|
let i = defaultViews.length;
|
|
655
785
|
while (i) {
|
|
656
786
|
i--;
|
|
@@ -677,7 +807,7 @@ class Layout extends Disposable {
|
|
|
677
807
|
if (locationsRestored[ViewContainerLocation.AuxiliaryBar]) {
|
|
678
808
|
this.state.initialization.views.containerToRestore.auxiliaryBar = locationsRestored[ViewContainerLocation.AuxiliaryBar].id;
|
|
679
809
|
}
|
|
680
|
-
mark(
|
|
810
|
+
mark("code/didOpenDefaultViews");
|
|
681
811
|
}
|
|
682
812
|
})();
|
|
683
813
|
layoutReadyPromises.push(restoreDefaultViewsPromise);
|
|
@@ -686,27 +816,36 @@ class Layout extends Disposable {
|
|
|
686
816
|
if (!this.state.initialization.views.containerToRestore.sideBar) {
|
|
687
817
|
return;
|
|
688
818
|
}
|
|
689
|
-
mark(
|
|
690
|
-
await this.openViewContainer(
|
|
691
|
-
|
|
819
|
+
mark("code/willRestoreViewlet");
|
|
820
|
+
await this.openViewContainer(
|
|
821
|
+
ViewContainerLocation.Sidebar,
|
|
822
|
+
this.state.initialization.views.containerToRestore.sideBar
|
|
823
|
+
);
|
|
824
|
+
mark("code/didRestoreViewlet");
|
|
692
825
|
})());
|
|
693
826
|
layoutReadyPromises.push((async () => {
|
|
694
827
|
await restoreDefaultViewsPromise;
|
|
695
828
|
if (!this.state.initialization.views.containerToRestore.panel) {
|
|
696
829
|
return;
|
|
697
830
|
}
|
|
698
|
-
mark(
|
|
699
|
-
await this.openViewContainer(
|
|
700
|
-
|
|
831
|
+
mark("code/willRestorePanel");
|
|
832
|
+
await this.openViewContainer(
|
|
833
|
+
ViewContainerLocation.Panel,
|
|
834
|
+
this.state.initialization.views.containerToRestore.panel
|
|
835
|
+
);
|
|
836
|
+
mark("code/didRestorePanel");
|
|
701
837
|
})());
|
|
702
838
|
layoutReadyPromises.push((async () => {
|
|
703
839
|
await restoreDefaultViewsPromise;
|
|
704
840
|
if (!this.state.initialization.views.containerToRestore.auxiliaryBar) {
|
|
705
841
|
return;
|
|
706
842
|
}
|
|
707
|
-
mark(
|
|
708
|
-
await this.openViewContainer(
|
|
709
|
-
|
|
843
|
+
mark("code/willRestoreAuxiliaryBar");
|
|
844
|
+
await this.openViewContainer(
|
|
845
|
+
ViewContainerLocation.AuxiliaryBar,
|
|
846
|
+
this.state.initialization.views.containerToRestore.auxiliaryBar
|
|
847
|
+
);
|
|
848
|
+
mark("code/didRestoreAuxiliaryBar");
|
|
710
849
|
})());
|
|
711
850
|
const zenModeWasActive = this.isZenModeActive();
|
|
712
851
|
const restoreZenMode = getZenModeConfiguration(this.configurationService).restore;
|
|
@@ -723,6 +862,10 @@ class Layout extends Disposable {
|
|
|
723
862
|
}
|
|
724
863
|
this.whenReadyPromise.complete();
|
|
725
864
|
Promises.settled(layoutRestoredPromises).finally(() => {
|
|
865
|
+
if (
|
|
866
|
+
this.editorService.editors.length === 0 && this.isVisible(Parts.AUXILIARYBAR_PART) && !this.hasFocus(Parts.AUXILIARYBAR_PART) && !this.environmentService.enableSmokeTestDriver) {
|
|
867
|
+
this.focusPart(Parts.AUXILIARYBAR_PART);
|
|
868
|
+
}
|
|
726
869
|
this.restored = true;
|
|
727
870
|
this.whenRestoredPromise.complete();
|
|
728
871
|
});
|
|
@@ -733,11 +876,19 @@ class Layout extends Disposable {
|
|
|
733
876
|
if (viewContainer) {
|
|
734
877
|
return;
|
|
735
878
|
}
|
|
736
|
-
viewContainer = await this.paneCompositeService.openPaneComposite(
|
|
879
|
+
viewContainer = await this.paneCompositeService.openPaneComposite(
|
|
880
|
+
this.viewDescriptorService.getDefaultViewContainer(location)?.id,
|
|
881
|
+
location,
|
|
882
|
+
focus
|
|
883
|
+
);
|
|
737
884
|
if (viewContainer) {
|
|
738
885
|
return;
|
|
739
886
|
}
|
|
740
|
-
await this.paneCompositeService.openPaneComposite(
|
|
887
|
+
await this.paneCompositeService.openPaneComposite(
|
|
888
|
+
this.paneCompositeService.getVisiblePaneCompositeIds(location).at(0),
|
|
889
|
+
location,
|
|
890
|
+
focus
|
|
891
|
+
);
|
|
741
892
|
}
|
|
742
893
|
registerPart(part) {
|
|
743
894
|
const id = part.getId();
|
|
@@ -752,7 +903,9 @@ class Layout extends Disposable {
|
|
|
752
903
|
return part;
|
|
753
904
|
}
|
|
754
905
|
registerNotifications(delegate) {
|
|
755
|
-
this._register(
|
|
906
|
+
this._register(
|
|
907
|
+
delegate.onDidChangeNotificationsVisibility(visible => this._onDidChangeNotificationsVisibility.fire(visible))
|
|
908
|
+
);
|
|
756
909
|
}
|
|
757
910
|
hasFocus(part) {
|
|
758
911
|
const container = this.getContainer(getActiveWindow(), part);
|
|
@@ -776,34 +929,38 @@ class Layout extends Disposable {
|
|
|
776
929
|
focusPart(part, targetWindow = mainWindow) {
|
|
777
930
|
const container = this.getContainer(targetWindow, part) ?? this.mainContainer;
|
|
778
931
|
switch (part) {
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
932
|
+
case Parts.EDITOR_PART:
|
|
933
|
+
this.editorGroupService.getPart(container).activeGroup.focus();
|
|
934
|
+
break;
|
|
935
|
+
case Parts.PANEL_PART:
|
|
936
|
+
{
|
|
783
937
|
this.paneCompositeService.getActivePaneComposite(ViewContainerLocation.Panel)?.focus();
|
|
784
938
|
break;
|
|
785
939
|
}
|
|
786
|
-
|
|
940
|
+
case Parts.SIDEBAR_PART:
|
|
941
|
+
{
|
|
787
942
|
this.paneCompositeService.getActivePaneComposite(ViewContainerLocation.Sidebar)?.focus();
|
|
788
943
|
break;
|
|
789
944
|
}
|
|
790
|
-
|
|
945
|
+
case Parts.AUXILIARYBAR_PART:
|
|
946
|
+
{
|
|
791
947
|
this.paneCompositeService.getActivePaneComposite(ViewContainerLocation.AuxiliaryBar)?.focus();
|
|
792
948
|
break;
|
|
793
949
|
}
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
950
|
+
case Parts.ACTIVITYBAR_PART:
|
|
951
|
+
this.getPart(Parts.SIDEBAR_PART).focusActivityBar();
|
|
952
|
+
break;
|
|
953
|
+
case Parts.STATUSBAR_PART:
|
|
954
|
+
this.statusBarService.getPart(container).focus();
|
|
955
|
+
break;
|
|
956
|
+
default:
|
|
957
|
+
{
|
|
801
958
|
container?.focus();
|
|
802
959
|
}
|
|
803
960
|
}
|
|
804
961
|
}
|
|
805
962
|
getContainer(targetWindow, part) {
|
|
806
|
-
if (typeof part ===
|
|
963
|
+
if (typeof part === "undefined") {
|
|
807
964
|
return this.getContainerFromDocument(targetWindow.document);
|
|
808
965
|
}
|
|
809
966
|
if (targetWindow === mainWindow) {
|
|
@@ -812,11 +969,9 @@ class Layout extends Disposable {
|
|
|
812
969
|
let partCandidate;
|
|
813
970
|
if (part === Parts.EDITOR_PART) {
|
|
814
971
|
partCandidate = this.editorGroupService.getPart(this.getContainerFromDocument(targetWindow.document));
|
|
815
|
-
}
|
|
816
|
-
else if (part === Parts.STATUSBAR_PART) {
|
|
972
|
+
} else if (part === Parts.STATUSBAR_PART) {
|
|
817
973
|
partCandidate = this.statusBarService.getPart(this.getContainerFromDocument(targetWindow.document));
|
|
818
|
-
}
|
|
819
|
-
else if (part === Parts.TITLEBAR_PART) {
|
|
974
|
+
} else if (part === Parts.TITLEBAR_PART) {
|
|
820
975
|
partCandidate = this.titleService.getPart(this.getContainerFromDocument(targetWindow.document));
|
|
821
976
|
}
|
|
822
977
|
if (partCandidate instanceof Part) {
|
|
@@ -829,26 +984,24 @@ class Layout extends Disposable {
|
|
|
829
984
|
return true;
|
|
830
985
|
}
|
|
831
986
|
switch (part) {
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
default:
|
|
851
|
-
return false;
|
|
987
|
+
case Parts.TITLEBAR_PART:
|
|
988
|
+
return this.initialized ? this.workbenchGrid.isViewVisible(this.titleBarPartView) : shouldShowCustomTitleBar(this.configurationService, mainWindow, this.state.runtime.menuBar.toggled);
|
|
989
|
+
case Parts.SIDEBAR_PART:
|
|
990
|
+
return !this.stateModel.getRuntimeValue(LayoutStateKeys.SIDEBAR_HIDDEN);
|
|
991
|
+
case Parts.PANEL_PART:
|
|
992
|
+
return !this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_HIDDEN);
|
|
993
|
+
case Parts.AUXILIARYBAR_PART:
|
|
994
|
+
return !this.stateModel.getRuntimeValue(LayoutStateKeys.AUXILIARYBAR_HIDDEN);
|
|
995
|
+
case Parts.STATUSBAR_PART:
|
|
996
|
+
return !this.stateModel.getRuntimeValue(LayoutStateKeys.STATUSBAR_HIDDEN);
|
|
997
|
+
case Parts.ACTIVITYBAR_PART:
|
|
998
|
+
return !this.stateModel.getRuntimeValue(LayoutStateKeys.ACTIVITYBAR_HIDDEN);
|
|
999
|
+
case Parts.EDITOR_PART:
|
|
1000
|
+
return !this.stateModel.getRuntimeValue(LayoutStateKeys.EDITOR_HIDDEN);
|
|
1001
|
+
case Parts.BANNER_PART:
|
|
1002
|
+
return this.initialized ? this.workbenchGrid.isViewVisible(this.bannerPartView) : false;
|
|
1003
|
+
default:
|
|
1004
|
+
return false;
|
|
852
1005
|
}
|
|
853
1006
|
}
|
|
854
1007
|
shouldShowBannerFirst() {
|
|
@@ -857,11 +1010,9 @@ class Layout extends Disposable {
|
|
|
857
1010
|
focus() {
|
|
858
1011
|
if (this.isPanelMaximized() && this.mainContainer === this.activeContainer) {
|
|
859
1012
|
this.focusPart(Parts.PANEL_PART);
|
|
860
|
-
}
|
|
861
|
-
else if (this.isAuxiliaryBarMaximized() && this.mainContainer === this.activeContainer) {
|
|
1013
|
+
} else if (this.isAuxiliaryBarMaximized() && this.mainContainer === this.activeContainer) {
|
|
862
1014
|
this.focusPart(Parts.AUXILIARYBAR_PART);
|
|
863
|
-
}
|
|
864
|
-
else {
|
|
1015
|
+
} else {
|
|
865
1016
|
this.focusPart(Parts.EDITOR_PART, getWindow(this.activeContainer));
|
|
866
1017
|
}
|
|
867
1018
|
}
|
|
@@ -869,8 +1020,7 @@ class Layout extends Disposable {
|
|
|
869
1020
|
const activePanel = this.paneCompositeService.getActivePaneComposite(ViewContainerLocation.Panel);
|
|
870
1021
|
if ((this.hasFocus(Parts.PANEL_PART) || !this.isVisible(Parts.EDITOR_PART)) && activePanel) {
|
|
871
1022
|
activePanel.focus();
|
|
872
|
-
}
|
|
873
|
-
else {
|
|
1023
|
+
} else {
|
|
874
1024
|
this.focus();
|
|
875
1025
|
}
|
|
876
1026
|
}
|
|
@@ -879,21 +1029,20 @@ class Layout extends Disposable {
|
|
|
879
1029
|
const containerDimension = this.getContainerDimension(container);
|
|
880
1030
|
if (container === this.mainContainer) {
|
|
881
1031
|
const isPanelHorizontal = isHorizontal(this.getPanelPosition());
|
|
882
|
-
const takenWidth = (this.isVisible(Parts.ACTIVITYBAR_PART) ? this.activityBarPartView.minimumWidth : 0) +
|
|
883
|
-
|
|
884
|
-
(this.isVisible(Parts.PANEL_PART) && !isPanelHorizontal ? this.panelPartView.minimumWidth : 0) +
|
|
885
|
-
(this.isVisible(Parts.AUXILIARYBAR_PART) ? this.auxiliaryBarPartView.minimumWidth : 0);
|
|
886
|
-
const takenHeight = (this.isVisible(Parts.TITLEBAR_PART, targetWindow) ? this.titleBarPartView.minimumHeight : 0) +
|
|
887
|
-
(this.isVisible(Parts.STATUSBAR_PART, targetWindow) ? this.statusBarPartView.minimumHeight : 0) +
|
|
888
|
-
(this.isVisible(Parts.PANEL_PART) && isPanelHorizontal ? this.panelPartView.minimumHeight : 0);
|
|
1032
|
+
const takenWidth = (this.isVisible(Parts.ACTIVITYBAR_PART) ? this.activityBarPartView.minimumWidth : 0) + (this.isVisible(Parts.SIDEBAR_PART) ? this.sideBarPartView.minimumWidth : 0) + (this.isVisible(Parts.PANEL_PART) && !isPanelHorizontal ? this.panelPartView.minimumWidth : 0) + (this.isVisible(Parts.AUXILIARYBAR_PART) ? this.auxiliaryBarPartView.minimumWidth : 0);
|
|
1033
|
+
const takenHeight = (this.isVisible(Parts.TITLEBAR_PART, targetWindow) ? this.titleBarPartView.minimumHeight : 0) + (this.isVisible(Parts.STATUSBAR_PART, targetWindow) ? this.statusBarPartView.minimumHeight : 0) + (this.isVisible(Parts.PANEL_PART) && isPanelHorizontal ? this.panelPartView.minimumHeight : 0);
|
|
889
1034
|
const availableWidth = containerDimension.width - takenWidth;
|
|
890
1035
|
const availableHeight = containerDimension.height - takenHeight;
|
|
891
|
-
return {
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
1036
|
+
return {
|
|
1037
|
+
width: availableWidth,
|
|
1038
|
+
height: availableHeight
|
|
1039
|
+
};
|
|
1040
|
+
} else {
|
|
1041
|
+
const takenHeight = (this.isVisible(Parts.TITLEBAR_PART, targetWindow) ? this.titleBarPartView.minimumHeight : 0) + (this.isVisible(Parts.STATUSBAR_PART, targetWindow) ? this.statusBarPartView.minimumHeight : 0);
|
|
1042
|
+
return {
|
|
1043
|
+
width: containerDimension.width,
|
|
1044
|
+
height: containerDimension.height - takenHeight
|
|
1045
|
+
};
|
|
897
1046
|
}
|
|
898
1047
|
}
|
|
899
1048
|
isZenModeActive() {
|
|
@@ -906,16 +1055,21 @@ class Layout extends Disposable {
|
|
|
906
1055
|
const focusedPartPreTransition = this._getFocusedPart();
|
|
907
1056
|
this.setZenModeActive(!this.isZenModeActive());
|
|
908
1057
|
this.state.runtime.zenMode.transitionDisposables.clearAndDisposeAll();
|
|
909
|
-
const setLineNumbers =
|
|
1058
|
+
const setLineNumbers = lineNumbers => {
|
|
910
1059
|
for (const editor of this.mainPartEditorService.visibleTextEditorControls) {
|
|
911
1060
|
if (!lineNumbers && isCodeEditor(editor) && editor.hasModel()) {
|
|
912
1061
|
const model = editor.getModel();
|
|
913
|
-
lineNumbers = this.configurationService.getValue(
|
|
1062
|
+
lineNumbers = this.configurationService.getValue("editor.lineNumbers", {
|
|
1063
|
+
resource: model.uri,
|
|
1064
|
+
overrideIdentifier: model.getLanguageId()
|
|
1065
|
+
});
|
|
914
1066
|
}
|
|
915
1067
|
if (!lineNumbers) {
|
|
916
|
-
lineNumbers = this.configurationService.getValue(
|
|
1068
|
+
lineNumbers = this.configurationService.getValue("editor.lineNumbers");
|
|
917
1069
|
}
|
|
918
|
-
editor.updateOptions({
|
|
1070
|
+
editor.updateOptions({
|
|
1071
|
+
lineNumbers
|
|
1072
|
+
});
|
|
919
1073
|
}
|
|
920
1074
|
};
|
|
921
1075
|
let toggleMainWindowFullScreen = false;
|
|
@@ -942,11 +1096,19 @@ class Layout extends Disposable {
|
|
|
942
1096
|
this.setStatusBarHidden(true);
|
|
943
1097
|
}
|
|
944
1098
|
if (config.hideLineNumbers) {
|
|
945
|
-
setLineNumbers(
|
|
946
|
-
this.state.runtime.zenMode.transitionDisposables.set(
|
|
1099
|
+
setLineNumbers("off");
|
|
1100
|
+
this.state.runtime.zenMode.transitionDisposables.set(
|
|
1101
|
+
ZenModeSettings.HIDE_LINENUMBERS,
|
|
1102
|
+
this.mainPartEditorService.onDidVisibleEditorsChange(() => setLineNumbers("off"))
|
|
1103
|
+
);
|
|
947
1104
|
}
|
|
948
1105
|
if (config.showTabs !== this.editorGroupService.partOptions.showTabs) {
|
|
949
|
-
this.state.runtime.zenMode.transitionDisposables.set(
|
|
1106
|
+
this.state.runtime.zenMode.transitionDisposables.set(
|
|
1107
|
+
ZenModeSettings.SHOW_TABS,
|
|
1108
|
+
this.editorGroupService.mainPart.enforcePartOptions({
|
|
1109
|
+
showTabs: config.showTabs
|
|
1110
|
+
})
|
|
1111
|
+
);
|
|
950
1112
|
}
|
|
951
1113
|
if (config.silentNotifications && zenModeExitInfo.handleNotificationsDoNotDisturbMode) {
|
|
952
1114
|
this.notificationService.setFilter(NotificationsFilter.ERROR);
|
|
@@ -954,36 +1116,51 @@ class Layout extends Disposable {
|
|
|
954
1116
|
if (config.centerLayout) {
|
|
955
1117
|
this.centerMainEditorLayout(true, true);
|
|
956
1118
|
}
|
|
957
|
-
this.state.runtime.zenMode.transitionDisposables.set(
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
}
|
|
967
|
-
if (e.affectsConfiguration(ZenModeSettings.CENTER_LAYOUT)) {
|
|
968
|
-
const zenModeCenterLayout = this.configurationService.getValue(ZenModeSettings.CENTER_LAYOUT);
|
|
969
|
-
this.centerMainEditorLayout(zenModeCenterLayout, true);
|
|
970
|
-
}
|
|
971
|
-
if (e.affectsConfiguration(ZenModeSettings.SHOW_TABS)) {
|
|
972
|
-
const zenModeShowTabs = this.configurationService.getValue(ZenModeSettings.SHOW_TABS) ?? 'multiple';
|
|
973
|
-
this.state.runtime.zenMode.transitionDisposables.set(ZenModeSettings.SHOW_TABS, this.editorGroupService.mainPart.enforcePartOptions({ showTabs: zenModeShowTabs }));
|
|
974
|
-
}
|
|
975
|
-
if (e.affectsConfiguration(ZenModeSettings.SILENT_NOTIFICATIONS)) {
|
|
976
|
-
const zenModeSilentNotifications = !!this.configurationService.getValue(ZenModeSettings.SILENT_NOTIFICATIONS);
|
|
977
|
-
if (zenModeExitInfo.handleNotificationsDoNotDisturbMode) {
|
|
978
|
-
this.notificationService.setFilter(zenModeSilentNotifications ? NotificationsFilter.ERROR : NotificationsFilter.OFF);
|
|
1119
|
+
this.state.runtime.zenMode.transitionDisposables.set(
|
|
1120
|
+
"configurationChange",
|
|
1121
|
+
this.configurationService.onDidChangeConfiguration(e => {
|
|
1122
|
+
if (e.affectsConfiguration(ZenModeSettings.HIDE_ACTIVITYBAR) || e.affectsConfiguration(LayoutSettings.ACTIVITY_BAR_LOCATION)) {
|
|
1123
|
+
const zenModeHideActivityBar = this.configurationService.getValue(ZenModeSettings.HIDE_ACTIVITYBAR);
|
|
1124
|
+
const activityBarLocation = this.configurationService.getValue(LayoutSettings.ACTIVITY_BAR_LOCATION);
|
|
1125
|
+
this.setActivityBarHidden(
|
|
1126
|
+
zenModeHideActivityBar ? true : (activityBarLocation === ActivityBarPosition.TOP || activityBarLocation === ActivityBarPosition.BOTTOM)
|
|
1127
|
+
);
|
|
979
1128
|
}
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
1129
|
+
if (e.affectsConfiguration(ZenModeSettings.HIDE_STATUSBAR)) {
|
|
1130
|
+
const zenModeHideStatusBar = this.configurationService.getValue(ZenModeSettings.HIDE_STATUSBAR);
|
|
1131
|
+
this.setStatusBarHidden(zenModeHideStatusBar);
|
|
1132
|
+
}
|
|
1133
|
+
if (e.affectsConfiguration(ZenModeSettings.CENTER_LAYOUT)) {
|
|
1134
|
+
const zenModeCenterLayout = this.configurationService.getValue(ZenModeSettings.CENTER_LAYOUT);
|
|
1135
|
+
this.centerMainEditorLayout(zenModeCenterLayout, true);
|
|
1136
|
+
}
|
|
1137
|
+
if (e.affectsConfiguration(ZenModeSettings.SHOW_TABS)) {
|
|
1138
|
+
const zenModeShowTabs = this.configurationService.getValue(ZenModeSettings.SHOW_TABS) ?? "multiple";
|
|
1139
|
+
this.state.runtime.zenMode.transitionDisposables.set(
|
|
1140
|
+
ZenModeSettings.SHOW_TABS,
|
|
1141
|
+
this.editorGroupService.mainPart.enforcePartOptions({
|
|
1142
|
+
showTabs: zenModeShowTabs
|
|
1143
|
+
})
|
|
1144
|
+
);
|
|
1145
|
+
}
|
|
1146
|
+
if (e.affectsConfiguration(ZenModeSettings.SILENT_NOTIFICATIONS)) {
|
|
1147
|
+
const zenModeSilentNotifications = !!this.configurationService.getValue(ZenModeSettings.SILENT_NOTIFICATIONS);
|
|
1148
|
+
if (zenModeExitInfo.handleNotificationsDoNotDisturbMode) {
|
|
1149
|
+
this.notificationService.setFilter(
|
|
1150
|
+
zenModeSilentNotifications ? NotificationsFilter.ERROR : NotificationsFilter.OFF
|
|
1151
|
+
);
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
if (e.affectsConfiguration(ZenModeSettings.HIDE_LINENUMBERS)) {
|
|
1155
|
+
const lineNumbersType = this.configurationService.getValue(ZenModeSettings.HIDE_LINENUMBERS) ? "off" : undefined;
|
|
1156
|
+
setLineNumbers(lineNumbersType);
|
|
1157
|
+
this.state.runtime.zenMode.transitionDisposables.set(
|
|
1158
|
+
ZenModeSettings.HIDE_LINENUMBERS,
|
|
1159
|
+
this.mainPartEditorService.onDidVisibleEditorsChange(() => setLineNumbers(lineNumbersType))
|
|
1160
|
+
);
|
|
1161
|
+
}
|
|
1162
|
+
})
|
|
1163
|
+
);
|
|
987
1164
|
}
|
|
988
1165
|
else {
|
|
989
1166
|
if (zenModeExitInfo.wasVisible.panel) {
|
|
@@ -1019,12 +1196,10 @@ class Layout extends Disposable {
|
|
|
1019
1196
|
if (focusedPartPreTransition && this.isVisible(focusedPartPreTransition, getWindow(this.activeContainer))) {
|
|
1020
1197
|
if (isMultiWindowPart(focusedPartPreTransition)) {
|
|
1021
1198
|
this.focusPart(focusedPartPreTransition, getWindow(this.activeContainer));
|
|
1022
|
-
}
|
|
1023
|
-
else {
|
|
1199
|
+
} else {
|
|
1024
1200
|
this.focusPart(focusedPartPreTransition);
|
|
1025
1201
|
}
|
|
1026
|
-
}
|
|
1027
|
-
else {
|
|
1202
|
+
} else {
|
|
1028
1203
|
this.focus();
|
|
1029
1204
|
}
|
|
1030
1205
|
this._onDidChangeZenMode.fire(this.isZenModeActive());
|
|
@@ -1033,8 +1208,7 @@ class Layout extends Disposable {
|
|
|
1033
1208
|
this.stateModel.setRuntimeValue(LayoutStateKeys.STATUSBAR_HIDDEN, hidden);
|
|
1034
1209
|
if (hidden) {
|
|
1035
1210
|
this.mainContainer.classList.add(LayoutClasses.STATUSBAR_HIDDEN);
|
|
1036
|
-
}
|
|
1037
|
-
else {
|
|
1211
|
+
} else {
|
|
1038
1212
|
this.mainContainer.classList.remove(LayoutClasses.STATUSBAR_HIDDEN);
|
|
1039
1213
|
}
|
|
1040
1214
|
this.workbenchGrid.setViewVisible(this.statusBarPartView, !hidden);
|
|
@@ -1066,63 +1240,84 @@ class Layout extends Disposable {
|
|
|
1066
1240
|
[Parts.STATUSBAR_PART]: this.statusBarPartView,
|
|
1067
1241
|
[Parts.AUXILIARYBAR_PART]: this.auxiliaryBarPartView
|
|
1068
1242
|
};
|
|
1069
|
-
const fromJSON = (
|
|
1070
|
-
|
|
1243
|
+
const fromJSON = (
|
|
1244
|
+
{
|
|
1245
|
+
type
|
|
1246
|
+
}
|
|
1247
|
+
) => viewMap[type];
|
|
1248
|
+
const workbenchGrid = SerializableGrid.deserialize(this.createGridDescriptor(), {
|
|
1249
|
+
fromJSON
|
|
1250
|
+
}, {
|
|
1251
|
+
proportionalLayout: false
|
|
1252
|
+
});
|
|
1071
1253
|
this.mainContainer.prepend(workbenchGrid.element);
|
|
1072
|
-
this.mainContainer.setAttribute(
|
|
1254
|
+
this.mainContainer.setAttribute("role", "application");
|
|
1073
1255
|
this.workbenchGrid = workbenchGrid;
|
|
1074
1256
|
this.workbenchGrid.edgeSnapping = this.state.runtime.mainWindowFullscreen;
|
|
1075
|
-
for (const part of [
|
|
1257
|
+
for (const part of [
|
|
1258
|
+
titleBar,
|
|
1259
|
+
editorPart,
|
|
1260
|
+
activityBar,
|
|
1261
|
+
panelPart,
|
|
1262
|
+
sideBar,
|
|
1263
|
+
statusBar,
|
|
1264
|
+
auxiliaryBarPart,
|
|
1265
|
+
bannerPart
|
|
1266
|
+
]) {
|
|
1076
1267
|
this._register(part.onDidVisibilityChange(visible => {
|
|
1077
1268
|
if (!this.inMaximizedAuxiliaryBarTransition) {
|
|
1078
1269
|
if (part === sideBar) {
|
|
1079
1270
|
this.setSideBarHidden(!visible);
|
|
1080
|
-
}
|
|
1081
|
-
else if (part === panelPart && this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_HIDDEN) === visible) {
|
|
1271
|
+
} else if (part === panelPart && this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_HIDDEN) === visible) {
|
|
1082
1272
|
this.setPanelHidden(!visible, true);
|
|
1083
|
-
}
|
|
1084
|
-
else if (part === auxiliaryBarPart) {
|
|
1273
|
+
} else if (part === auxiliaryBarPart) {
|
|
1085
1274
|
this.setAuxiliaryBarHidden(!visible, true);
|
|
1086
|
-
}
|
|
1087
|
-
else if (part === editorPart) {
|
|
1275
|
+
} else if (part === editorPart) {
|
|
1088
1276
|
this.setEditorHidden(!visible);
|
|
1089
1277
|
}
|
|
1090
1278
|
}
|
|
1091
|
-
this._onDidChangePartVisibility.fire(
|
|
1279
|
+
this._onDidChangePartVisibility.fire({
|
|
1280
|
+
partId: part.getId(),
|
|
1281
|
+
visible
|
|
1282
|
+
});
|
|
1092
1283
|
this.handleContainerDidLayout(this.mainContainer, this._mainContainerDimension);
|
|
1093
1284
|
}));
|
|
1094
1285
|
}
|
|
1095
1286
|
this._register(this.storageService.onWillSaveState(() => {
|
|
1096
|
-
const sideBarSize = this.stateModel.getRuntimeValue(LayoutStateKeys.SIDEBAR_HIDDEN)
|
|
1097
|
-
? this.workbenchGrid.getViewCachedVisibleSize(this.sideBarPartView)
|
|
1098
|
-
: this.workbenchGrid.getViewSize(this.sideBarPartView).width;
|
|
1287
|
+
const sideBarSize = this.stateModel.getRuntimeValue(LayoutStateKeys.SIDEBAR_HIDDEN) ? this.workbenchGrid.getViewCachedVisibleSize(this.sideBarPartView) : this.workbenchGrid.getViewSize(this.sideBarPartView).width;
|
|
1099
1288
|
this.stateModel.setInitializationValue(LayoutStateKeys.SIDEBAR_SIZE, sideBarSize);
|
|
1100
|
-
const panelSize = this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_HIDDEN)
|
|
1101
|
-
? this.workbenchGrid.getViewCachedVisibleSize(this.panelPartView)
|
|
1102
|
-
: isHorizontal(this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_POSITION))
|
|
1103
|
-
? this.workbenchGrid.getViewSize(this.panelPartView).height
|
|
1104
|
-
: this.workbenchGrid.getViewSize(this.panelPartView).width;
|
|
1289
|
+
const panelSize = this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_HIDDEN) ? this.workbenchGrid.getViewCachedVisibleSize(this.panelPartView) : isHorizontal(this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_POSITION)) ? this.workbenchGrid.getViewSize(this.panelPartView).height : this.workbenchGrid.getViewSize(this.panelPartView).width;
|
|
1105
1290
|
this.stateModel.setInitializationValue(LayoutStateKeys.PANEL_SIZE, panelSize);
|
|
1106
|
-
const auxiliaryBarSize = this.stateModel.getRuntimeValue(LayoutStateKeys.AUXILIARYBAR_HIDDEN)
|
|
1107
|
-
? this.workbenchGrid.getViewCachedVisibleSize(this.auxiliaryBarPartView)
|
|
1108
|
-
: this.workbenchGrid.getViewSize(this.auxiliaryBarPartView).width;
|
|
1291
|
+
const auxiliaryBarSize = this.stateModel.getRuntimeValue(LayoutStateKeys.AUXILIARYBAR_HIDDEN) ? this.workbenchGrid.getViewCachedVisibleSize(this.auxiliaryBarPartView) : this.workbenchGrid.getViewSize(this.auxiliaryBarPartView).width;
|
|
1109
1292
|
this.stateModel.setInitializationValue(LayoutStateKeys.AUXILIARYBAR_SIZE, auxiliaryBarSize);
|
|
1110
1293
|
this.stateModel.save(true, true);
|
|
1111
1294
|
}));
|
|
1112
|
-
this._register(Event.any(
|
|
1113
|
-
this.
|
|
1295
|
+
this._register(Event.any(
|
|
1296
|
+
this.paneCompositeService.onDidPaneCompositeOpen,
|
|
1297
|
+
this.paneCompositeService.onDidPaneCompositeClose
|
|
1298
|
+
)(() => {
|
|
1299
|
+
this.stateModel.setInitializationValue(
|
|
1300
|
+
LayoutStateKeys.AUXILIARYBAR_EMPTY,
|
|
1301
|
+
this.paneCompositeService.getPaneCompositeIds(ViewContainerLocation.AuxiliaryBar).length === 0
|
|
1302
|
+
);
|
|
1114
1303
|
}));
|
|
1115
1304
|
}
|
|
1116
1305
|
layout() {
|
|
1117
1306
|
if (!this.disposed) {
|
|
1118
1307
|
const fullscreenElement = getFullscreenElement(mainWindow.document);
|
|
1119
|
-
this._mainContainerDimension = getClientArea(
|
|
1120
|
-
|
|
1121
|
-
this.parent,
|
|
1122
|
-
|
|
1308
|
+
this._mainContainerDimension = getClientArea(
|
|
1309
|
+
this.state.runtime.mainWindowFullscreen && this.mainContainer === fullscreenElement ?
|
|
1310
|
+
mainWindow.document.body : this.parent,
|
|
1311
|
+
this.contextService.getWorkbenchState() === WorkbenchState.EMPTY ? DEFAULT_EMPTY_WINDOW_DIMENSIONS : DEFAULT_WORKSPACE_WINDOW_DIMENSIONS
|
|
1312
|
+
);
|
|
1313
|
+
this.logService.trace(
|
|
1314
|
+
`Layout#layout, height: ${this._mainContainerDimension.height}, width: ${this._mainContainerDimension.width}`
|
|
1315
|
+
);
|
|
1316
|
+
size(
|
|
1317
|
+
this.mainContainer,
|
|
1318
|
+
this._mainContainerDimension.width,
|
|
1319
|
+
this._mainContainerDimension.height
|
|
1123
1320
|
);
|
|
1124
|
-
this.logService.trace(`Layout#layout, height: ${this._mainContainerDimension.height}, width: ${this._mainContainerDimension.width}`);
|
|
1125
|
-
size(this.mainContainer, this._mainContainerDimension.width, this._mainContainerDimension.height);
|
|
1126
1321
|
this.workbenchGrid.layout(this._mainContainerDimension.width, this._mainContainerDimension.height);
|
|
1127
1322
|
this.initialized = true;
|
|
1128
1323
|
this.handleContainerDidLayout(this.mainContainer, this._mainContainerDimension);
|
|
@@ -1136,7 +1331,7 @@ class Layout extends Disposable {
|
|
|
1136
1331
|
const mainVisibleEditors = coalesce(( this.editorGroupService.mainPart.groups.map(group => group.activeEditor)));
|
|
1137
1332
|
const isEditorComplex = ( mainVisibleEditors.some(editor => {
|
|
1138
1333
|
if (editor instanceof DiffEditorInput) {
|
|
1139
|
-
return this.configurationService.getValue(
|
|
1334
|
+
return this.configurationService.getValue("diffEditor.renderSideBySide");
|
|
1140
1335
|
}
|
|
1141
1336
|
if (editor?.hasCapability(EditorInputCapabilities.MultipleEditors)) {
|
|
1142
1337
|
return true;
|
|
@@ -1147,13 +1342,11 @@ class Layout extends Disposable {
|
|
|
1147
1342
|
let hasMoreThanOneColumn = false;
|
|
1148
1343
|
if (layout.orientation === GroupOrientation.HORIZONTAL) {
|
|
1149
1344
|
hasMoreThanOneColumn = layout.groups.length > 1;
|
|
1150
|
-
}
|
|
1151
|
-
else {
|
|
1345
|
+
} else {
|
|
1152
1346
|
hasMoreThanOneColumn = ( layout.groups.some(group => group.groups && group.groups.length > 1));
|
|
1153
1347
|
}
|
|
1154
|
-
const isCenteredLayoutAutoResizing = this.configurationService.getValue(
|
|
1155
|
-
if (isCenteredLayoutAutoResizing &&
|
|
1156
|
-
((hasMoreThanOneColumn && !this.editorGroupService.mainPart.hasMaximizedGroup()) || isEditorComplex)) {
|
|
1348
|
+
const isCenteredLayoutAutoResizing = this.configurationService.getValue("workbench.editor.centeredLayoutAutoResize");
|
|
1349
|
+
if (isCenteredLayoutAutoResizing && ((hasMoreThanOneColumn && !this.editorGroupService.mainPart.hasMaximizedGroup()) || isEditorComplex)) {
|
|
1157
1350
|
active = false;
|
|
1158
1351
|
}
|
|
1159
1352
|
if (this.editorGroupService.mainPart.isLayoutCentered() !== active) {
|
|
@@ -1175,50 +1368,58 @@ class Layout extends Disposable {
|
|
|
1175
1368
|
const sizeChangePxHeight = Math.sign(sizeChangeHeight) * computeScreenAwareSize(getActiveWindow(), Math.abs(sizeChangeHeight));
|
|
1176
1369
|
let viewSize;
|
|
1177
1370
|
switch (part) {
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1371
|
+
case Parts.SIDEBAR_PART:
|
|
1372
|
+
viewSize = this.workbenchGrid.getViewSize(this.sideBarPartView);
|
|
1373
|
+
this.workbenchGrid.resizeView(this.sideBarPartView, {
|
|
1374
|
+
width: viewSize.width + sizeChangePxWidth,
|
|
1375
|
+
height: viewSize.height
|
|
1376
|
+
});
|
|
1377
|
+
break;
|
|
1378
|
+
case Parts.PANEL_PART:
|
|
1379
|
+
viewSize = this.workbenchGrid.getViewSize(this.panelPartView);
|
|
1380
|
+
this.workbenchGrid.resizeView(this.panelPartView, {
|
|
1381
|
+
width: viewSize.width + (isHorizontal(this.getPanelPosition()) ? 0 : sizeChangePxWidth),
|
|
1382
|
+
height: viewSize.height + (isHorizontal(this.getPanelPosition()) ? sizeChangePxHeight : 0)
|
|
1383
|
+
});
|
|
1384
|
+
break;
|
|
1385
|
+
case Parts.AUXILIARYBAR_PART:
|
|
1386
|
+
viewSize = this.workbenchGrid.getViewSize(this.auxiliaryBarPartView);
|
|
1387
|
+
this.workbenchGrid.resizeView(this.auxiliaryBarPartView, {
|
|
1388
|
+
width: viewSize.width + sizeChangePxWidth,
|
|
1389
|
+
height: viewSize.height
|
|
1390
|
+
});
|
|
1391
|
+
break;
|
|
1392
|
+
case Parts.EDITOR_PART:
|
|
1393
|
+
viewSize = this.workbenchGrid.getViewSize(this.editorPartView);
|
|
1394
|
+
if (this.editorGroupService.mainPart.count === 1) {
|
|
1395
|
+
this.workbenchGrid.resizeView(this.editorPartView, {
|
|
1181
1396
|
width: viewSize.width + sizeChangePxWidth,
|
|
1182
|
-
height: viewSize.height
|
|
1397
|
+
height: viewSize.height + sizeChangePxHeight
|
|
1183
1398
|
});
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
viewSize = this.workbenchGrid.getViewSize(this.auxiliaryBarPartView);
|
|
1194
|
-
this.workbenchGrid.resizeView(this.auxiliaryBarPartView, {
|
|
1195
|
-
width: viewSize.width + sizeChangePxWidth,
|
|
1196
|
-
height: viewSize.height
|
|
1399
|
+
} else {
|
|
1400
|
+
const activeGroup = this.editorGroupService.mainPart.activeGroup;
|
|
1401
|
+
const {
|
|
1402
|
+
width,
|
|
1403
|
+
height
|
|
1404
|
+
} = this.editorGroupService.mainPart.getSize(activeGroup);
|
|
1405
|
+
this.editorGroupService.mainPart.setSize(activeGroup, {
|
|
1406
|
+
width: width + sizeChangePxWidth,
|
|
1407
|
+
height: height + sizeChangePxHeight
|
|
1197
1408
|
});
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1409
|
+
const {
|
|
1410
|
+
width: newWidth,
|
|
1411
|
+
height: newHeight
|
|
1412
|
+
} = this.editorGroupService.mainPart.getSize(activeGroup);
|
|
1413
|
+
if ((sizeChangePxHeight && height === newHeight) || (sizeChangePxWidth && width === newWidth)) {
|
|
1202
1414
|
this.workbenchGrid.resizeView(this.editorPartView, {
|
|
1203
|
-
width: viewSize.width + sizeChangePxWidth,
|
|
1204
|
-
height: viewSize.height + sizeChangePxHeight
|
|
1415
|
+
width: viewSize.width + (sizeChangePxWidth && width === newWidth ? sizeChangePxWidth : 0),
|
|
1416
|
+
height: viewSize.height + (sizeChangePxHeight && height === newHeight ? sizeChangePxHeight : 0)
|
|
1205
1417
|
});
|
|
1206
1418
|
}
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
const { width: newWidth, height: newHeight } = this.editorGroupService.mainPart.getSize(activeGroup);
|
|
1212
|
-
if ((sizeChangePxHeight && height === newHeight) || (sizeChangePxWidth && width === newWidth)) {
|
|
1213
|
-
this.workbenchGrid.resizeView(this.editorPartView, {
|
|
1214
|
-
width: viewSize.width + (sizeChangePxWidth && width === newWidth ? sizeChangePxWidth : 0),
|
|
1215
|
-
height: viewSize.height + (sizeChangePxHeight && height === newHeight ? sizeChangePxHeight : 0)
|
|
1216
|
-
});
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
break;
|
|
1220
|
-
default:
|
|
1221
|
-
return;
|
|
1419
|
+
}
|
|
1420
|
+
break;
|
|
1421
|
+
default:
|
|
1422
|
+
return;
|
|
1222
1423
|
}
|
|
1223
1424
|
}
|
|
1224
1425
|
setActivityBarHidden(hidden) {
|
|
@@ -1235,8 +1436,7 @@ class Layout extends Disposable {
|
|
|
1235
1436
|
this.stateModel.setRuntimeValue(LayoutStateKeys.EDITOR_HIDDEN, hidden);
|
|
1236
1437
|
if (hidden) {
|
|
1237
1438
|
this.mainContainer.classList.add(LayoutClasses.MAIN_EDITOR_AREA_HIDDEN);
|
|
1238
|
-
}
|
|
1239
|
-
else {
|
|
1439
|
+
} else {
|
|
1240
1440
|
this.mainContainer.classList.remove(LayoutClasses.MAIN_EDITOR_AREA_HIDDEN);
|
|
1241
1441
|
}
|
|
1242
1442
|
this.workbenchGrid.setViewVisible(this.editorPartView, !hidden);
|
|
@@ -1261,8 +1461,7 @@ class Layout extends Disposable {
|
|
|
1261
1461
|
this.stateModel.setRuntimeValue(LayoutStateKeys.SIDEBAR_HIDDEN, hidden);
|
|
1262
1462
|
if (hidden) {
|
|
1263
1463
|
this.mainContainer.classList.add(LayoutClasses.SIDEBAR_HIDDEN);
|
|
1264
|
-
}
|
|
1265
|
-
else {
|
|
1464
|
+
} else {
|
|
1266
1465
|
this.mainContainer.classList.remove(LayoutClasses.SIDEBAR_HIDDEN);
|
|
1267
1466
|
}
|
|
1268
1467
|
this.workbenchGrid.setViewVisible(this.sideBarPartView, !hidden);
|
|
@@ -1292,30 +1491,55 @@ class Layout extends Disposable {
|
|
|
1292
1491
|
}
|
|
1293
1492
|
adjustPartPositions(sideBarPosition, panelAlignment, panelPosition) {
|
|
1294
1493
|
const isPanelVertical = !isHorizontal(panelPosition);
|
|
1295
|
-
const sideBarSiblingToEditor = isPanelVertical || !(panelAlignment ===
|
|
1296
|
-
const auxiliaryBarSiblingToEditor = isPanelVertical || !(panelAlignment ===
|
|
1297
|
-
const preMovePanelWidth = !this.isVisible(Parts.PANEL_PART) ? Sizing.Invisible(
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
const
|
|
1494
|
+
const sideBarSiblingToEditor = isPanelVertical || !(panelAlignment === "center" || (sideBarPosition === Position.LEFT && panelAlignment === "right") || (sideBarPosition === Position.RIGHT && panelAlignment === "left"));
|
|
1495
|
+
const auxiliaryBarSiblingToEditor = isPanelVertical || !(panelAlignment === "center" || (sideBarPosition === Position.RIGHT && panelAlignment === "right") || (sideBarPosition === Position.LEFT && panelAlignment === "left"));
|
|
1496
|
+
const preMovePanelWidth = !this.isVisible(Parts.PANEL_PART) ? Sizing.Invisible(
|
|
1497
|
+
this.workbenchGrid.getViewCachedVisibleSize(this.panelPartView) ?? this.panelPartView.minimumWidth
|
|
1498
|
+
) : this.workbenchGrid.getViewSize(this.panelPartView).width;
|
|
1499
|
+
const preMovePanelHeight = !this.isVisible(Parts.PANEL_PART) ? Sizing.Invisible(
|
|
1500
|
+
this.workbenchGrid.getViewCachedVisibleSize(this.panelPartView) ?? this.panelPartView.minimumHeight
|
|
1501
|
+
) : this.workbenchGrid.getViewSize(this.panelPartView).height;
|
|
1502
|
+
const preMoveSideBarSize = !this.isVisible(Parts.SIDEBAR_PART) ? Sizing.Invisible(
|
|
1503
|
+
this.workbenchGrid.getViewCachedVisibleSize(this.sideBarPartView) ?? this.sideBarPartView.minimumWidth
|
|
1504
|
+
) : this.workbenchGrid.getViewSize(this.sideBarPartView).width;
|
|
1505
|
+
const preMoveAuxiliaryBarSize = !this.isVisible(Parts.AUXILIARYBAR_PART) ? Sizing.Invisible(
|
|
1506
|
+
this.workbenchGrid.getViewCachedVisibleSize(this.auxiliaryBarPartView) ?? this.auxiliaryBarPartView.minimumWidth
|
|
1507
|
+
) : this.workbenchGrid.getViewSize(this.auxiliaryBarPartView).width;
|
|
1301
1508
|
const focusedPart = [Parts.PANEL_PART, Parts.SIDEBAR_PART, Parts.AUXILIARYBAR_PART].find(part => this.hasFocus(part));
|
|
1302
1509
|
if (sideBarPosition === Position.LEFT) {
|
|
1303
1510
|
this.workbenchGrid.moveViewTo(this.activityBarPartView, [2, 0]);
|
|
1304
|
-
this.workbenchGrid.moveView(
|
|
1511
|
+
this.workbenchGrid.moveView(
|
|
1512
|
+
this.sideBarPartView,
|
|
1513
|
+
preMoveSideBarSize,
|
|
1514
|
+
sideBarSiblingToEditor ? this.editorPartView : this.activityBarPartView,
|
|
1515
|
+
sideBarSiblingToEditor ? Direction.Left : Direction.Right
|
|
1516
|
+
);
|
|
1305
1517
|
if (auxiliaryBarSiblingToEditor) {
|
|
1306
|
-
this.workbenchGrid.moveView(
|
|
1307
|
-
|
|
1308
|
-
|
|
1518
|
+
this.workbenchGrid.moveView(
|
|
1519
|
+
this.auxiliaryBarPartView,
|
|
1520
|
+
preMoveAuxiliaryBarSize,
|
|
1521
|
+
this.editorPartView,
|
|
1522
|
+
Direction.Right
|
|
1523
|
+
);
|
|
1524
|
+
} else {
|
|
1309
1525
|
this.workbenchGrid.moveViewTo(this.auxiliaryBarPartView, [2, -1]);
|
|
1310
1526
|
}
|
|
1311
|
-
}
|
|
1312
|
-
else {
|
|
1527
|
+
} else {
|
|
1313
1528
|
this.workbenchGrid.moveViewTo(this.activityBarPartView, [2, -1]);
|
|
1314
|
-
this.workbenchGrid.moveView(
|
|
1529
|
+
this.workbenchGrid.moveView(
|
|
1530
|
+
this.sideBarPartView,
|
|
1531
|
+
preMoveSideBarSize,
|
|
1532
|
+
sideBarSiblingToEditor ? this.editorPartView : this.activityBarPartView,
|
|
1533
|
+
sideBarSiblingToEditor ? Direction.Right : Direction.Left
|
|
1534
|
+
);
|
|
1315
1535
|
if (auxiliaryBarSiblingToEditor) {
|
|
1316
|
-
this.workbenchGrid.moveView(
|
|
1317
|
-
|
|
1318
|
-
|
|
1536
|
+
this.workbenchGrid.moveView(
|
|
1537
|
+
this.auxiliaryBarPartView,
|
|
1538
|
+
preMoveAuxiliaryBarSize,
|
|
1539
|
+
this.editorPartView,
|
|
1540
|
+
Direction.Left
|
|
1541
|
+
);
|
|
1542
|
+
} else {
|
|
1319
1543
|
this.workbenchGrid.moveViewTo(this.auxiliaryBarPartView, [2, 0]);
|
|
1320
1544
|
}
|
|
1321
1545
|
}
|
|
@@ -1323,7 +1547,12 @@ class Layout extends Disposable {
|
|
|
1323
1547
|
this.focusPart(focusedPart);
|
|
1324
1548
|
}
|
|
1325
1549
|
if (isPanelVertical) {
|
|
1326
|
-
this.workbenchGrid.moveView(
|
|
1550
|
+
this.workbenchGrid.moveView(
|
|
1551
|
+
this.panelPartView,
|
|
1552
|
+
preMovePanelWidth,
|
|
1553
|
+
this.editorPartView,
|
|
1554
|
+
panelPosition === Position.LEFT ? Direction.Left : Direction.Right
|
|
1555
|
+
);
|
|
1327
1556
|
this.workbenchGrid.resizeView(this.panelPartView, {
|
|
1328
1557
|
height: preMovePanelHeight,
|
|
1329
1558
|
width: preMovePanelWidth
|
|
@@ -1346,7 +1575,7 @@ class Layout extends Disposable {
|
|
|
1346
1575
|
if (!isHorizontal(this.getPanelPosition())) {
|
|
1347
1576
|
this.setPanelPosition(Position.BOTTOM);
|
|
1348
1577
|
}
|
|
1349
|
-
if (alignment !==
|
|
1578
|
+
if (alignment !== "center" && this.isPanelMaximized()) {
|
|
1350
1579
|
this.toggleMaximizedPanel();
|
|
1351
1580
|
}
|
|
1352
1581
|
this.stateModel.setRuntimeValue(LayoutStateKeys.PANEL_ALIGNMENT, alignment);
|
|
@@ -1366,8 +1595,7 @@ class Layout extends Disposable {
|
|
|
1366
1595
|
const panelOpensMaximized = this.panelOpensMaximized();
|
|
1367
1596
|
if (hidden) {
|
|
1368
1597
|
this.mainContainer.classList.add(LayoutClasses.PANEL_HIDDEN);
|
|
1369
|
-
}
|
|
1370
|
-
else {
|
|
1598
|
+
} else {
|
|
1371
1599
|
this.mainContainer.classList.remove(LayoutClasses.PANEL_HIDDEN);
|
|
1372
1600
|
}
|
|
1373
1601
|
if (hidden && isPanelMaximized) {
|
|
@@ -1377,18 +1605,15 @@ class Layout extends Disposable {
|
|
|
1377
1605
|
let focusEditor = false;
|
|
1378
1606
|
if (hidden && this.paneCompositeService.getActivePaneComposite(ViewContainerLocation.Panel)) {
|
|
1379
1607
|
this.paneCompositeService.hideActivePaneComposite(ViewContainerLocation.Panel);
|
|
1380
|
-
if (
|
|
1381
|
-
|
|
1382
|
-
) {
|
|
1608
|
+
if (
|
|
1609
|
+
!isIOS && !this.isAuxiliaryBarMaximized()) {
|
|
1383
1610
|
focusEditor = true;
|
|
1384
1611
|
}
|
|
1385
1612
|
}
|
|
1386
1613
|
else if (!hidden && !this.paneCompositeService.getActivePaneComposite(ViewContainerLocation.Panel)) {
|
|
1387
1614
|
let panelToOpen = this.paneCompositeService.getLastActivePaneCompositeId(ViewContainerLocation.Panel);
|
|
1388
1615
|
if (!panelToOpen || !this.hasViews(panelToOpen)) {
|
|
1389
|
-
panelToOpen = this.viewDescriptorService
|
|
1390
|
-
.getViewContainersByLocation(ViewContainerLocation.Panel)
|
|
1391
|
-
.find(viewContainer => this.hasViews(viewContainer.id))?.id;
|
|
1616
|
+
panelToOpen = this.viewDescriptorService.getViewContainersByLocation(ViewContainerLocation.Panel).find(viewContainer => this.hasViews(viewContainer.id))?.id;
|
|
1392
1617
|
}
|
|
1393
1618
|
if (panelToOpen) {
|
|
1394
1619
|
this.openViewContainer(ViewContainerLocation.Panel, panelToOpen, !skipLayout);
|
|
@@ -1401,8 +1626,7 @@ class Layout extends Disposable {
|
|
|
1401
1626
|
if (!skipLayout && isPanelMaximized !== panelOpensMaximized) {
|
|
1402
1627
|
this.toggleMaximizedPanel();
|
|
1403
1628
|
}
|
|
1404
|
-
}
|
|
1405
|
-
else {
|
|
1629
|
+
} else {
|
|
1406
1630
|
this.stateModel.setRuntimeValue(LayoutStateKeys.PANEL_WAS_LAST_MAXIMIZED, isPanelMaximized);
|
|
1407
1631
|
}
|
|
1408
1632
|
if (focusEditor) {
|
|
@@ -1416,9 +1640,8 @@ class Layout extends Disposable {
|
|
|
1416
1640
|
this.setAuxiliaryBarMaximized(!this.isAuxiliaryBarMaximized());
|
|
1417
1641
|
}
|
|
1418
1642
|
setAuxiliaryBarMaximized(maximized) {
|
|
1419
|
-
if (
|
|
1420
|
-
|
|
1421
|
-
) {
|
|
1643
|
+
if (
|
|
1644
|
+
this.inMaximizedAuxiliaryBarTransition || (maximized === this.isAuxiliaryBarMaximized())) {
|
|
1422
1645
|
return false;
|
|
1423
1646
|
}
|
|
1424
1647
|
if (maximized) {
|
|
@@ -1446,13 +1669,13 @@ class Layout extends Disposable {
|
|
|
1446
1669
|
this.setEditorHidden(true);
|
|
1447
1670
|
}
|
|
1448
1671
|
this.stateModel.setRuntimeValue(LayoutStateKeys.AUXILIARYBAR_LAST_NON_MAXIMIZED_VISIBILITY, state);
|
|
1449
|
-
}
|
|
1450
|
-
finally {
|
|
1672
|
+
} finally {
|
|
1451
1673
|
this.inMaximizedAuxiliaryBarTransition = false;
|
|
1452
1674
|
}
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
|
|
1675
|
+
} else {
|
|
1676
|
+
const state = assertReturnsDefined(
|
|
1677
|
+
this.stateModel.getRuntimeValue(LayoutStateKeys.AUXILIARYBAR_LAST_NON_MAXIMIZED_VISIBILITY)
|
|
1678
|
+
);
|
|
1456
1679
|
this.stateModel.setRuntimeValue(LayoutStateKeys.AUXILIARYBAR_WAS_LAST_MAXIMIZED, false);
|
|
1457
1680
|
this.inMaximizedAuxiliaryBarTransition = true;
|
|
1458
1681
|
try {
|
|
@@ -1464,8 +1687,7 @@ class Layout extends Disposable {
|
|
|
1464
1687
|
width: this.stateModel.getRuntimeValue(LayoutStateKeys.AUXILIARYBAR_LAST_NON_MAXIMIZED_SIZE),
|
|
1465
1688
|
height: size.height
|
|
1466
1689
|
});
|
|
1467
|
-
}
|
|
1468
|
-
finally {
|
|
1690
|
+
} finally {
|
|
1469
1691
|
this.inMaximizedAuxiliaryBarTransition = false;
|
|
1470
1692
|
}
|
|
1471
1693
|
}
|
|
@@ -1474,9 +1696,10 @@ class Layout extends Disposable {
|
|
|
1474
1696
|
return true;
|
|
1475
1697
|
}
|
|
1476
1698
|
isPanelMaximized() {
|
|
1477
|
-
return (
|
|
1478
|
-
|
|
1479
|
-
|
|
1699
|
+
return (
|
|
1700
|
+
(
|
|
1701
|
+
this.getPanelAlignment() === "center" || !isHorizontal(this.getPanelPosition())) && !this.isVisible(Parts.EDITOR_PART, mainWindow) && !this.isAuxiliaryBarMaximized()
|
|
1702
|
+
);
|
|
1480
1703
|
}
|
|
1481
1704
|
toggleMaximizedPanel() {
|
|
1482
1705
|
const size = this.workbenchGrid.getViewSize(this.panelPartView);
|
|
@@ -1486,14 +1709,12 @@ class Layout extends Disposable {
|
|
|
1486
1709
|
if (this.isVisible(Parts.PANEL_PART)) {
|
|
1487
1710
|
if (isHorizontal(panelPosition)) {
|
|
1488
1711
|
this.stateModel.setRuntimeValue(LayoutStateKeys.PANEL_LAST_NON_MAXIMIZED_HEIGHT, size.height);
|
|
1489
|
-
}
|
|
1490
|
-
else {
|
|
1712
|
+
} else {
|
|
1491
1713
|
this.stateModel.setRuntimeValue(LayoutStateKeys.PANEL_LAST_NON_MAXIMIZED_WIDTH, size.width);
|
|
1492
1714
|
}
|
|
1493
1715
|
}
|
|
1494
1716
|
this.setEditorHidden(true);
|
|
1495
|
-
}
|
|
1496
|
-
else {
|
|
1717
|
+
} else {
|
|
1497
1718
|
this.setEditorHidden(false);
|
|
1498
1719
|
this.workbenchGrid.resizeView(this.panelPartView, {
|
|
1499
1720
|
width: isHorizontal(panelPosition) ? size.width : this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_LAST_NON_MAXIMIZED_WIDTH),
|
|
@@ -1503,10 +1724,12 @@ class Layout extends Disposable {
|
|
|
1503
1724
|
this.stateModel.setRuntimeValue(LayoutStateKeys.PANEL_WAS_LAST_MAXIMIZED, maximize);
|
|
1504
1725
|
}
|
|
1505
1726
|
panelOpensMaximized() {
|
|
1506
|
-
if (this.getPanelAlignment() !==
|
|
1727
|
+
if (this.getPanelAlignment() !== "center" && isHorizontal(this.getPanelPosition())) {
|
|
1507
1728
|
return false;
|
|
1508
1729
|
}
|
|
1509
|
-
const panelOpensMaximized = partOpensMaximizedFromString(
|
|
1730
|
+
const panelOpensMaximized = partOpensMaximizedFromString(
|
|
1731
|
+
this.configurationService.getValue(WorkbenchLayoutSettings.PANEL_OPENS_MAXIMIZED)
|
|
1732
|
+
);
|
|
1510
1733
|
const panelLastIsMaximized = this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_WAS_LAST_MAXIMIZED);
|
|
1511
1734
|
return panelOpensMaximized === PartOpensMaximizedOptions.ALWAYS || (panelOpensMaximized === PartOpensMaximizedOptions.REMEMBER_LAST && panelLastIsMaximized);
|
|
1512
1735
|
}
|
|
@@ -1517,8 +1740,7 @@ class Layout extends Disposable {
|
|
|
1517
1740
|
this.stateModel.setRuntimeValue(LayoutStateKeys.AUXILIARYBAR_HIDDEN, hidden);
|
|
1518
1741
|
if (hidden) {
|
|
1519
1742
|
this.mainContainer.classList.add(LayoutClasses.AUXILIARYBAR_HIDDEN);
|
|
1520
|
-
}
|
|
1521
|
-
else {
|
|
1743
|
+
} else {
|
|
1522
1744
|
this.mainContainer.classList.remove(LayoutClasses.AUXILIARYBAR_HIDDEN);
|
|
1523
1745
|
}
|
|
1524
1746
|
this.workbenchGrid.setViewVisible(this.auxiliaryBarPartView, !hidden);
|
|
@@ -1529,9 +1751,7 @@ class Layout extends Disposable {
|
|
|
1529
1751
|
else if (!hidden && !this.paneCompositeService.getActivePaneComposite(ViewContainerLocation.AuxiliaryBar)) {
|
|
1530
1752
|
let viewletToOpen = this.paneCompositeService.getLastActivePaneCompositeId(ViewContainerLocation.AuxiliaryBar);
|
|
1531
1753
|
if (!viewletToOpen || !this.hasViews(viewletToOpen)) {
|
|
1532
|
-
viewletToOpen = this.viewDescriptorService
|
|
1533
|
-
.getViewContainersByLocation(ViewContainerLocation.AuxiliaryBar)
|
|
1534
|
-
.find(viewContainer => this.hasViews(viewContainer.id))?.id;
|
|
1754
|
+
viewletToOpen = this.viewDescriptorService.getViewContainersByLocation(ViewContainerLocation.AuxiliaryBar).find(viewContainer => this.hasViews(viewContainer.id))?.id;
|
|
1535
1755
|
}
|
|
1536
1756
|
if (viewletToOpen) {
|
|
1537
1757
|
this.openViewContainer(ViewContainerLocation.AuxiliaryBar, viewletToOpen, !skipLayout);
|
|
@@ -1540,25 +1760,25 @@ class Layout extends Disposable {
|
|
|
1540
1760
|
}
|
|
1541
1761
|
setPartHidden(hidden, part) {
|
|
1542
1762
|
switch (part) {
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1763
|
+
case Parts.ACTIVITYBAR_PART:
|
|
1764
|
+
return this.setActivityBarHidden(hidden);
|
|
1765
|
+
case Parts.SIDEBAR_PART:
|
|
1766
|
+
return this.setSideBarHidden(hidden);
|
|
1767
|
+
case Parts.EDITOR_PART:
|
|
1768
|
+
return this.setEditorHidden(hidden);
|
|
1769
|
+
case Parts.BANNER_PART:
|
|
1770
|
+
return this.setBannerHidden(hidden);
|
|
1771
|
+
case Parts.AUXILIARYBAR_PART:
|
|
1772
|
+
return this.setAuxiliaryBarHidden(hidden);
|
|
1773
|
+
case Parts.PANEL_PART:
|
|
1774
|
+
return this.setPanelHidden(hidden);
|
|
1555
1775
|
}
|
|
1556
1776
|
}
|
|
1557
1777
|
hasMainWindowBorder() {
|
|
1558
1778
|
return this.state.runtime.mainWindowBorder;
|
|
1559
1779
|
}
|
|
1560
1780
|
getMainWindowBorderRadius() {
|
|
1561
|
-
return this.state.runtime.mainWindowBorder && isMacintosh ?
|
|
1781
|
+
return this.state.runtime.mainWindowBorder && isMacintosh ? "10px" : undefined;
|
|
1562
1782
|
}
|
|
1563
1783
|
getSideBarPosition() {
|
|
1564
1784
|
return this.stateModel.getRuntimeValue(LayoutStateKeys.SIDEBAR_POSITON);
|
|
@@ -1581,15 +1801,14 @@ class Layout extends Disposable {
|
|
|
1581
1801
|
}
|
|
1582
1802
|
toggleMenuBar() {
|
|
1583
1803
|
let currentVisibilityValue = getMenuBarVisibility(this.configurationService);
|
|
1584
|
-
if (typeof currentVisibilityValue !==
|
|
1585
|
-
currentVisibilityValue =
|
|
1804
|
+
if (typeof currentVisibilityValue !== "string") {
|
|
1805
|
+
currentVisibilityValue = "classic";
|
|
1586
1806
|
}
|
|
1587
1807
|
let newVisibilityValue;
|
|
1588
|
-
if (currentVisibilityValue ===
|
|
1589
|
-
newVisibilityValue = hasNativeMenu(this.configurationService) ?
|
|
1590
|
-
}
|
|
1591
|
-
|
|
1592
|
-
newVisibilityValue = 'classic';
|
|
1808
|
+
if (currentVisibilityValue === "visible" || currentVisibilityValue === "classic") {
|
|
1809
|
+
newVisibilityValue = hasNativeMenu(this.configurationService) ? "toggle" : "compact";
|
|
1810
|
+
} else {
|
|
1811
|
+
newVisibilityValue = "classic";
|
|
1593
1812
|
}
|
|
1594
1813
|
this.configurationService.updateValue(MenuSettings.MenuBarVisibility, newVisibilityValue);
|
|
1595
1814
|
}
|
|
@@ -1614,12 +1833,11 @@ class Layout extends Disposable {
|
|
|
1614
1833
|
if (newPositionValue !== oldPositionValue && !editorHidden) {
|
|
1615
1834
|
if (isHorizontal(position)) {
|
|
1616
1835
|
this.stateModel.setRuntimeValue(LayoutStateKeys.PANEL_LAST_NON_MAXIMIZED_WIDTH, size.width);
|
|
1617
|
-
}
|
|
1618
|
-
else if (isHorizontal(positionFromString(oldPositionValue))) {
|
|
1836
|
+
} else if (isHorizontal(positionFromString(oldPositionValue))) {
|
|
1619
1837
|
this.stateModel.setRuntimeValue(LayoutStateKeys.PANEL_LAST_NON_MAXIMIZED_HEIGHT, size.height);
|
|
1620
1838
|
}
|
|
1621
1839
|
}
|
|
1622
|
-
if (isHorizontal(position) && this.getPanelAlignment() !==
|
|
1840
|
+
if (isHorizontal(position) && this.getPanelAlignment() !== "center" && editorHidden) {
|
|
1623
1841
|
this.toggleMaximizedPanel();
|
|
1624
1842
|
editorHidden = false;
|
|
1625
1843
|
}
|
|
@@ -1628,16 +1846,33 @@ class Layout extends Disposable {
|
|
|
1628
1846
|
const auxiliaryBarVisible = this.isVisible(Parts.AUXILIARYBAR_PART);
|
|
1629
1847
|
const hadFocus = this.hasFocus(Parts.PANEL_PART);
|
|
1630
1848
|
if (position === Position.BOTTOM) {
|
|
1631
|
-
this.workbenchGrid.moveView(
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1849
|
+
this.workbenchGrid.moveView(
|
|
1850
|
+
this.panelPartView,
|
|
1851
|
+
editorHidden ? size.height : this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_LAST_NON_MAXIMIZED_HEIGHT),
|
|
1852
|
+
this.editorPartView,
|
|
1853
|
+
Direction.Down
|
|
1854
|
+
);
|
|
1855
|
+
} else if (position === Position.TOP) {
|
|
1856
|
+
this.workbenchGrid.moveView(
|
|
1857
|
+
this.panelPartView,
|
|
1858
|
+
editorHidden ? size.height : this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_LAST_NON_MAXIMIZED_HEIGHT),
|
|
1859
|
+
this.editorPartView,
|
|
1860
|
+
Direction.Up
|
|
1861
|
+
);
|
|
1862
|
+
} else if (position === Position.RIGHT) {
|
|
1863
|
+
this.workbenchGrid.moveView(
|
|
1864
|
+
this.panelPartView,
|
|
1865
|
+
editorHidden ? size.width : this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_LAST_NON_MAXIMIZED_WIDTH),
|
|
1866
|
+
this.editorPartView,
|
|
1867
|
+
Direction.Right
|
|
1868
|
+
);
|
|
1869
|
+
} else {
|
|
1870
|
+
this.workbenchGrid.moveView(
|
|
1871
|
+
this.panelPartView,
|
|
1872
|
+
editorHidden ? size.width : this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_LAST_NON_MAXIMIZED_WIDTH),
|
|
1873
|
+
this.editorPartView,
|
|
1874
|
+
Direction.Left
|
|
1875
|
+
);
|
|
1641
1876
|
}
|
|
1642
1877
|
if (hadFocus) {
|
|
1643
1878
|
this.focusPart(Parts.PANEL_PART);
|
|
@@ -1666,12 +1901,14 @@ class Layout extends Disposable {
|
|
|
1666
1901
|
}
|
|
1667
1902
|
if (maximized) {
|
|
1668
1903
|
this.state.runtime.maximized.add(targetWindowId);
|
|
1669
|
-
}
|
|
1670
|
-
else {
|
|
1904
|
+
} else {
|
|
1671
1905
|
this.state.runtime.maximized.delete(targetWindowId);
|
|
1672
1906
|
}
|
|
1673
1907
|
this.updateWindowBorder();
|
|
1674
|
-
this._onDidChangeWindowMaximized.fire({
|
|
1908
|
+
this._onDidChangeWindowMaximized.fire({
|
|
1909
|
+
windowId: targetWindowId,
|
|
1910
|
+
maximized
|
|
1911
|
+
});
|
|
1675
1912
|
}
|
|
1676
1913
|
getVisibleNeighborPart(part, direction) {
|
|
1677
1914
|
if (!this.workbenchGrid) {
|
|
@@ -1685,8 +1922,17 @@ class Layout extends Disposable {
|
|
|
1685
1922
|
return undefined;
|
|
1686
1923
|
}
|
|
1687
1924
|
for (const neighborView of neighborViews) {
|
|
1688
|
-
const neighborPart = [
|
|
1689
|
-
.
|
|
1925
|
+
const neighborPart = [
|
|
1926
|
+
Parts.ACTIVITYBAR_PART,
|
|
1927
|
+
Parts.EDITOR_PART,
|
|
1928
|
+
Parts.PANEL_PART,
|
|
1929
|
+
Parts.AUXILIARYBAR_PART,
|
|
1930
|
+
Parts.SIDEBAR_PART,
|
|
1931
|
+
Parts.STATUSBAR_PART,
|
|
1932
|
+
Parts.TITLEBAR_PART
|
|
1933
|
+
].find(
|
|
1934
|
+
partId => this.getPart(partId) === neighborView && this.isVisible(partId, mainWindow)
|
|
1935
|
+
);
|
|
1690
1936
|
if (neighborPart !== undefined) {
|
|
1691
1937
|
return neighborPart;
|
|
1692
1938
|
}
|
|
@@ -1697,9 +1943,17 @@ class Layout extends Disposable {
|
|
|
1697
1943
|
const bannerFirst = this.workbenchGrid.getNeighborViews(this.titleBarPartView, Direction.Up, false).length > 0;
|
|
1698
1944
|
const shouldBannerBeFirst = this.shouldShowBannerFirst();
|
|
1699
1945
|
if (bannerFirst !== shouldBannerBeFirst) {
|
|
1700
|
-
this.workbenchGrid.moveView(
|
|
1946
|
+
this.workbenchGrid.moveView(
|
|
1947
|
+
this.bannerPartView,
|
|
1948
|
+
Sizing.Distribute,
|
|
1949
|
+
this.titleBarPartView,
|
|
1950
|
+
shouldBannerBeFirst ? Direction.Up : Direction.Down
|
|
1951
|
+
);
|
|
1701
1952
|
}
|
|
1702
|
-
this.workbenchGrid.setViewVisible(
|
|
1953
|
+
this.workbenchGrid.setViewVisible(
|
|
1954
|
+
this.titleBarPartView,
|
|
1955
|
+
shouldShowCustomTitleBar(this.configurationService, mainWindow, this.state.runtime.menuBar.toggled)
|
|
1956
|
+
);
|
|
1703
1957
|
}
|
|
1704
1958
|
arrangeEditorNodes(nodes, availableHeight, availableWidth) {
|
|
1705
1959
|
if (!nodes.sideBar && !nodes.auxiliaryBar) {
|
|
@@ -1711,8 +1965,7 @@ class Layout extends Disposable {
|
|
|
1711
1965
|
if (nodes.sideBar) {
|
|
1712
1966
|
if (this.stateModel.getRuntimeValue(LayoutStateKeys.SIDEBAR_POSITON) === Position.LEFT) {
|
|
1713
1967
|
result.splice(0, 0, nodes.sideBar);
|
|
1714
|
-
}
|
|
1715
|
-
else {
|
|
1968
|
+
} else {
|
|
1716
1969
|
result.push(nodes.sideBar);
|
|
1717
1970
|
}
|
|
1718
1971
|
nodes.editor.size -= this.stateModel.getRuntimeValue(LayoutStateKeys.SIDEBAR_HIDDEN) ? 0 : nodes.sideBar.size;
|
|
@@ -1720,14 +1973,13 @@ class Layout extends Disposable {
|
|
|
1720
1973
|
if (nodes.auxiliaryBar) {
|
|
1721
1974
|
if (this.stateModel.getRuntimeValue(LayoutStateKeys.SIDEBAR_POSITON) === Position.RIGHT) {
|
|
1722
1975
|
result.splice(0, 0, nodes.auxiliaryBar);
|
|
1723
|
-
}
|
|
1724
|
-
else {
|
|
1976
|
+
} else {
|
|
1725
1977
|
result.push(nodes.auxiliaryBar);
|
|
1726
1978
|
}
|
|
1727
1979
|
nodes.editor.size -= this.stateModel.getRuntimeValue(LayoutStateKeys.AUXILIARYBAR_HIDDEN) ? 0 : nodes.auxiliaryBar.size;
|
|
1728
1980
|
}
|
|
1729
1981
|
return {
|
|
1730
|
-
type:
|
|
1982
|
+
type: "branch",
|
|
1731
1983
|
data: result,
|
|
1732
1984
|
size: availableHeight,
|
|
1733
1985
|
visible: ( result.some(node => node.visible))
|
|
@@ -1746,25 +1998,22 @@ class Layout extends Disposable {
|
|
|
1746
1998
|
nodes.editor.size = availableWidth - activityBarSize - sideBarSize - panelSize - auxiliaryBarSize;
|
|
1747
1999
|
if (panelPostion === Position.RIGHT) {
|
|
1748
2000
|
result.push(nodes.panel);
|
|
1749
|
-
}
|
|
1750
|
-
else {
|
|
2001
|
+
} else {
|
|
1751
2002
|
result.splice(0, 0, nodes.panel);
|
|
1752
2003
|
}
|
|
1753
2004
|
if (sideBarPosition === Position.LEFT) {
|
|
1754
2005
|
result.push(nodes.auxiliaryBar);
|
|
1755
2006
|
result.splice(0, 0, nodes.sideBar);
|
|
1756
2007
|
result.splice(0, 0, nodes.activityBar);
|
|
1757
|
-
}
|
|
1758
|
-
else {
|
|
2008
|
+
} else {
|
|
1759
2009
|
result.splice(0, 0, nodes.auxiliaryBar);
|
|
1760
2010
|
result.push(nodes.sideBar);
|
|
1761
2011
|
result.push(nodes.activityBar);
|
|
1762
2012
|
}
|
|
1763
|
-
}
|
|
1764
|
-
else {
|
|
2013
|
+
} else {
|
|
1765
2014
|
const panelAlignment = this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_ALIGNMENT);
|
|
1766
|
-
const sideBarNextToEditor = !(panelAlignment ===
|
|
1767
|
-
const auxiliaryBarNextToEditor = !(panelAlignment ===
|
|
2015
|
+
const sideBarNextToEditor = !(panelAlignment === "center" || (sideBarPosition === Position.LEFT && panelAlignment === "right") || (sideBarPosition === Position.RIGHT && panelAlignment === "left"));
|
|
2016
|
+
const auxiliaryBarNextToEditor = !(panelAlignment === "center" || (sideBarPosition === Position.RIGHT && panelAlignment === "right") || (sideBarPosition === Position.LEFT && panelAlignment === "left"));
|
|
1768
2017
|
const editorSectionWidth = availableWidth - activityBarSize - (sideBarNextToEditor ? 0 : sideBarSize) - (auxiliaryBarNextToEditor ? 0 : auxiliaryBarSize);
|
|
1769
2018
|
const editorNodes = this.arrangeEditorNodes({
|
|
1770
2019
|
editor: nodes.editor,
|
|
@@ -1773,7 +2022,7 @@ class Layout extends Disposable {
|
|
|
1773
2022
|
}, availableHeight - panelSize, editorSectionWidth);
|
|
1774
2023
|
const data = panelPostion === Position.BOTTOM ? [editorNodes, nodes.panel] : [nodes.panel, editorNodes];
|
|
1775
2024
|
result.push({
|
|
1776
|
-
type:
|
|
2025
|
+
type: "branch",
|
|
1777
2026
|
data,
|
|
1778
2027
|
size: editorSectionWidth,
|
|
1779
2028
|
visible: ( data.some(node => node.visible))
|
|
@@ -1781,30 +2030,30 @@ class Layout extends Disposable {
|
|
|
1781
2030
|
if (!sideBarNextToEditor) {
|
|
1782
2031
|
if (sideBarPosition === Position.LEFT) {
|
|
1783
2032
|
result.splice(0, 0, nodes.sideBar);
|
|
1784
|
-
}
|
|
1785
|
-
else {
|
|
2033
|
+
} else {
|
|
1786
2034
|
result.push(nodes.sideBar);
|
|
1787
2035
|
}
|
|
1788
2036
|
}
|
|
1789
2037
|
if (!auxiliaryBarNextToEditor) {
|
|
1790
2038
|
if (sideBarPosition === Position.RIGHT) {
|
|
1791
2039
|
result.splice(0, 0, nodes.auxiliaryBar);
|
|
1792
|
-
}
|
|
1793
|
-
else {
|
|
2040
|
+
} else {
|
|
1794
2041
|
result.push(nodes.auxiliaryBar);
|
|
1795
2042
|
}
|
|
1796
2043
|
}
|
|
1797
2044
|
if (sideBarPosition === Position.LEFT) {
|
|
1798
2045
|
result.splice(0, 0, nodes.activityBar);
|
|
1799
|
-
}
|
|
1800
|
-
else {
|
|
2046
|
+
} else {
|
|
1801
2047
|
result.push(nodes.activityBar);
|
|
1802
2048
|
}
|
|
1803
2049
|
}
|
|
1804
2050
|
return result;
|
|
1805
2051
|
}
|
|
1806
2052
|
createGridDescriptor() {
|
|
1807
|
-
const {
|
|
2053
|
+
const {
|
|
2054
|
+
width,
|
|
2055
|
+
height
|
|
2056
|
+
} = this._mainContainerDimension;
|
|
1808
2057
|
const sideBarSize = this.stateModel.getInitializationValue(LayoutStateKeys.SIDEBAR_SIZE);
|
|
1809
2058
|
const auxiliaryBarSize = this.stateModel.getInitializationValue(LayoutStateKeys.AUXILIARYBAR_SIZE);
|
|
1810
2059
|
const panelSize = this.stateModel.getInitializationValue(LayoutStateKeys.PANEL_SIZE);
|
|
@@ -1813,47 +2062,58 @@ class Layout extends Disposable {
|
|
|
1813
2062
|
const statusBarHeight = this.statusBarPartView.minimumHeight;
|
|
1814
2063
|
const activityBarWidth = this.activityBarPartView.minimumWidth;
|
|
1815
2064
|
const middleSectionHeight = height - titleBarHeight - statusBarHeight;
|
|
1816
|
-
const titleAndBanner = [
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
size: titleBarHeight,
|
|
1821
|
-
visible: this.isVisible(Parts.TITLEBAR_PART, mainWindow)
|
|
2065
|
+
const titleAndBanner = [{
|
|
2066
|
+
type: "leaf",
|
|
2067
|
+
data: {
|
|
2068
|
+
type: Parts.TITLEBAR_PART
|
|
1822
2069
|
},
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
2070
|
+
size: titleBarHeight,
|
|
2071
|
+
visible: this.isVisible(Parts.TITLEBAR_PART, mainWindow)
|
|
2072
|
+
}, {
|
|
2073
|
+
type: "leaf",
|
|
2074
|
+
data: {
|
|
2075
|
+
type: Parts.BANNER_PART
|
|
2076
|
+
},
|
|
2077
|
+
size: bannerHeight,
|
|
2078
|
+
visible: false
|
|
2079
|
+
}];
|
|
1830
2080
|
const activityBarNode = {
|
|
1831
|
-
type:
|
|
1832
|
-
data: {
|
|
2081
|
+
type: "leaf",
|
|
2082
|
+
data: {
|
|
2083
|
+
type: Parts.ACTIVITYBAR_PART
|
|
2084
|
+
},
|
|
1833
2085
|
size: activityBarWidth,
|
|
1834
2086
|
visible: !this.stateModel.getRuntimeValue(LayoutStateKeys.ACTIVITYBAR_HIDDEN)
|
|
1835
2087
|
};
|
|
1836
2088
|
const sideBarNode = {
|
|
1837
|
-
type:
|
|
1838
|
-
data: {
|
|
2089
|
+
type: "leaf",
|
|
2090
|
+
data: {
|
|
2091
|
+
type: Parts.SIDEBAR_PART
|
|
2092
|
+
},
|
|
1839
2093
|
size: sideBarSize,
|
|
1840
2094
|
visible: !this.stateModel.getRuntimeValue(LayoutStateKeys.SIDEBAR_HIDDEN)
|
|
1841
2095
|
};
|
|
1842
2096
|
const auxiliaryBarNode = {
|
|
1843
|
-
type:
|
|
1844
|
-
data: {
|
|
2097
|
+
type: "leaf",
|
|
2098
|
+
data: {
|
|
2099
|
+
type: Parts.AUXILIARYBAR_PART
|
|
2100
|
+
},
|
|
1845
2101
|
size: auxiliaryBarSize,
|
|
1846
2102
|
visible: this.isVisible(Parts.AUXILIARYBAR_PART)
|
|
1847
2103
|
};
|
|
1848
2104
|
const editorNode = {
|
|
1849
|
-
type:
|
|
1850
|
-
data: {
|
|
2105
|
+
type: "leaf",
|
|
2106
|
+
data: {
|
|
2107
|
+
type: Parts.EDITOR_PART
|
|
2108
|
+
},
|
|
1851
2109
|
size: 0,
|
|
1852
2110
|
visible: !this.stateModel.getRuntimeValue(LayoutStateKeys.EDITOR_HIDDEN)
|
|
1853
2111
|
};
|
|
1854
2112
|
const panelNode = {
|
|
1855
|
-
type:
|
|
1856
|
-
data: {
|
|
2113
|
+
type: "leaf",
|
|
2114
|
+
data: {
|
|
2115
|
+
type: Parts.PANEL_PART
|
|
2116
|
+
},
|
|
1857
2117
|
size: panelSize,
|
|
1858
2118
|
visible: !this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_HIDDEN)
|
|
1859
2119
|
};
|
|
@@ -1866,18 +2126,20 @@ class Layout extends Disposable {
|
|
|
1866
2126
|
}, width, middleSectionHeight);
|
|
1867
2127
|
const result = {
|
|
1868
2128
|
root: {
|
|
1869
|
-
type:
|
|
2129
|
+
type: "branch",
|
|
1870
2130
|
size: width,
|
|
1871
2131
|
data: [
|
|
1872
2132
|
...(this.shouldShowBannerFirst() ? titleAndBanner.reverse() : titleAndBanner),
|
|
1873
2133
|
{
|
|
1874
|
-
type:
|
|
2134
|
+
type: "branch",
|
|
1875
2135
|
data: middleSection,
|
|
1876
2136
|
size: middleSectionHeight
|
|
1877
2137
|
},
|
|
1878
2138
|
{
|
|
1879
|
-
type:
|
|
1880
|
-
data: {
|
|
2139
|
+
type: "leaf",
|
|
2140
|
+
data: {
|
|
2141
|
+
type: Parts.STATUSBAR_PART
|
|
2142
|
+
},
|
|
1881
2143
|
size: statusBarHeight,
|
|
1882
2144
|
visible: !this.stateModel.getRuntimeValue(LayoutStateKeys.STATUSBAR_HIDDEN)
|
|
1883
2145
|
}
|
|
@@ -1894,9 +2156,9 @@ class Layout extends Disposable {
|
|
|
1894
2156
|
panelVisible: !this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_HIDDEN),
|
|
1895
2157
|
statusbarVisible: !this.stateModel.getRuntimeValue(LayoutStateKeys.STATUSBAR_HIDDEN),
|
|
1896
2158
|
sideBarPosition: positionToString(this.stateModel.getRuntimeValue(LayoutStateKeys.SIDEBAR_POSITON)),
|
|
1897
|
-
panelPosition: positionToString(this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_POSITION))
|
|
2159
|
+
panelPosition: positionToString(this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_POSITION))
|
|
1898
2160
|
};
|
|
1899
|
-
this.telemetryService.publicLog2(
|
|
2161
|
+
this.telemetryService.publicLog2("startupLayout", layoutDescriptor);
|
|
1900
2162
|
return result;
|
|
1901
2163
|
}
|
|
1902
2164
|
dispose() {
|
|
@@ -1929,53 +2191,53 @@ class InitializationStateKey extends WorkbenchLayoutStateKey {
|
|
|
1929
2191
|
}
|
|
1930
2192
|
}
|
|
1931
2193
|
const LayoutStateKeys = {
|
|
1932
|
-
MAIN_EDITOR_CENTERED: ( new RuntimeStateKey(
|
|
1933
|
-
ZEN_MODE_ACTIVE: ( new RuntimeStateKey(
|
|
1934
|
-
ZEN_MODE_EXIT_INFO: ( new RuntimeStateKey(
|
|
2194
|
+
MAIN_EDITOR_CENTERED: ( new RuntimeStateKey("editor.centered", StorageScope.WORKSPACE, StorageTarget.MACHINE, false)),
|
|
2195
|
+
ZEN_MODE_ACTIVE: ( new RuntimeStateKey("zenMode.active", StorageScope.WORKSPACE, StorageTarget.MACHINE, false)),
|
|
2196
|
+
ZEN_MODE_EXIT_INFO: ( new RuntimeStateKey("zenMode.exitInfo", StorageScope.WORKSPACE, StorageTarget.MACHINE, {
|
|
1935
2197
|
transitionedToCenteredEditorLayout: false,
|
|
1936
2198
|
transitionedToFullScreen: false,
|
|
1937
2199
|
handleNotificationsDoNotDisturbMode: false,
|
|
1938
2200
|
wasVisible: {
|
|
1939
2201
|
auxiliaryBar: false,
|
|
1940
2202
|
panel: false,
|
|
1941
|
-
sideBar: false
|
|
1942
|
-
}
|
|
2203
|
+
sideBar: false
|
|
2204
|
+
}
|
|
1943
2205
|
})),
|
|
1944
|
-
SIDEBAR_SIZE: ( new InitializationStateKey(
|
|
1945
|
-
AUXILIARYBAR_SIZE: ( new InitializationStateKey(
|
|
1946
|
-
PANEL_SIZE: ( new InitializationStateKey(
|
|
2206
|
+
SIDEBAR_SIZE: ( new InitializationStateKey("sideBar.size", StorageScope.PROFILE, StorageTarget.MACHINE, 300)),
|
|
2207
|
+
AUXILIARYBAR_SIZE: ( new InitializationStateKey("auxiliaryBar.size", StorageScope.PROFILE, StorageTarget.MACHINE, 300)),
|
|
2208
|
+
PANEL_SIZE: ( new InitializationStateKey("panel.size", StorageScope.PROFILE, StorageTarget.MACHINE, 300)),
|
|
1947
2209
|
PANEL_LAST_NON_MAXIMIZED_HEIGHT: ( new RuntimeStateKey(
|
|
1948
|
-
|
|
2210
|
+
"panel.lastNonMaximizedHeight",
|
|
1949
2211
|
StorageScope.PROFILE,
|
|
1950
2212
|
StorageTarget.MACHINE,
|
|
1951
2213
|
300
|
|
1952
2214
|
)),
|
|
1953
2215
|
PANEL_LAST_NON_MAXIMIZED_WIDTH: ( new RuntimeStateKey(
|
|
1954
|
-
|
|
2216
|
+
"panel.lastNonMaximizedWidth",
|
|
1955
2217
|
StorageScope.PROFILE,
|
|
1956
2218
|
StorageTarget.MACHINE,
|
|
1957
2219
|
300
|
|
1958
2220
|
)),
|
|
1959
2221
|
PANEL_WAS_LAST_MAXIMIZED: ( new RuntimeStateKey(
|
|
1960
|
-
|
|
2222
|
+
"panel.wasLastMaximized",
|
|
1961
2223
|
StorageScope.WORKSPACE,
|
|
1962
2224
|
StorageTarget.MACHINE,
|
|
1963
2225
|
false
|
|
1964
2226
|
)),
|
|
1965
2227
|
AUXILIARYBAR_WAS_LAST_MAXIMIZED: ( new RuntimeStateKey(
|
|
1966
|
-
|
|
2228
|
+
"auxiliaryBar.wasLastMaximized",
|
|
1967
2229
|
StorageScope.WORKSPACE,
|
|
1968
2230
|
StorageTarget.MACHINE,
|
|
1969
2231
|
false
|
|
1970
2232
|
)),
|
|
1971
2233
|
AUXILIARYBAR_LAST_NON_MAXIMIZED_SIZE: ( new RuntimeStateKey(
|
|
1972
|
-
|
|
2234
|
+
"auxiliaryBar.lastNonMaximizedSize",
|
|
1973
2235
|
StorageScope.PROFILE,
|
|
1974
2236
|
StorageTarget.MACHINE,
|
|
1975
2237
|
300
|
|
1976
2238
|
)),
|
|
1977
2239
|
AUXILIARYBAR_LAST_NON_MAXIMIZED_VISIBILITY: ( new RuntimeStateKey(
|
|
1978
|
-
|
|
2240
|
+
"auxiliaryBar.lastNonMaximizedVisibility",
|
|
1979
2241
|
StorageScope.WORKSPACE,
|
|
1980
2242
|
StorageTarget.MACHINE,
|
|
1981
2243
|
{
|
|
@@ -1985,33 +2247,33 @@ const LayoutStateKeys = {
|
|
|
1985
2247
|
auxiliaryBarVisible: false
|
|
1986
2248
|
}
|
|
1987
2249
|
)),
|
|
1988
|
-
AUXILIARYBAR_EMPTY: ( new InitializationStateKey(
|
|
2250
|
+
AUXILIARYBAR_EMPTY: ( new InitializationStateKey("auxiliaryBar.empty", StorageScope.PROFILE, StorageTarget.MACHINE, false)),
|
|
1989
2251
|
SIDEBAR_POSITON: ( new RuntimeStateKey(
|
|
1990
|
-
|
|
2252
|
+
"sideBar.position",
|
|
1991
2253
|
StorageScope.WORKSPACE,
|
|
1992
2254
|
StorageTarget.MACHINE,
|
|
1993
2255
|
Position.LEFT
|
|
1994
2256
|
)),
|
|
1995
2257
|
PANEL_POSITION: ( new RuntimeStateKey(
|
|
1996
|
-
|
|
2258
|
+
"panel.position",
|
|
1997
2259
|
StorageScope.WORKSPACE,
|
|
1998
2260
|
StorageTarget.MACHINE,
|
|
1999
2261
|
Position.BOTTOM
|
|
2000
2262
|
)),
|
|
2001
|
-
PANEL_ALIGNMENT: ( new RuntimeStateKey(
|
|
2263
|
+
PANEL_ALIGNMENT: ( new RuntimeStateKey("panel.alignment", StorageScope.PROFILE, StorageTarget.USER, "center")),
|
|
2002
2264
|
ACTIVITYBAR_HIDDEN: ( new RuntimeStateKey(
|
|
2003
|
-
|
|
2265
|
+
"activityBar.hidden",
|
|
2004
2266
|
StorageScope.WORKSPACE,
|
|
2005
2267
|
StorageTarget.MACHINE,
|
|
2006
2268
|
false,
|
|
2007
2269
|
true
|
|
2008
2270
|
)),
|
|
2009
|
-
SIDEBAR_HIDDEN: ( new RuntimeStateKey(
|
|
2010
|
-
EDITOR_HIDDEN: ( new RuntimeStateKey(
|
|
2011
|
-
PANEL_HIDDEN: ( new RuntimeStateKey(
|
|
2012
|
-
AUXILIARYBAR_HIDDEN: ( new RuntimeStateKey(
|
|
2271
|
+
SIDEBAR_HIDDEN: ( new RuntimeStateKey("sideBar.hidden", StorageScope.WORKSPACE, StorageTarget.MACHINE, false)),
|
|
2272
|
+
EDITOR_HIDDEN: ( new RuntimeStateKey("editor.hidden", StorageScope.WORKSPACE, StorageTarget.MACHINE, false)),
|
|
2273
|
+
PANEL_HIDDEN: ( new RuntimeStateKey("panel.hidden", StorageScope.WORKSPACE, StorageTarget.MACHINE, true)),
|
|
2274
|
+
AUXILIARYBAR_HIDDEN: ( new RuntimeStateKey("auxiliaryBar.hidden", StorageScope.WORKSPACE, StorageTarget.MACHINE, true)),
|
|
2013
2275
|
STATUSBAR_HIDDEN: ( new RuntimeStateKey(
|
|
2014
|
-
|
|
2276
|
+
"statusBar.hidden",
|
|
2015
2277
|
StorageScope.WORKSPACE,
|
|
2016
2278
|
StorageTarget.MACHINE,
|
|
2017
2279
|
false,
|
|
@@ -2019,21 +2281,25 @@ const LayoutStateKeys = {
|
|
|
2019
2281
|
))
|
|
2020
2282
|
};
|
|
2021
2283
|
var WorkbenchLayoutSettings;
|
|
2022
|
-
(function
|
|
2284
|
+
(function(WorkbenchLayoutSettings) {
|
|
2023
2285
|
WorkbenchLayoutSettings["AUXILIARYBAR_DEFAULT_VISIBILITY"] = "workbench.secondarySideBar.defaultVisibility";
|
|
2286
|
+
WorkbenchLayoutSettings["AUXILIARYBAR_FORCE_MAXIMIZED"] = "workbench.secondarySideBar.forceMaximized";
|
|
2024
2287
|
WorkbenchLayoutSettings["ACTIVITY_BAR_VISIBLE"] = "workbench.activityBar.visible";
|
|
2025
2288
|
WorkbenchLayoutSettings["PANEL_POSITION"] = "workbench.panel.defaultLocation";
|
|
2026
2289
|
WorkbenchLayoutSettings["PANEL_OPENS_MAXIMIZED"] = "workbench.panel.opensMaximized";
|
|
2027
2290
|
WorkbenchLayoutSettings["ZEN_MODE_CONFIG"] = "zenMode";
|
|
2028
2291
|
WorkbenchLayoutSettings["EDITOR_CENTERED_LAYOUT_AUTO_RESIZE"] = "workbench.editor.centeredLayoutAutoResize";
|
|
2292
|
+
WorkbenchLayoutSettings["EDITOR_RESTORE_EDITORS"] = "workbench.editor.restoreEditors";
|
|
2029
2293
|
})(WorkbenchLayoutSettings || (WorkbenchLayoutSettings = {}));
|
|
2030
2294
|
var LegacyWorkbenchLayoutSettings;
|
|
2031
|
-
(function
|
|
2295
|
+
(function(LegacyWorkbenchLayoutSettings) {
|
|
2032
2296
|
LegacyWorkbenchLayoutSettings["STATUSBAR_VISIBLE"] = "workbench.statusBar.visible";
|
|
2033
2297
|
LegacyWorkbenchLayoutSettings["SIDEBAR_POSITION"] = "workbench.sideBar.location";
|
|
2034
2298
|
})(LegacyWorkbenchLayoutSettings || (LegacyWorkbenchLayoutSettings = {}));
|
|
2035
2299
|
class LayoutStateModel extends Disposable {
|
|
2036
|
-
static {
|
|
2300
|
+
static {
|
|
2301
|
+
this.STORAGE_PREFIX = "workbench.";
|
|
2302
|
+
}
|
|
2037
2303
|
constructor(storageService, configurationService, contextService, environmentService) {
|
|
2038
2304
|
super();
|
|
2039
2305
|
this.storageService = storageService;
|
|
@@ -2048,17 +2314,24 @@ class LayoutStateModel extends Disposable {
|
|
|
2048
2314
|
[StorageScope.PROFILE]: this.storageService.isNew(StorageScope.PROFILE),
|
|
2049
2315
|
[StorageScope.APPLICATION]: this.storageService.isNew(StorageScope.APPLICATION)
|
|
2050
2316
|
};
|
|
2051
|
-
this._register(this.configurationService.onDidChangeConfiguration(
|
|
2317
|
+
this._register(this.configurationService.onDidChangeConfiguration(
|
|
2318
|
+
configurationChange => this.updateStateFromLegacySettings(configurationChange)
|
|
2319
|
+
));
|
|
2052
2320
|
}
|
|
2053
2321
|
updateStateFromLegacySettings(configurationChangeEvent) {
|
|
2054
2322
|
if (configurationChangeEvent.affectsConfiguration(LayoutSettings.ACTIVITY_BAR_LOCATION)) {
|
|
2055
2323
|
this.setRuntimeValueAndFire(LayoutStateKeys.ACTIVITYBAR_HIDDEN, this.isActivityBarHidden());
|
|
2056
2324
|
}
|
|
2057
2325
|
if (configurationChangeEvent.affectsConfiguration(LegacyWorkbenchLayoutSettings.STATUSBAR_VISIBLE)) {
|
|
2058
|
-
this.setRuntimeValueAndFire(
|
|
2326
|
+
this.setRuntimeValueAndFire(
|
|
2327
|
+
LayoutStateKeys.STATUSBAR_HIDDEN,
|
|
2328
|
+
!this.configurationService.getValue(LegacyWorkbenchLayoutSettings.STATUSBAR_VISIBLE)
|
|
2329
|
+
);
|
|
2059
2330
|
}
|
|
2060
2331
|
if (configurationChangeEvent.affectsConfiguration(LegacyWorkbenchLayoutSettings.SIDEBAR_POSITION)) {
|
|
2061
|
-
this.setRuntimeValueAndFire(LayoutStateKeys.SIDEBAR_POSITON, positionFromString(
|
|
2332
|
+
this.setRuntimeValueAndFire(LayoutStateKeys.SIDEBAR_POSITON, positionFromString(
|
|
2333
|
+
this.configurationService.getValue(LegacyWorkbenchLayoutSettings.SIDEBAR_POSITION) ?? "left"
|
|
2334
|
+
));
|
|
2062
2335
|
}
|
|
2063
2336
|
}
|
|
2064
2337
|
updateLegacySettingsFromState(key, value) {
|
|
@@ -2067,12 +2340,13 @@ class LayoutStateModel extends Disposable {
|
|
|
2067
2340
|
return;
|
|
2068
2341
|
}
|
|
2069
2342
|
if (key === LayoutStateKeys.ACTIVITYBAR_HIDDEN) {
|
|
2070
|
-
this.configurationService.updateValue(
|
|
2071
|
-
|
|
2072
|
-
|
|
2343
|
+
this.configurationService.updateValue(
|
|
2344
|
+
LayoutSettings.ACTIVITY_BAR_LOCATION,
|
|
2345
|
+
value ? ActivityBarPosition.HIDDEN : undefined
|
|
2346
|
+
);
|
|
2347
|
+
} else if (key === LayoutStateKeys.STATUSBAR_HIDDEN) {
|
|
2073
2348
|
this.configurationService.updateValue(LegacyWorkbenchLayoutSettings.STATUSBAR_VISIBLE, !value);
|
|
2074
|
-
}
|
|
2075
|
-
else if (key === LayoutStateKeys.SIDEBAR_POSITON) {
|
|
2349
|
+
} else if (key === LayoutStateKeys.SIDEBAR_POSITON) {
|
|
2076
2350
|
this.configurationService.updateValue(LegacyWorkbenchLayoutSettings.SIDEBAR_POSITION, positionToString(value));
|
|
2077
2351
|
}
|
|
2078
2352
|
}
|
|
@@ -2088,37 +2362,47 @@ class LayoutStateModel extends Disposable {
|
|
|
2088
2362
|
}
|
|
2089
2363
|
}
|
|
2090
2364
|
this.stateCache.set(LayoutStateKeys.ACTIVITYBAR_HIDDEN.name, this.isActivityBarHidden());
|
|
2091
|
-
this.stateCache.set(
|
|
2092
|
-
|
|
2365
|
+
this.stateCache.set(
|
|
2366
|
+
LayoutStateKeys.STATUSBAR_HIDDEN.name,
|
|
2367
|
+
!this.configurationService.getValue(LegacyWorkbenchLayoutSettings.STATUSBAR_VISIBLE)
|
|
2368
|
+
);
|
|
2369
|
+
this.stateCache.set(LayoutStateKeys.SIDEBAR_POSITON.name, positionFromString(
|
|
2370
|
+
this.configurationService.getValue(LegacyWorkbenchLayoutSettings.SIDEBAR_POSITION) ?? "left"
|
|
2371
|
+
));
|
|
2372
|
+
const auxiliaryBarForceMaximized = this.configurationService.getValue(WorkbenchLayoutSettings.AUXILIARYBAR_FORCE_MAXIMIZED);
|
|
2093
2373
|
const workbenchState = this.contextService.getWorkbenchState();
|
|
2094
2374
|
const mainContainerDimension = configuration.mainContainerDimension;
|
|
2095
2375
|
LayoutStateKeys.SIDEBAR_SIZE.defaultValue = Math.min(300, mainContainerDimension.width / 4);
|
|
2096
|
-
LayoutStateKeys.SIDEBAR_HIDDEN.defaultValue = workbenchState === WorkbenchState.EMPTY;
|
|
2097
|
-
LayoutStateKeys.AUXILIARYBAR_SIZE.defaultValue = Math.min(300, mainContainerDimension.width / 4);
|
|
2376
|
+
LayoutStateKeys.SIDEBAR_HIDDEN.defaultValue = workbenchState === WorkbenchState.EMPTY || auxiliaryBarForceMaximized === true;
|
|
2377
|
+
LayoutStateKeys.AUXILIARYBAR_SIZE.defaultValue = auxiliaryBarForceMaximized ? Math.max(300, mainContainerDimension.width / 2) : Math.min(300, mainContainerDimension.width / 4);
|
|
2098
2378
|
LayoutStateKeys.AUXILIARYBAR_HIDDEN.defaultValue = (() => {
|
|
2099
2379
|
if (isWeb && !this.environmentService.remoteAuthority) {
|
|
2100
2380
|
return true;
|
|
2101
2381
|
}
|
|
2382
|
+
if (auxiliaryBarForceMaximized === true) {
|
|
2383
|
+
return false;
|
|
2384
|
+
}
|
|
2102
2385
|
const configuration = this.configurationService.inspect(WorkbenchLayoutSettings.AUXILIARYBAR_DEFAULT_VISIBILITY);
|
|
2103
|
-
if (configuration.defaultValue !==
|
|
2386
|
+
if (configuration.defaultValue !== "hidden" && !isConfigured(configuration) && this.stateCache.get(LayoutStateKeys.AUXILIARYBAR_EMPTY.name)) {
|
|
2104
2387
|
return true;
|
|
2105
2388
|
}
|
|
2106
|
-
if (this.isNew[StorageScope.APPLICATION] &&
|
|
2107
|
-
configuration.value !== 'hidden') {
|
|
2389
|
+
if (this.isNew[StorageScope.APPLICATION] && configuration.value !== "hidden") {
|
|
2108
2390
|
return false;
|
|
2109
2391
|
}
|
|
2110
2392
|
switch (configuration.value) {
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2393
|
+
case "hidden":
|
|
2394
|
+
return true;
|
|
2395
|
+
case "visibleInWorkspace":
|
|
2396
|
+
case "maximizedInWorkspace":
|
|
2397
|
+
return workbenchState === WorkbenchState.EMPTY;
|
|
2398
|
+
default:
|
|
2399
|
+
return false;
|
|
2118
2400
|
}
|
|
2119
2401
|
})();
|
|
2120
2402
|
LayoutStateKeys.PANEL_SIZE.defaultValue = (this.stateCache.get(LayoutStateKeys.PANEL_POSITION.name) ?? isHorizontal(LayoutStateKeys.PANEL_POSITION.defaultValue)) ? mainContainerDimension.height / 3 : mainContainerDimension.width / 4;
|
|
2121
|
-
LayoutStateKeys.PANEL_POSITION.defaultValue = positionFromString(
|
|
2403
|
+
LayoutStateKeys.PANEL_POSITION.defaultValue = positionFromString(
|
|
2404
|
+
this.configurationService.getValue(WorkbenchLayoutSettings.PANEL_POSITION) ?? "bottom"
|
|
2405
|
+
);
|
|
2122
2406
|
for (key in LayoutStateKeys) {
|
|
2123
2407
|
const stateKey = LayoutStateKeys[key];
|
|
2124
2408
|
if (this.stateCache.get(stateKey.name) === undefined) {
|
|
@@ -2126,38 +2410,46 @@ class LayoutStateModel extends Disposable {
|
|
|
2126
2410
|
}
|
|
2127
2411
|
}
|
|
2128
2412
|
this.applyOverrides(configuration);
|
|
2129
|
-
this._register(
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
if (
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
this.stateCache.
|
|
2138
|
-
|
|
2413
|
+
this._register(
|
|
2414
|
+
this.storageService.onDidChangeValue(StorageScope.PROFILE, undefined, this._store)(storageChangeEvent => {
|
|
2415
|
+
let key;
|
|
2416
|
+
for (key in LayoutStateKeys) {
|
|
2417
|
+
const stateKey = LayoutStateKeys[key];
|
|
2418
|
+
if (stateKey instanceof RuntimeStateKey && stateKey.scope === StorageScope.PROFILE && stateKey.target === StorageTarget.USER) {
|
|
2419
|
+
if (`${LayoutStateModel.STORAGE_PREFIX}${stateKey.name}` === storageChangeEvent.key) {
|
|
2420
|
+
const value = this.loadKeyFromStorage(stateKey) ?? stateKey.defaultValue;
|
|
2421
|
+
if (this.stateCache.get(stateKey.name) !== value) {
|
|
2422
|
+
this.stateCache.set(stateKey.name, value);
|
|
2423
|
+
this._onDidChangeState.fire({
|
|
2424
|
+
key: stateKey,
|
|
2425
|
+
value
|
|
2426
|
+
});
|
|
2427
|
+
}
|
|
2139
2428
|
}
|
|
2140
2429
|
}
|
|
2141
2430
|
}
|
|
2142
|
-
}
|
|
2143
|
-
|
|
2431
|
+
})
|
|
2432
|
+
);
|
|
2144
2433
|
}
|
|
2145
2434
|
applyOverrides(configuration) {
|
|
2146
2435
|
if (this.isNew[StorageScope.WORKSPACE]) {
|
|
2147
2436
|
const defaultAuxiliaryBarVisibility = this.configurationService.getValue(WorkbenchLayoutSettings.AUXILIARYBAR_DEFAULT_VISIBILITY);
|
|
2148
|
-
if (defaultAuxiliaryBarVisibility ===
|
|
2149
|
-
(defaultAuxiliaryBarVisibility === 'maximizedInWorkspace' && this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY)) {
|
|
2437
|
+
if (defaultAuxiliaryBarVisibility === "maximized" || (defaultAuxiliaryBarVisibility === "maximizedInWorkspace" && this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY)) {
|
|
2150
2438
|
this.applyAuxiliaryBarMaximizedOverride();
|
|
2151
2439
|
}
|
|
2152
2440
|
}
|
|
2153
|
-
if (this.getRuntimeValue(LayoutStateKeys.PANEL_HIDDEN) &&
|
|
2154
|
-
this.getRuntimeValue(LayoutStateKeys.EDITOR_HIDDEN) &&
|
|
2155
|
-
!this.getRuntimeValue(LayoutStateKeys.AUXILIARYBAR_WAS_LAST_MAXIMIZED)) {
|
|
2441
|
+
if (this.getRuntimeValue(LayoutStateKeys.PANEL_HIDDEN) && this.getRuntimeValue(LayoutStateKeys.EDITOR_HIDDEN) && !this.getRuntimeValue(LayoutStateKeys.AUXILIARYBAR_WAS_LAST_MAXIMIZED)) {
|
|
2156
2442
|
this.setRuntimeValue(LayoutStateKeys.EDITOR_HIDDEN, false);
|
|
2157
2443
|
}
|
|
2158
2444
|
if (this.isNew[StorageScope.WORKSPACE] && configuration.mainContainerDimension.width <= DEFAULT_WORKSPACE_WINDOW_DIMENSIONS.width) {
|
|
2159
|
-
this.setInitializationValue(
|
|
2160
|
-
|
|
2445
|
+
this.setInitializationValue(
|
|
2446
|
+
LayoutStateKeys.SIDEBAR_SIZE,
|
|
2447
|
+
Math.min(300, configuration.mainContainerDimension.width / 4)
|
|
2448
|
+
);
|
|
2449
|
+
this.setInitializationValue(
|
|
2450
|
+
LayoutStateKeys.AUXILIARYBAR_SIZE,
|
|
2451
|
+
Math.min(300, configuration.mainContainerDimension.width / 4)
|
|
2452
|
+
);
|
|
2161
2453
|
}
|
|
2162
2454
|
}
|
|
2163
2455
|
applyAuxiliaryBarMaximizedOverride() {
|
|
@@ -2171,7 +2463,10 @@ class LayoutStateModel extends Disposable {
|
|
|
2171
2463
|
this.setRuntimeValue(LayoutStateKeys.PANEL_HIDDEN, true);
|
|
2172
2464
|
this.setRuntimeValue(LayoutStateKeys.EDITOR_HIDDEN, true);
|
|
2173
2465
|
this.setRuntimeValue(LayoutStateKeys.AUXILIARYBAR_HIDDEN, false);
|
|
2174
|
-
this.setRuntimeValue(
|
|
2466
|
+
this.setRuntimeValue(
|
|
2467
|
+
LayoutStateKeys.AUXILIARYBAR_LAST_NON_MAXIMIZED_SIZE,
|
|
2468
|
+
this.getInitializationValue(LayoutStateKeys.AUXILIARYBAR_SIZE)
|
|
2469
|
+
);
|
|
2175
2470
|
this.setRuntimeValue(LayoutStateKeys.AUXILIARYBAR_WAS_LAST_MAXIMIZED, true);
|
|
2176
2471
|
}
|
|
2177
2472
|
save(workspace, global) {
|
|
@@ -2179,8 +2474,7 @@ class LayoutStateModel extends Disposable {
|
|
|
2179
2474
|
const isZenMode = this.getRuntimeValue(LayoutStateKeys.ZEN_MODE_ACTIVE);
|
|
2180
2475
|
for (key in LayoutStateKeys) {
|
|
2181
2476
|
const stateKey = LayoutStateKeys[key];
|
|
2182
|
-
if ((workspace && stateKey.scope === StorageScope.WORKSPACE) ||
|
|
2183
|
-
(global && stateKey.scope === StorageScope.PROFILE)) {
|
|
2477
|
+
if ((workspace && stateKey.scope === StorageScope.WORKSPACE) || (global && stateKey.scope === StorageScope.PROFILE)) {
|
|
2184
2478
|
if (isZenMode && stateKey instanceof RuntimeStateKey && stateKey.zenModeIgnore) {
|
|
2185
2479
|
continue;
|
|
2186
2480
|
}
|
|
@@ -2197,15 +2491,21 @@ class LayoutStateModel extends Disposable {
|
|
|
2197
2491
|
getRuntimeValue(key, fallbackToSetting) {
|
|
2198
2492
|
if (fallbackToSetting) {
|
|
2199
2493
|
switch (key) {
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2494
|
+
case LayoutStateKeys.ACTIVITYBAR_HIDDEN:
|
|
2495
|
+
this.stateCache.set(key.name, this.isActivityBarHidden());
|
|
2496
|
+
break;
|
|
2497
|
+
case LayoutStateKeys.STATUSBAR_HIDDEN:
|
|
2498
|
+
this.stateCache.set(
|
|
2499
|
+
key.name,
|
|
2500
|
+
!this.configurationService.getValue(LegacyWorkbenchLayoutSettings.STATUSBAR_VISIBLE)
|
|
2501
|
+
);
|
|
2502
|
+
break;
|
|
2503
|
+
case LayoutStateKeys.SIDEBAR_POSITON:
|
|
2504
|
+
this.stateCache.set(
|
|
2505
|
+
key.name,
|
|
2506
|
+
this.configurationService.getValue(LegacyWorkbenchLayoutSettings.SIDEBAR_POSITION) ?? "left"
|
|
2507
|
+
);
|
|
2508
|
+
break;
|
|
2209
2509
|
}
|
|
2210
2510
|
}
|
|
2211
2511
|
return this.stateCache.get(key.name);
|
|
@@ -2233,20 +2533,31 @@ class LayoutStateModel extends Disposable {
|
|
|
2233
2533
|
return;
|
|
2234
2534
|
}
|
|
2235
2535
|
this.setRuntimeValue(key, value);
|
|
2236
|
-
this._onDidChangeState.fire({
|
|
2536
|
+
this._onDidChangeState.fire({
|
|
2537
|
+
key,
|
|
2538
|
+
value
|
|
2539
|
+
});
|
|
2237
2540
|
}
|
|
2238
2541
|
saveKeyToStorage(key) {
|
|
2239
2542
|
const value = this.stateCache.get(key.name);
|
|
2240
|
-
this.storageService.store(
|
|
2543
|
+
this.storageService.store(
|
|
2544
|
+
`${LayoutStateModel.STORAGE_PREFIX}${key.name}`,
|
|
2545
|
+
typeof value === "object" ? JSON.stringify(value) : value,
|
|
2546
|
+
key.scope,
|
|
2547
|
+
key.target
|
|
2548
|
+
);
|
|
2241
2549
|
}
|
|
2242
2550
|
loadKeyFromStorage(key) {
|
|
2243
2551
|
const value = this.storageService.get(`${LayoutStateModel.STORAGE_PREFIX}${key.name}`, key.scope);
|
|
2244
2552
|
if (value !== undefined) {
|
|
2245
2553
|
this.isNew[key.scope] = false;
|
|
2246
2554
|
switch (typeof key.defaultValue) {
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2555
|
+
case "boolean":
|
|
2556
|
+
return (value === "true");
|
|
2557
|
+
case "number":
|
|
2558
|
+
return parseInt(value);
|
|
2559
|
+
case "object":
|
|
2560
|
+
return JSON.parse(value);
|
|
2250
2561
|
}
|
|
2251
2562
|
}
|
|
2252
2563
|
return value;
|