@codingame/monaco-vscode-workbench-service-override 37.3.11 → 37.4.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/index.js CHANGED
@@ -52,9 +52,9 @@ let CustomWorkbench = class CustomWorkbench extends Workbench {
52
52
  initServices() {
53
53
  return this.instantiationService;
54
54
  }
55
- restore(instantiationService) {
55
+ restore(accessor) {
56
56
  try {
57
- this.restoreParts(instantiationService);
57
+ this.restoreParts(accessor);
58
58
  }
59
59
  catch (error) {
60
60
  onUnexpectedError(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-workbench-service-override",
3
- "version": "37.3.11",
3
+ "version": "37.4.0",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor - workbench service-override",
6
6
  "keywords": [],
@@ -15,15 +15,15 @@
15
15
  },
16
16
  "type": "module",
17
17
  "dependencies": {
18
- "@codingame/monaco-vscode-api": "37.3.11",
19
- "@codingame/monaco-vscode-environment-service-override": "37.3.11",
20
- "@codingame/monaco-vscode-katex-common": "37.3.11",
21
- "@codingame/monaco-vscode-keybindings-service-override": "37.3.11",
22
- "@codingame/monaco-vscode-quickaccess-service-override": "37.3.11",
23
- "@codingame/monaco-vscode-view-banner-service-override": "37.3.11",
24
- "@codingame/monaco-vscode-view-common-service-override": "37.3.11",
25
- "@codingame/monaco-vscode-view-status-bar-service-override": "37.3.11",
26
- "@codingame/monaco-vscode-view-title-bar-service-override": "37.3.11"
18
+ "@codingame/monaco-vscode-api": "37.4.0",
19
+ "@codingame/monaco-vscode-environment-service-override": "37.4.0",
20
+ "@codingame/monaco-vscode-katex-common": "37.4.0",
21
+ "@codingame/monaco-vscode-keybindings-service-override": "37.4.0",
22
+ "@codingame/monaco-vscode-quickaccess-service-override": "37.4.0",
23
+ "@codingame/monaco-vscode-view-banner-service-override": "37.4.0",
24
+ "@codingame/monaco-vscode-view-common-service-override": "37.4.0",
25
+ "@codingame/monaco-vscode-view-status-bar-service-override": "37.4.0",
26
+ "@codingame/monaco-vscode-view-title-bar-service-override": "37.4.0"
27
27
  },
28
28
  "main": "index.js",
29
29
  "module": "index.js",
package/session.d.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  import type { IEditorOverrideServices } from "@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneServices";
2
2
  import { type IWorkbenchOptions } from "@codingame/monaco-vscode-api/vscode/vs/sessions/browser/workbench";
3
+ import { agentHostUri } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostFileSystemProvider";
4
+ import { agentHostAuthority } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostUri";
3
5
  export * from "./common.js";
4
6
  export default function getServiceOverride(options?: IWorkbenchOptions, _webviewIframeAlternateDomains?: string): IEditorOverrideServices;
7
+ export { agentHostUri, agentHostAuthority };
package/session.js CHANGED
@@ -3,7 +3,7 @@ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib
3
3
  import { setFullscreen } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/browser';
4
4
  import { detectFullscreen } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
5
5
  import { mainWindow } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/window';
6
- import { setUnexpectedErrorHandler } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
6
+ import { setUnexpectedErrorHandler, onUnexpectedError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
7
7
  import { RemoteAgentHostLocationPreferenceService } from './vscode/src/vs/platform/agentHost/browser/remoteAgentHostLocationPreferenceService.js';
8
8
  import { IAgentHostByokLmHandler } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostByokLm.service';
9
9
  import { ICloudSandboxAgentHostService, ICloudSandboxApiService } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/cloudSandboxAgentHost.service';
@@ -118,6 +118,8 @@ import { Registry } from '@codingame/monaco-vscode-api/vscode/vs/platform/regist
118
118
  import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
119
119
  import { EditorParts } from './vscode/src/vs/sessions/browser/parts/editorParts.js';
120
120
  import getServiceOverride$3 from '@codingame/monaco-vscode-environment-service-override';
121
+ export { agentHostUri } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostFileSystemProvider';
122
+ export { agentHostAuthority } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostUri';
121
123
  import './vscode/src/vs/sessions/browser/parts/menubar.contribution.js';
122
124
  import './vscode/src/vs/sessions/contrib/aiCustomizationTreeView/browser/aiCustomizationTreeView.contribution.js';
123
125
  import './vscode/src/vs/sessions/contrib/aquarium/browser/aquarium.contribution.js';
@@ -186,8 +188,13 @@ let CustomWorkbench = class CustomWorkbench extends Workbench {
186
188
  initServices() {
187
189
  return this._instantiationService;
188
190
  }
189
- restore() {
190
- this.restoreParts();
191
+ restore(accessor) {
192
+ try {
193
+ this.restoreParts(accessor);
194
+ }
195
+ catch (error) {
196
+ onUnexpectedError(error);
197
+ }
191
198
  void this.sessionsService.restoreVisibleSessions().catch((e) => {
192
199
  this.logService.error('[Workbench] restoreVisibleSessions failed', e);
193
200
  });
@@ -3,13 +3,15 @@ import { Direction, IViewSize } from "@codingame/monaco-vscode-api/vscode/vs/bas
3
3
  import { CodeWindow } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/window";
4
4
  import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
5
5
  import { Disposable, DisposableMap, DisposableStore, IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
6
- import { IUntypedEditorInput } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor";
7
- import { Position, Parts, PanelAlignment, MULTI_WINDOW_PARTS, SINGLE_WINDOW_PARTS, IPartVisibilityChangeEvent } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService";
8
- import { IWorkbenchLayoutService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService.service";
9
- import { ServicesAccessor, IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
10
- import { IPath } from "@codingame/monaco-vscode-api/vscode/vs/platform/window/common/window";
11
- import { EditorGroupLayout } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService";
6
+ import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
7
+ import { ServicesAccessor } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
8
+ import { StorageScope, StorageTarget } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage";
9
+ import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
10
+ import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service";
11
+ import { IPartVisibilityChangeEvent, MULTI_WINDOW_PARTS, PanelAlignment, Parts, Position, SINGLE_WINDOW_PARTS } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService";
12
+ import { AbstractLayout } from "@codingame/monaco-vscode-api/vscode/vs/workbench/browser/abstractlayout";
12
13
  import { Part } from "@codingame/monaco-vscode-api/vscode/vs/workbench/browser/part";
14
+ export * from "@codingame/monaco-vscode-api/vscode/vs/workbench/browser/abstractlayout";
13
15
  export interface ILayoutRuntimeState {
14
16
  activeContainerId: number;
15
17
  mainWindowFullscreen: boolean;
@@ -23,40 +25,9 @@ export interface ILayoutRuntimeState {
23
25
  readonly transitionDisposables: DisposableMap<string, IDisposable>;
24
26
  };
25
27
  }
26
- export interface IEditorToOpen {
27
- readonly editor: IUntypedEditorInput;
28
- readonly viewColumn?: number;
29
- }
30
- export interface ILayoutInitializationState {
31
- readonly views: {
32
- readonly defaults: string[] | undefined;
33
- readonly containerToRestore: {
34
- sideBar?: string;
35
- panel?: string;
36
- auxiliaryBar?: string;
37
- };
38
- };
39
- readonly editor: {
40
- readonly restoreEditors: boolean;
41
- readonly editorsToOpen: Promise<IEditorToOpen[]>;
42
- };
43
- readonly layout?: {
44
- readonly editors?: EditorGroupLayout;
45
- };
46
- }
47
- export interface IPathToOpen extends IPath {
48
- readonly viewColumn?: number;
49
- }
50
- export interface IInitialEditorsState {
51
- readonly filesToOpenOrCreate?: IPathToOpen[];
52
- readonly filesToDiff?: IPathToOpen[];
53
- readonly filesToMerge?: IPathToOpen[];
54
- readonly layout?: EditorGroupLayout;
55
- }
56
28
  export declare const TITLE_BAR_SETTINGS: string[];
57
- export declare abstract class Layout extends Disposable implements IWorkbenchLayoutService {
29
+ export declare abstract class Layout extends AbstractLayout {
58
30
  protected readonly parent: HTMLElement;
59
- private readonly layoutOptions?;
60
31
  readonly _serviceBrand: undefined;
61
32
  private readonly _onDidChangeZenMode;
62
33
  readonly onDidChangeZenMode: Event<boolean>;
@@ -147,7 +118,7 @@ export declare abstract class Layout extends Disposable implements IWorkbenchLay
147
118
  constructor(parent: HTMLElement, layoutOptions?: {
148
119
  resetLayout?: boolean;
149
120
  customEditorRestore?: (accessor: ServicesAccessor, defaultLayout: boolean) => Promise<void>;
150
- } | undefined);
121
+ });
151
122
  protected initLayout(accessor: ServicesAccessor): void;
152
123
  private registerLayoutListeners;
153
124
  private onMenubarToggled;
@@ -165,20 +136,14 @@ export declare abstract class Layout extends Disposable implements IWorkbenchLay
165
136
  private setSideBarPosition;
166
137
  private updateWindowBorder;
167
138
  private initLayoutState;
168
- private getDefaultLayoutViews;
169
- private shouldRestoreEditors;
170
139
  protected willRestoreEditors(): boolean;
171
- private resolveEditorsToOpen;
172
- private _openedDefaultEditors;
173
- get openedDefaultEditors(): boolean;
174
- private getInitialEditorsState;
175
140
  private readonly whenReadyPromise;
176
141
  protected readonly whenReady: Promise<void>;
177
142
  private readonly whenRestoredPromise;
178
143
  readonly whenRestored: Promise<void>;
179
144
  private restored;
180
145
  isRestored(): boolean;
181
- protected restoreParts(instantiationService: IInstantiationService): void;
146
+ protected restoreParts(accessor: ServicesAccessor): void;
182
147
  private openViewContainer;
183
148
  registerPart(part: Part): IDisposable;
184
149
  protected getPart(key: Parts): Part;
@@ -248,3 +213,62 @@ export declare abstract class Layout extends Disposable implements IWorkbenchLay
248
213
  private createGridDescriptor;
249
214
  dispose(): void;
250
215
  }
216
+ interface IWorkbenchLayoutStateKey {
217
+ readonly name: string;
218
+ readonly runtime: boolean;
219
+ readonly defaultValue: unknown;
220
+ readonly scope: StorageScope;
221
+ readonly target: StorageTarget;
222
+ readonly zenModeIgnore?: boolean;
223
+ }
224
+ type StorageKeyType = string | boolean | number | object;
225
+ declare abstract class WorkbenchLayoutStateKey<T extends StorageKeyType> implements IWorkbenchLayoutStateKey {
226
+ readonly name: string;
227
+ readonly scope: StorageScope;
228
+ readonly target: StorageTarget;
229
+ defaultValue: T;
230
+ abstract readonly runtime: boolean;
231
+ constructor(name: string, scope: StorageScope, target: StorageTarget, defaultValue: T);
232
+ }
233
+ declare class RuntimeStateKey<T extends StorageKeyType> extends WorkbenchLayoutStateKey<T> {
234
+ readonly zenModeIgnore?: boolean | undefined;
235
+ readonly runtime = true;
236
+ constructor(name: string, scope: StorageScope, target: StorageTarget, defaultValue: T, zenModeIgnore?: boolean | undefined);
237
+ }
238
+ declare class InitializationStateKey<T extends StorageKeyType> extends WorkbenchLayoutStateKey<T> {
239
+ readonly runtime = false;
240
+ }
241
+ interface ILayoutStateChangeEvent<T extends StorageKeyType> {
242
+ readonly key: RuntimeStateKey<T>;
243
+ readonly value: T;
244
+ }
245
+ interface ILayoutStateLoadConfiguration {
246
+ readonly mainContainerDimension: IDimension;
247
+ readonly resetLayout: boolean;
248
+ }
249
+ export declare class LayoutStateModel extends Disposable {
250
+ private readonly storageService;
251
+ private readonly configurationService;
252
+ private readonly contextService;
253
+ static readonly STORAGE_PREFIX = "workbench.";
254
+ private readonly _onDidChangeState;
255
+ readonly onDidChangeState: Event<ILayoutStateChangeEvent<StorageKeyType>>;
256
+ private readonly stateCache;
257
+ private readonly isNew;
258
+ constructor(storageService: IStorageService, configurationService: IConfigurationService, contextService: IWorkspaceContextService);
259
+ private updateStateFromLegacySettings;
260
+ private updateLegacySettingsFromState;
261
+ load(configuration: ILayoutStateLoadConfiguration): void;
262
+ private applyOverrides;
263
+ private applyAuxiliaryBarMaximizedOverride;
264
+ private applyAuxiliaryBarHiddenOverride;
265
+ save(workspace: boolean, global: boolean): void;
266
+ getInitializationValue<T extends StorageKeyType>(key: InitializationStateKey<T>): T;
267
+ setInitializationValue<T extends StorageKeyType>(key: InitializationStateKey<T>, value: T): void;
268
+ getRuntimeValue<T extends StorageKeyType>(key: RuntimeStateKey<T>, fallbackToSetting?: boolean): T;
269
+ setRuntimeValue<T extends StorageKeyType>(key: RuntimeStateKey<T>, value: T): void;
270
+ private isActivityBarHidden;
271
+ private setRuntimeValueAndFire;
272
+ private saveKeyToStorage;
273
+ private loadKeyFromStorage;
274
+ }
@@ -2,57 +2,57 @@
2
2
  import { onDidChangeFullscreen, isFullscreen, isWCOEnabled } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/browser';
3
3
  import { Dimension, getActiveDocument, getWindows, getClientArea, getWindow, createElement, addDisposableListener, EventType, isActiveDocument, getActiveElement, getActiveWindow, isAncestorUsingFlowTo, getFullscreenElement, size, computeScreenAwareSize, getWindowId } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
4
4
  import { setContainerElement } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/domStylesheets';
5
+ import { alert } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/aria/aria';
5
6
  import { SerializableGrid, Sizing, Direction } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/grid/grid';
6
7
  import { mainWindow } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/window';
7
8
  import { coalesce } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
8
9
  import { DeferredPromise, Promises } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
9
10
  import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
10
- import { Disposable, toDisposable, DisposableStore, DisposableMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
11
- import { alert } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/aria/aria';
11
+ import { toDisposable, DisposableStore, DisposableMap, Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
12
+ import { mark } from '@codingame/monaco-vscode-api/vscode/vs/base/common/performance';
12
13
  import { isWindows, isLinux, isWeb, isIOS, isMacintosh } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
13
- import { pathsToEditors, isResourceEditorInput, EditorInputCapabilities } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
14
- import { SidebarPart } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/sidebar/sidebarPart';
15
- import { PanelPart } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/panel/panelPart';
16
- import { LayoutSettings, Parts, EditorActionsLocation, ActivityBarPosition, shouldShowCustomTitleBar, ModernUIDensity, Position, isHorizontal, ZenModeSettings, isMultiWindowPart, isFloatingTopEdgeExposed, positionToString, partOpensMaximizedFromString, PartOpensMaximizedOptions, positionFromString } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService';
17
- import { WorkbenchState, isTemporaryWorkspace } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace';
18
- import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
19
- import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
20
- import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
14
+ import { assertReturnsDefined } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
15
+ import { isCodeEditor } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser';
16
+ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
17
+ import { ChatAIDisabledSettingId } from '@codingame/monaco-vscode-api/vscode/vs/platform/chat/common/chatSettings';
21
18
  import { isConfigured, isDefaultOverriden } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration';
22
19
  import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
23
- import { ChatAIDisabledSettingId } from '@codingame/monaco-vscode-api/vscode/vs/platform/chat/common/chatSettings';
24
- import { ITitleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/title/browser/titleService.service';
25
- import { StartupKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle';
26
- import { ILifecycleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
27
- 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';
28
- import { IHostService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service';
29
- import { IBrowserWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/browser/environmentService.service';
30
- import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
31
- import { GroupActivationReason, GroupsOrder, GroupOrientation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService';
32
- import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
33
- import { Part } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/part';
34
- import { IStatusbarService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/statusbar/browser/statusbar.service';
35
- import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
36
- import { isCodeEditor } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser';
37
- import { assertReturnsDefined } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
20
+ import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
38
21
  import { NotificationsFilter } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification';
39
22
  import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
40
- import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
23
+ import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
24
+ import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
25
+ import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
41
26
  import { isHighContrast } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/theme';
27
+ import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
28
+ 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';
29
+ import { WorkbenchState } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace';
30
+ import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
31
+ import { EditorInputCapabilities } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
32
+ import { DiffEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor/diffEditorInput';
42
33
  import { WINDOW_ACTIVE_BORDER, WINDOW_INACTIVE_BORDER } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/theme';
43
- import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
44
34
  import { ViewContainerLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views';
45
35
  import { IViewDescriptorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views.service';
46
- import { DiffEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor/diffEditorInput';
47
- import { mark } from '@codingame/monaco-vscode-api/vscode/vs/base/common/performance';
48
- import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
49
- import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
50
36
  import { IAuxiliaryWindowService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.service';
51
- import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
52
37
  import { IBannerService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/banner/browser/bannerService.service';
38
+ import { GroupActivationReason, GroupOrientation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService';
39
+ import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
40
+ import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
41
+ import { IBrowserWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/browser/environmentService.service';
53
42
  import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
43
+ import { IHostService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service';
44
+ import { LayoutSettings, Parts, EditorActionsLocation, ActivityBarPosition, shouldShowCustomTitleBar, ModernUIDensity, Position, isHorizontal, ZenModeSettings, isMultiWindowPart, isFloatingTopEdgeExposed, positionToString, partOpensMaximizedFromString, PartOpensMaximizedOptions, positionFromString } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService';
45
+ import { StartupKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle';
46
+ import { ILifecycleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
54
47
  import { IPaneCompositePartService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/panecomposite/browser/panecomposite.service';
48
+ import { IStatusbarService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/statusbar/browser/statusbar.service';
49
+ import { ITitleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/title/browser/titleService.service';
50
+ import { AbstractLayout, WorkbenchLayoutSettings } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/abstractlayout';
51
+ export { AbstractLayout, WorkbenchLayoutSettings } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/abstractlayout';
52
+ import { Part } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/part';
55
53
  import { AuxiliaryBarPart } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart';
54
+ import { PanelPart } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/panel/panelPart';
55
+ import { SidebarPart } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/sidebar/sidebarPart';
56
56
  import { Orientation } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/sash/sash';
57
57
  import '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/grid/gridview';
58
58
 
@@ -92,7 +92,7 @@ const TITLE_BAR_SETTINGS = [
92
92
  ];
93
93
  const DEFAULT_EMPTY_WINDOW_DIMENSIONS = ( new Dimension(DEFAULT_EMPTY_WINDOW_SIZE.width, DEFAULT_EMPTY_WINDOW_SIZE.height));
94
94
  const DEFAULT_WORKSPACE_WINDOW_DIMENSIONS = ( new Dimension(DEFAULT_WORKSPACE_WINDOW_SIZE.width, DEFAULT_WORKSPACE_WINDOW_SIZE.height));
95
- class Layout extends Disposable {
95
+ class Layout extends AbstractLayout {
96
96
  get activeContainer() {
97
97
  return this.getContainerFromDocument(getActiveDocument());
98
98
  }
@@ -156,9 +156,8 @@ class Layout extends Disposable {
156
156
  };
157
157
  }
158
158
  constructor(parent, layoutOptions) {
159
- super();
159
+ super(layoutOptions);
160
160
  this.parent = parent;
161
- this.layoutOptions = layoutOptions;
162
161
  this._onDidChangeZenMode = this._register(( new Emitter()));
163
162
  this.onDidChangeZenMode = this._onDidChangeZenMode.event;
164
163
  this._onDidChangeMainEditorCenteredLayout = this._register(( new Emitter()));
@@ -190,7 +189,6 @@ class Layout extends Disposable {
190
189
  this.parts = ( new Map());
191
190
  this.initialized = false;
192
191
  this.disposed = false;
193
- this._openedDefaultEditors = false;
194
192
  this.whenReadyPromise = ( new DeferredPromise());
195
193
  this.whenReady = this.whenReadyPromise.p;
196
194
  this.whenRestoredPromise = ( new DeferredPromise());
@@ -220,7 +218,7 @@ class Layout extends Disposable {
220
218
  this.statusBarService = accessor.get(IStatusbarService);
221
219
  accessor.get(IBannerService);
222
220
  this.registerLayoutListeners();
223
- this.initLayoutState(accessor.get(ILifecycleService), accessor.get(IFileService));
221
+ this.initLayoutState(accessor);
224
222
  }
225
223
  registerLayoutListeners() {
226
224
  const showEditorIfHidden = explicitUserAction => {
@@ -510,7 +508,7 @@ class Layout extends Disposable {
510
508
  this.layout();
511
509
  }
512
510
  }
513
- initLayoutState(lifecycleService, fileService) {
511
+ initLayoutState(accessor) {
514
512
  this._mainContainerDimension = getClientArea(
515
513
  this.parent,
516
514
  this.contextService.getWorkbenchState() === WorkbenchState.EMPTY ? DEFAULT_EMPTY_WINDOW_DIMENSIONS : DEFAULT_WORKSPACE_WINDOW_DIMENSIONS
@@ -538,23 +536,6 @@ class Layout extends Disposable {
538
536
  }
539
537
  this.doUpdateLayoutConfiguration();
540
538
  }));
541
- const initialEditorsState = this.getInitialEditorsState();
542
- if (initialEditorsState) {
543
- this.logService.trace("Initial editor state", initialEditorsState);
544
- }
545
- const initialLayoutState = {
546
- layout: {
547
- editors: initialEditorsState?.layout
548
- },
549
- editor: {
550
- restoreEditors: this.shouldRestoreEditors(this.contextService, initialEditorsState),
551
- editorsToOpen: this.resolveEditorsToOpen(fileService, initialEditorsState)
552
- },
553
- views: {
554
- defaults: this.getDefaultLayoutViews(this.environmentService, this.storageService),
555
- containerToRestore: {}
556
- }
557
- };
558
539
  const layoutRuntimeState = {
559
540
  activeContainerId: this.getActiveContainerId(),
560
541
  mainWindowFullscreen: isFullscreen(mainWindow),
@@ -569,7 +550,7 @@ class Layout extends Disposable {
569
550
  }
570
551
  };
571
552
  this.state = {
572
- initialization: initialLayoutState,
553
+ initialization: this.getInitLayoutState(accessor),
573
554
  runtime: layoutRuntimeState
574
555
  };
575
556
  if (this.isVisible(Parts.SIDEBAR_PART)) {
@@ -578,7 +559,7 @@ class Layout extends Disposable {
578
559
  StorageScope.WORKSPACE,
579
560
  this.viewDescriptorService.getDefaultViewContainer(ViewContainerLocation.Sidebar)?.id
580
561
  );
581
- if (!this.environmentService.isBuilt || lifecycleService.startupKind === StartupKind.ReloadedWindow || this.environmentService.isExtensionDevelopment && !this.environmentService.extensionTestsLocationURI)
562
+ if (!this.environmentService.isBuilt || accessor.get(ILifecycleService).startupKind === StartupKind.ReloadedWindow || this.environmentService.isExtensionDevelopment && !this.environmentService.extensionTestsLocationURI)
582
563
  ; else if (viewContainerToRestore !== this.viewDescriptorService.getDefaultViewContainer(ViewContainerLocation.Sidebar)?.id && viewContainerToRestore !== this.viewDescriptorService.getDefaultViewContainer(ViewContainerLocation.AuxiliaryBar)?.id) {
583
564
  viewContainerToRestore = this.viewDescriptorService.getDefaultViewContainer(ViewContainerLocation.Sidebar)?.id;
584
565
  }
@@ -614,187 +595,18 @@ class Layout extends Disposable {
614
595
  }
615
596
  this.updateWindowBorder(true);
616
597
  }
617
- getDefaultLayoutViews(environmentService, storageService) {
618
- const defaultLayout = environmentService.options?.defaultLayout;
619
- if (!defaultLayout) {
620
- return undefined;
621
- }
622
- if (!defaultLayout.force && !storageService.isNew(StorageScope.WORKSPACE)) {
623
- return undefined;
624
- }
625
- const {
626
- views
627
- } = defaultLayout;
628
- if (views?.length) {
629
- return views.map(view => view.id);
630
- }
631
- return undefined;
632
- }
633
- shouldRestoreEditors(contextService, initialEditorsState) {
634
- if (isTemporaryWorkspace(contextService.getWorkspace())) {
635
- return false;
636
- }
637
- if (this.configurationService.getValue(WorkbenchLayoutSettings.EDITOR_RESTORE_EDITORS) === false) {
638
- return false;
639
- }
640
- const forceRestoreEditors = this.configurationService.getValue("window.restoreWindows") === "preserve";
641
- return !!forceRestoreEditors || initialEditorsState === undefined;
642
- }
643
598
  willRestoreEditors() {
644
599
  return this.state.initialization.editor.restoreEditors;
645
600
  }
646
- async resolveEditorsToOpen(fileService, initialEditorsState) {
647
- if (initialEditorsState) {
648
- const filesToMerge = coalesce(
649
- await pathsToEditors(initialEditorsState.filesToMerge, fileService, this.logService)
650
- );
651
- if (filesToMerge.length === 4 && isResourceEditorInput(filesToMerge[0]) && isResourceEditorInput(filesToMerge[1]) && isResourceEditorInput(filesToMerge[2]) && isResourceEditorInput(filesToMerge[3])) {
652
- return [{
653
- editor: {
654
- input1: {
655
- resource: filesToMerge[0].resource
656
- },
657
- input2: {
658
- resource: filesToMerge[1].resource
659
- },
660
- base: {
661
- resource: filesToMerge[2].resource
662
- },
663
- result: {
664
- resource: filesToMerge[3].resource
665
- },
666
- options: {
667
- pinned: true
668
- }
669
- }
670
- }];
671
- }
672
- const filesToDiff = coalesce(
673
- await pathsToEditors(initialEditorsState.filesToDiff, fileService, this.logService)
674
- );
675
- if (filesToDiff.length === 2) {
676
- return [{
677
- editor: {
678
- original: {
679
- resource: filesToDiff[0].resource
680
- },
681
- modified: {
682
- resource: filesToDiff[1].resource
683
- },
684
- options: {
685
- pinned: true
686
- }
687
- }
688
- }];
689
- }
690
- const filesToOpenOrCreate = [];
691
- const resolvedFilesToOpenOrCreate = await pathsToEditors(initialEditorsState.filesToOpenOrCreate, fileService, this.logService);
692
- for (let i = 0; i < resolvedFilesToOpenOrCreate.length; i++) {
693
- const resolvedFileToOpenOrCreate = resolvedFilesToOpenOrCreate[i];
694
- if (resolvedFileToOpenOrCreate) {
695
- filesToOpenOrCreate.push({
696
- editor: resolvedFileToOpenOrCreate,
697
- viewColumn: initialEditorsState.filesToOpenOrCreate?.[i].viewColumn
698
- });
699
- }
700
- }
701
- return filesToOpenOrCreate;
702
- }
703
- else if (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY && this.configurationService.getValue("workbench.startupEditor") === "newUntitledFile") {
704
- if (this.editorGroupService.hasRestorableState) {
705
- return [];
706
- }
707
- return [{
708
- editor: {
709
- resource: undefined
710
- }
711
- }];
712
- }
713
- return [];
714
- }
715
- get openedDefaultEditors() {
716
- return this._openedDefaultEditors;
717
- }
718
- getInitialEditorsState() {
719
- const defaultLayout = this.environmentService.options?.defaultLayout;
720
- if ((defaultLayout?.editors?.length || defaultLayout?.layout?.editors) && (defaultLayout.force || this.storageService.isNew(StorageScope.WORKSPACE))) {
721
- this._openedDefaultEditors = true;
722
- return {
723
- layout: defaultLayout.layout?.editors,
724
- filesToOpenOrCreate: defaultLayout?.editors?.map(editor => {
725
- return {
726
- viewColumn: editor.viewColumn,
727
- fileUri: URI.revive(editor.uri),
728
- openOnlyIfExists: editor.openOnlyIfExists,
729
- options: editor.options
730
- };
731
- })
732
- };
733
- }
734
- const {
735
- filesToOpenOrCreate,
736
- filesToDiff,
737
- filesToMerge
738
- } = this.environmentService;
739
- if (filesToOpenOrCreate || filesToDiff || filesToMerge) {
740
- return {
741
- filesToOpenOrCreate,
742
- filesToDiff,
743
- filesToMerge
744
- };
745
- }
746
- return undefined;
747
- }
748
601
  isRestored() {
749
602
  return this.restored;
750
603
  }
751
- restoreParts(instantiationService) {
604
+ restoreParts(accessor) {
752
605
  const layoutReadyPromises = [];
753
606
  const layoutRestoredPromises = [];
754
- layoutReadyPromises.push((async () => {
755
- mark("code/willRestoreEditors");
756
- await this.editorGroupService.whenReady;
757
- mark("code/restoreEditors/editorGroupsReady");
758
- if (this.state.initialization.layout?.editors) {
759
- this.editorGroupService.mainPart.applyLayout(this.state.initialization.layout.editors);
760
- }
761
- const editors = await this.state.initialization.editor.editorsToOpen;
762
- mark("code/restoreEditors/editorsToOpenResolved");
763
- let openEditorsPromise = undefined;
764
- if (editors.length) {
765
- const editorGroupsInVisualOrder = this.editorGroupService.mainPart.getGroups(GroupsOrder.GRID_APPEARANCE);
766
- const mapEditorsToGroup = ( new Map());
767
- for (const editor of editors) {
768
- const group = editorGroupsInVisualOrder[(editor.viewColumn ?? 1) - 1];
769
- let editorsByGroup = mapEditorsToGroup.get(group.id);
770
- if (!editorsByGroup) {
771
- editorsByGroup = ( new Set());
772
- mapEditorsToGroup.set(group.id, editorsByGroup);
773
- }
774
- editorsByGroup.add(editor.editor);
775
- }
776
- openEditorsPromise = Promise.all(Array.from(mapEditorsToGroup).map(async ([groupId, editors]) => {
777
- try {
778
- await this.editorService.openEditors(Array.from(editors), groupId, {
779
- validateTrust: true
780
- });
781
- } catch (error) {
782
- this.logService.error(error);
783
- }
784
- }));
785
- }
786
- const customEditorRestorePromise = instantiationService.invokeFunction(
787
- this.layoutOptions?.customEditorRestore ?? (async () => {}),
788
- !!this.state.initialization.layout?.editors
789
- );
790
- layoutRestoredPromises.push(Promise.all([
791
- openEditorsPromise?.finally(() => mark("code/restoreEditors/editorsOpened")),
792
- customEditorRestorePromise?.finally(() => mark("code/restoreEditors/customEditorsOpened")),
793
- this.editorGroupService.whenRestored.finally(() => mark("code/restoreEditors/editorGroupsRestored"))
794
- ]).finally(() => {
795
- mark("code/didRestoreEditors");
796
- }));
797
- })());
607
+ layoutReadyPromises.push(
608
+ this.restoreLayout(accessor, this.state.initialization, layoutRestoredPromises)
609
+ );
798
610
  const restoreDefaultViewsPromise = (async () => {
799
611
  if (this.state.initialization.views.defaults?.length) {
800
612
  mark("code/willOpenDefaultViews");
@@ -2357,17 +2169,6 @@ const LayoutStateKeys = {
2357
2169
  true
2358
2170
  ))
2359
2171
  };
2360
- var WorkbenchLayoutSettings;
2361
- (function(WorkbenchLayoutSettings) {
2362
- WorkbenchLayoutSettings["AUXILIARYBAR_DEFAULT_VISIBILITY"] = "workbench.secondarySideBar.defaultVisibility";
2363
- WorkbenchLayoutSettings["AUXILIARYBAR_FORCE_MAXIMIZED"] = "workbench.secondarySideBar.forceMaximized";
2364
- WorkbenchLayoutSettings["ACTIVITY_BAR_VISIBLE"] = "workbench.activityBar.visible";
2365
- WorkbenchLayoutSettings["PANEL_POSITION"] = "workbench.panel.defaultLocation";
2366
- WorkbenchLayoutSettings["PANEL_OPENS_MAXIMIZED"] = "workbench.panel.opensMaximized";
2367
- WorkbenchLayoutSettings["ZEN_MODE_CONFIG"] = "zenMode";
2368
- WorkbenchLayoutSettings["EDITOR_CENTERED_LAYOUT_AUTO_RESIZE"] = "workbench.editor.centeredLayoutAutoResize";
2369
- WorkbenchLayoutSettings["EDITOR_RESTORE_EDITORS"] = "workbench.editor.restoreEditors";
2370
- })(WorkbenchLayoutSettings || (WorkbenchLayoutSettings = {}));
2371
2172
  var LegacyWorkbenchLayoutSettings;
2372
2173
  (function(LegacyWorkbenchLayoutSettings) {
2373
2174
  LegacyWorkbenchLayoutSettings["STATUSBAR_VISIBLE"] = "workbench.statusBar.visible";
@@ -2644,4 +2445,4 @@ class LayoutStateModel extends Disposable {
2644
2445
  }
2645
2446
  }
2646
2447
 
2647
- export { Layout, TITLE_BAR_SETTINGS };
2448
+ export { Layout, LayoutStateModel, TITLE_BAR_SETTINGS };
@@ -42,5 +42,5 @@ export declare class Workbench extends Layout {
42
42
  protected renderWorkbench(instantiationService: IInstantiationService, notificationService: NotificationService, storageService: IStorageService, configurationService: IConfigurationService): void;
43
43
  private createPart;
44
44
  protected createNotificationsHandlers(instantiationService: IInstantiationService, notificationService: NotificationService): void;
45
- protected restore(instantiationService: IInstantiationService, lifecycleService: ILifecycleService): void;
45
+ protected restore(accessor: ServicesAccessor): void;
46
46
  }
@@ -111,7 +111,7 @@ class Workbench extends Layout {
111
111
  );
112
112
  this.createWorkbenchLayout();
113
113
  this.layout();
114
- this.restore(instantiationService, lifecycleService);
114
+ this.restore(accessor);
115
115
  });
116
116
  return instantiationService;
117
117
  } catch (error) {
@@ -333,9 +333,10 @@ class Workbench extends Layout {
333
333
  ), () => notificationsToasts.isVisible || notificationsCenter.isVisible)
334
334
  });
335
335
  }
336
- restore(instantiationService, lifecycleService) {
336
+ restore(accessor) {
337
+ const lifecycleService = accessor.get(ILifecycleService);
337
338
  try {
338
- this.restoreParts(instantiationService);
339
+ this.restoreParts(accessor);
339
340
  } catch (error) {
340
341
  onUnexpectedError(error);
341
342
  }