@codingame/monaco-vscode-views-service-override 1.83.12 → 1.83.14

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.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- export { CustomViewOption, SimpleEditorInput, SimpleEditorPane, attachPart, default, isEditorPartVisible, isPartVisibile, onPartVisibilityChange, registerCustomView, registerEditor, registerEditorPane, registerEditorSerializer, renderActivitybarPar, renderAuxiliaryPart, renderEditorPart, renderPanelPart, renderPart, renderSidebarPart, renderStatusBarPart, setPartVisibility } from './views.js';
1
+ export { CustomViewOption, InitializationStateTransformer, SimpleEditorInput, SimpleEditorPane, attachPart, default, isEditorPartVisible, isPartVisibile, onPartVisibilityChange, registerCustomView, registerEditor, registerEditorPane, registerEditorSerializer, renderActivitybarPar, renderAuxiliaryPart, renderEditorPart, renderPanelPart, renderPart, renderSidebarPart, renderStatusBarPart, setPartVisibility } from './views.js';
2
2
  export { SidebarPart } from './vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js';
3
3
  export { ActivityService } from 'vscode/vscode/vs/workbench/services/activity/browser/activityService';
4
4
  export { ActivitybarPart } from './vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js';
5
5
  export { IReference } from 'vscode/vscode/vs/base/common/lifecycle';
6
6
  export { HoverService } from 'vscode/vscode/vs/workbench/services/hover/browser/hoverService';
7
7
  export { PanelPart } from './vscode/src/vs/workbench/browser/parts/panel/panelPart.js';
8
+ export { GroupOrientation } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
8
9
  export { EditorInputFactoryObject, RegisteredEditorInfo, RegisteredEditorOptions, RegisteredEditorPriority } from 'vscode/vscode/vs/workbench/services/editor/common/editorResolverService';
9
10
  export { IResolvedTextEditorModel } from 'vscode/vscode/vs/editor/common/services/resolverService';
10
11
  export { ConfirmResult } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
@@ -14,6 +15,7 @@ export { EditorInput, IEditorCloseHandler } from 'vscode/vscode/vs/workbench/com
14
15
  export { EditorInputCapabilities, IEditorSerializer } from 'vscode/vscode/vs/workbench/common/editor';
15
16
  export { EditorPane } from './vscode/src/vs/workbench/browser/parts/editor/editorPane.js';
16
17
  export { IEditorOptions } from 'vscode/vscode/vs/platform/editor/common/editor';
18
+ export { ILayoutInitializationState } from './vscode/src/vs/workbench/browser/layout.js';
17
19
  export { OpenEditor } from './tools/editor.js';
18
20
  export { Parts } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService';
19
21
  export { ViewContainerLocation } from 'vscode/vscode/vs/workbench/common/views';
package/index.js CHANGED
@@ -1,8 +1,7 @@
1
1
  export { SimpleEditorInput, SimpleEditorPane, attachPart, default, isEditorPartVisible, isPartVisibile, onPartVisibilityChange, registerCustomView, registerEditor, registerEditorPane, registerEditorSerializer, renderActivitybarPar, renderAuxiliaryPart, renderEditorPart, renderPanelPart, renderPart, renderSidebarPart, renderStatusBarPart, setPartVisibility } from './views.js';
2
2
  export { ViewContainerLocation } from 'vscode/vscode/vs/workbench/common/views';
3
- export { SidebarPart } from './vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js';
4
3
  export { ActivitybarPart } from './vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js';
5
- export { PanelPart } from './vscode/src/vs/workbench/browser/parts/panel/panelPart.js';
4
+ export { GroupOrientation } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
6
5
  export { RegisteredEditorPriority } from 'vscode/vscode/vs/workbench/services/editor/common/editorResolverService';
7
6
  export { EditorInputCapabilities } from 'vscode/vscode/vs/workbench/common/editor';
8
7
  export { Parts } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService';
@@ -13,3 +12,5 @@ export { ActivityService } from './vscode/src/vs/workbench/services/activity/bro
13
12
  export { EditorInput } from 'vscode/vscode/vs/workbench/common/editor/editorInput';
14
13
  export { EditorPane } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorPane';
15
14
  export { HoverService } from './vscode/src/vs/workbench/services/hover/browser/hoverService.js';
15
+ export { PanelPart } from './vscode/src/vs/workbench/browser/parts/panel/panelPart.js';
16
+ export { SidebarPart } from './vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-views-service-override",
3
- "version": "1.83.12",
3
+ "version": "1.83.14",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -18,14 +18,14 @@
18
18
  "module": "index.js",
19
19
  "types": "index.d.ts",
20
20
  "dependencies": {
21
- "vscode": "npm:@codingame/monaco-vscode-api@1.83.12",
21
+ "vscode": "npm:@codingame/monaco-vscode-api@1.83.14",
22
22
  "monaco-editor": "0.44.0",
23
- "@codingame/monaco-vscode-bulk-edit-service-override": "1.83.12",
24
- "@codingame/monaco-vscode-layout-service-override": "1.83.12",
25
- "@codingame/monaco-vscode-quickaccess-service-override": "1.83.12",
26
- "@codingame/monaco-vscode-keybindings-service-override": "1.83.12",
27
- "@codingame/monaco-vscode-environment-service-override": "1.83.12",
28
- "@codingame/monaco-vscode-extensions-service-override": "1.83.12",
29
- "@codingame/monaco-vscode-files-service-override": "1.83.12"
23
+ "@codingame/monaco-vscode-bulk-edit-service-override": "1.83.14",
24
+ "@codingame/monaco-vscode-layout-service-override": "1.83.14",
25
+ "@codingame/monaco-vscode-quickaccess-service-override": "1.83.14",
26
+ "@codingame/monaco-vscode-keybindings-service-override": "1.83.14",
27
+ "@codingame/monaco-vscode-environment-service-override": "1.83.14",
28
+ "@codingame/monaco-vscode-extensions-service-override": "1.83.14",
29
+ "@codingame/monaco-vscode-files-service-override": "1.83.14"
30
30
  }
31
31
  }
package/tools/editor.js CHANGED
@@ -215,10 +215,10 @@ let StandaloneEditorGroup = StandaloneEditorGroup_1 = class StandaloneEditorGrou
215
215
  this.closeEditors = unsupported;
216
216
  this.closeAllEditors = unsupported;
217
217
  this.replaceEditors = unsupported;
218
- this.pinEditor = unsupported;
219
- this.stickEditor = unsupported;
220
- this.unstickEditor = unsupported;
221
- this.lock = unsupported;
218
+ this.pinEditor = () => { };
219
+ this.stickEditor = () => { };
220
+ this.unstickEditor = () => { };
221
+ this.lock = () => { };
222
222
  this.isFirst = unsupported;
223
223
  this.isLast = unsupported;
224
224
  const onNewModel = (uri) => {
package/views.d.ts CHANGED
@@ -23,6 +23,7 @@ export { EditorInput, IEditorCloseHandler } from 'vscode/vscode/vs/workbench/com
23
23
  import { IEditorOpenContext, EditorInputCapabilities, Verbosity, IEditorSerializer } from 'vscode/vscode/vs/workbench/common/editor';
24
24
  export { EditorInputCapabilities, IEditorSerializer } from 'vscode/vscode/vs/workbench/common/editor';
25
25
  import { EditorPane } from './vscode/src/vs/workbench/browser/parts/editor/editorPane.js';
26
+ import { ILayoutInitializationState } from './vscode/src/vs/workbench/browser/layout.js';
26
27
  import { OpenEditor } from './tools/editor.js';
27
28
 
28
29
  declare function renderPart(partContainer: HTMLElement, part: Part): void;
@@ -107,6 +108,12 @@ interface CustomViewOption {
107
108
  }
108
109
  declare function registerCustomView(options: CustomViewOption): IDisposable;
109
110
  declare function isEditorPartVisible(): boolean;
110
- declare function getServiceOverride(openEditorFallback?: OpenEditor, _webviewIframeAlternateDomains?: string, _restoreEditorView?: boolean): IEditorOverrideServices;
111
+ type InitializationStateTransformer = (state: ILayoutInitializationState) => ILayoutInitializationState;
112
+ declare function getServiceOverride(openEditorFallback?: OpenEditor, _webviewIframeAlternateDomains?: string): IEditorOverrideServices;
113
+ /**
114
+ * @deprecated Provide restoreEditors with the initializationState.editor.restoreEditors params
115
+ */
116
+ declare function getServiceOverride(openEditorFallback?: OpenEditor, _webviewIframeAlternateDomains?: string, restoreEditors?: boolean): IEditorOverrideServices;
117
+ declare function getServiceOverride(openEditorFallback?: OpenEditor, _webviewIframeAlternateDomains?: string, initializationState?: InitializationStateTransformer): IEditorOverrideServices;
111
118
 
112
- export { type CustomViewOption, EditorPane, OpenEditor, SimpleEditorInput, SimpleEditorPane, attachPart, getServiceOverride as default, isEditorPartVisible, isPartVisibile, onPartVisibilityChange, registerCustomView, registerEditor, registerEditorPane, registerEditorSerializer, renderActivitybarPar, renderAuxiliaryPart, renderEditorPart, renderPanelPart, renderPart, renderSidebarPart, renderStatusBarPart, setPartVisibility };
119
+ export { type CustomViewOption, EditorPane, ILayoutInitializationState, type InitializationStateTransformer, OpenEditor, SimpleEditorInput, SimpleEditorPane, attachPart, getServiceOverride as default, isEditorPartVisible, isPartVisibile, onPartVisibilityChange, registerCustomView, registerEditor, registerEditorPane, registerEditorSerializer, renderActivitybarPar, renderAuxiliaryPart, renderEditorPart, renderPanelPart, renderPart, renderSidebarPart, renderStatusBarPart, setPartVisibility };
package/views.js CHANGED
@@ -5,7 +5,7 @@ import { IViewDescriptorService, Extensions, IViewsService } from 'vscode/vscode
5
5
  export { ViewContainerLocation } from 'vscode/vscode/vs/workbench/common/views';
6
6
  import { ViewsService } from 'vscode/vscode/vs/workbench/browser/parts/views/viewsService';
7
7
  import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
8
- export { SidebarPart } from './vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js';
8
+ import { SidebarPart } from './vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js';
9
9
  import { ViewDescriptorService } from './vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js';
10
10
  import { IActivityService } from 'vscode/vscode/vs/workbench/services/activity/common/activity';
11
11
  import { ActivityService } from './vscode/src/vs/workbench/services/activity/browser/activityService.js';
@@ -17,7 +17,7 @@ import { IHoverService } from 'vscode/vscode/vs/workbench/services/hover/browser
17
17
  import { HoverService } from './vscode/src/vs/workbench/services/hover/browser/hoverService.js';
18
18
  import { ExplorerService } from './vscode/src/vs/workbench/contrib/files/browser/explorerService.js';
19
19
  import { IExplorerService } from 'vscode/vscode/vs/workbench/contrib/files/browser/files';
20
- export { PanelPart } from './vscode/src/vs/workbench/browser/parts/panel/panelPart.js';
20
+ import { PanelPart } from './vscode/src/vs/workbench/browser/parts/panel/panelPart.js';
21
21
  import { size, $, append } from 'monaco-editor/esm/vs/base/browser/dom.js';
22
22
  import { ViewPane } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
23
23
  import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
@@ -45,6 +45,7 @@ import 'vscode/vscode/vs/workbench/contrib/files/browser/files.contribution';
45
45
  import './vscode/src/vs/workbench/contrib/files/browser/files.contribution2.js';
46
46
  import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
47
47
  import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
48
+ export { GroupOrientation } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
48
49
  import { IEditorDropService } from 'vscode/vscode/vs/workbench/services/editor/browser/editorDropService';
49
50
  import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
50
51
  import { IEditorResolverService } from 'vscode/vscode/vs/workbench/services/editor/common/editorResolverService';
@@ -56,7 +57,7 @@ import { ContextViewService } from 'monaco-editor/esm/vs/platform/contextview/br
56
57
  import { ICodeEditorService } from 'monaco-editor/esm/vs/editor/browser/services/codeEditorService.js';
57
58
  import { EditorInput } from 'vscode/vscode/vs/workbench/common/editor/editorInput';
58
59
  export { EditorInput } from 'vscode/vscode/vs/workbench/common/editor/editorInput';
59
- import { EditorExtensions } from 'vscode/vscode/vs/workbench/common/editor';
60
+ import { EditorExtensions, pathsToEditors, isResourceEditorInput } from 'vscode/vscode/vs/workbench/common/editor';
60
61
  export { EditorInputCapabilities } from 'vscode/vscode/vs/workbench/common/editor';
61
62
  import { ITextEditorService, TextEditorService } from 'vscode/vscode/vs/workbench/services/textfile/common/textEditorService';
62
63
  import { CodeEditorService } from 'vscode/vscode/vs/workbench/services/editor/browser/codeEditorService';
@@ -85,6 +86,7 @@ import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/commo
85
86
  import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
86
87
  import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
87
88
  export { ConfirmResult } from './override/vs/platform/dialogs/common/dialogs.js';
89
+ import { IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.js';
88
90
  import { ILayoutService } from 'monaco-editor/esm/vs/platform/layout/browser/layoutService.js';
89
91
  import { IBannerService } from 'vscode/vscode/vs/workbench/services/banner/browser/bannerService';
90
92
  import { ITitleService } from 'vscode/vscode/vs/workbench/services/title/common/titleService';
@@ -94,6 +96,18 @@ import { DomScrollableElement } from 'monaco-editor/esm/vs/base/browser/ui/scrol
94
96
  import { assertAllDefined, assertIsDefined } from 'monaco-editor/esm/vs/base/common/types.js';
95
97
  export { AbstractResourceEditorInput } from 'vscode/vscode/vs/workbench/common/editor/resourceEditorInput';
96
98
  export { AbstractTextResourceEditorInput } from 'vscode/vscode/vs/workbench/common/editor/textResourceEditorInput';
99
+ import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
100
+ import { AuxiliaryBarPart } from './vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js';
101
+ import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
102
+ import { mark } from 'monaco-editor/esm/vs/base/common/performance.js';
103
+ import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
104
+ import { Promises } from 'monaco-editor/esm/vs/base/common/async.js';
105
+ import { isWeb } from 'monaco-editor/esm/vs/base/common/platform.js';
106
+ import { IEnvironmentService } from 'monaco-editor/esm/vs/platform/environment/common/environment.js';
107
+ import { IWorkspaceContextService, isTemporaryWorkspace } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
108
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
109
+ import { coalesce } from 'monaco-editor/esm/vs/base/common/arrays.js';
110
+ import { IWorkingCopyBackupService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyBackup';
97
111
  import { MonacoEditorService, MonacoDelegateEditorGroupsService } from './tools/editor.js';
98
112
  import getServiceOverride$2 from '@codingame/monaco-vscode-bulk-edit-service-override';
99
113
  import getServiceOverride$1 from '@codingame/monaco-vscode-layout-service-override';
@@ -475,14 +489,169 @@ registerAssets({
475
489
  'vs/workbench/contrib/webview/browser/pre/index-no-csp.html': () => changeUrlDomain(new URL('./assets/index-no-csp.html', import.meta.url).href, webviewIframeAlternateDomains),
476
490
  'vs/workbench/contrib/webview/browser/pre/fake.html': () => changeUrlDomain(new URL('./assets/fake.html', import.meta.url).href, webviewIframeAlternateDomains)
477
491
  });
478
- let restoreEditorView = false;
492
+ let transformInitializationState = state => state;
479
493
  onRenderWorkbench(async (accessor) => {
480
494
  const paneCompositePartService = accessor.get(IPaneCompositePartService);
481
495
  const viewDescriptorService = accessor.get(IViewDescriptorService);
496
+ const lifecycleService = accessor.get(ILifecycleService);
497
+ const storageService = accessor.get(IStorageService);
498
+ const editorGroupService = accessor.get(IEditorGroupsService);
499
+ const editorService = accessor.get(IEditorService);
500
+ const logService = accessor.get(ILogService);
501
+ const extensionService = accessor.get(IExtensionService);
502
+ const environmentService = accessor.get(IEnvironmentService);
503
+ const contextService = accessor.get(IWorkspaceContextService);
504
+ const configurationService = accessor.get(IConfigurationService);
505
+ const fileService = accessor.get(IFileService);
506
+ const workingCopyBackupService = accessor.get(IWorkingCopyBackupService);
482
507
  const withStatusBar = accessor.get(IStatusbarService) instanceof Part;
483
508
  const withBannerPart = accessor.get(IBannerService) instanceof Part;
484
509
  const withTitlePart = accessor.get(ITitleService) instanceof Part;
485
510
  const layoutService = accessor.get(ILayoutService);
511
+ function getInitialEditorsState() {
512
+ const defaultLayout = environmentService.options?.defaultLayout;
513
+ if (((defaultLayout?.editors != null && defaultLayout.editors.length > 0) || defaultLayout?.layout?.editors != null) && ((defaultLayout.force ?? false) || storageService.isNew(1 ))) {
514
+ return {
515
+ layout: defaultLayout.layout?.editors,
516
+ filesToOpenOrCreate: defaultLayout.editors?.map(editor => {
517
+ return {
518
+ viewColumn: editor.viewColumn,
519
+ fileUri: URI.revive(editor.uri),
520
+ openOnlyIfExists: editor.openOnlyIfExists,
521
+ options: editor.options
522
+ };
523
+ })
524
+ };
525
+ }
526
+ const { filesToOpenOrCreate, filesToDiff, filesToMerge } = environmentService;
527
+ if (filesToOpenOrCreate != null || filesToDiff != null || filesToMerge != null) {
528
+ return { filesToOpenOrCreate, filesToDiff, filesToMerge };
529
+ }
530
+ return undefined;
531
+ }
532
+ function getDefaultLayoutViews(environmentService, storageService) {
533
+ const defaultLayout = environmentService.options?.defaultLayout;
534
+ if (defaultLayout == null) {
535
+ return undefined;
536
+ }
537
+ if (!(defaultLayout.force ?? false) && !storageService.isNew(1 )) {
538
+ return undefined;
539
+ }
540
+ const { views } = defaultLayout;
541
+ if (views != null && views.length > 0) {
542
+ return ( views.map(view => view.id));
543
+ }
544
+ return undefined;
545
+ }
546
+ function shouldRestoreEditors(contextService, initialEditorsState) {
547
+ if (isTemporaryWorkspace(contextService.getWorkspace())) {
548
+ return false;
549
+ }
550
+ const forceRestoreEditors = configurationService.getValue('window.restoreWindows') === 'preserve';
551
+ return !!forceRestoreEditors || initialEditorsState === undefined;
552
+ }
553
+ async function resolveEditorsToOpen(fileService, initialEditorsState) {
554
+ if (initialEditorsState != null) {
555
+ const filesToMerge = coalesce(await pathsToEditors(initialEditorsState.filesToMerge, fileService, logService));
556
+ if (filesToMerge.length === 4 && isResourceEditorInput(filesToMerge[0]) && isResourceEditorInput(filesToMerge[1]) && isResourceEditorInput(filesToMerge[2]) && isResourceEditorInput(filesToMerge[3])) {
557
+ return [{
558
+ editor: {
559
+ input1: { resource: filesToMerge[0].resource },
560
+ input2: { resource: filesToMerge[1].resource },
561
+ base: { resource: filesToMerge[2].resource },
562
+ result: { resource: filesToMerge[3].resource },
563
+ options: { pinned: true }
564
+ }
565
+ }];
566
+ }
567
+ const filesToDiff = coalesce(await pathsToEditors(initialEditorsState.filesToDiff, fileService, logService));
568
+ if (filesToDiff.length === 2) {
569
+ return [{
570
+ editor: {
571
+ original: { resource: filesToDiff[0].resource },
572
+ modified: { resource: filesToDiff[1].resource },
573
+ options: { pinned: true }
574
+ }
575
+ }];
576
+ }
577
+ const filesToOpenOrCreate = [];
578
+ const resolvedFilesToOpenOrCreate = await pathsToEditors(initialEditorsState.filesToOpenOrCreate, fileService, logService);
579
+ for (let i = 0; i < resolvedFilesToOpenOrCreate.length; i++) {
580
+ const resolvedFileToOpenOrCreate = resolvedFilesToOpenOrCreate[i];
581
+ if (resolvedFileToOpenOrCreate != null) {
582
+ filesToOpenOrCreate.push({
583
+ editor: resolvedFileToOpenOrCreate,
584
+ viewColumn: initialEditorsState.filesToOpenOrCreate?.[i].viewColumn
585
+ });
586
+ }
587
+ }
588
+ return filesToOpenOrCreate;
589
+ }
590
+ else if (contextService.getWorkbenchState() === 1 && configurationService.getValue('workbench.startupEditor') === 'newUntitledFile') {
591
+ if (editorGroupService.hasRestorableState) {
592
+ return [];
593
+ }
594
+ const hasBackups = await workingCopyBackupService.hasBackups();
595
+ if (hasBackups) {
596
+ return [];
597
+ }
598
+ return [{
599
+ editor: { resource: undefined }
600
+ }];
601
+ }
602
+ return [];
603
+ }
604
+ const initialEditorsState = getInitialEditorsState();
605
+ if (initialEditorsState != null) {
606
+ logService.info('Initial editor state', initialEditorsState);
607
+ }
608
+ let initialLayoutState = {
609
+ layout: {
610
+ editors: initialEditorsState?.layout
611
+ },
612
+ editor: {
613
+ restoreEditors: shouldRestoreEditors(contextService, initialEditorsState),
614
+ editorsToOpen: resolveEditorsToOpen(fileService, initialEditorsState)
615
+ },
616
+ views: {
617
+ defaults: getDefaultLayoutViews(environmentService, storageService),
618
+ containerToRestore: {}
619
+ }
620
+ };
621
+ function getDefaultViewContainer(location) {
622
+ return viewDescriptorService.getDefaultViewContainer(location) ?? viewDescriptorService.getViewContainersByLocation(location)[0];
623
+ }
624
+ function initLayoutState() {
625
+ if (layoutService.isVisible("workbench.parts.sidebar" )) {
626
+ let viewContainerToRestore;
627
+ if (!environmentService.isBuilt || lifecycleService.startupKind === 3 || isWeb) {
628
+ viewContainerToRestore = storageService.get(SidebarPart.activeViewletSettingsKey, 1 , getDefaultViewContainer(0 )?.id);
629
+ }
630
+ else {
631
+ viewContainerToRestore = getDefaultViewContainer(0 )?.id;
632
+ }
633
+ initialLayoutState.views.containerToRestore.sideBar = viewContainerToRestore;
634
+ }
635
+ if (layoutService.isVisible("workbench.parts.panel" )) {
636
+ const viewContainerToRestore = storageService.get(PanelPart.activePanelSettingsKey, 1 , getDefaultViewContainer(1 )?.id);
637
+ initialLayoutState.views.containerToRestore.panel = viewContainerToRestore;
638
+ }
639
+ if (layoutService.isVisible("workbench.parts.auxiliarybar" )) {
640
+ const viewContainerToRestore = storageService.get(AuxiliaryBarPart.activePanelSettingsKey, 1 , getDefaultViewContainer(2 )?.id);
641
+ initialLayoutState.views.containerToRestore.auxiliaryBar = viewContainerToRestore;
642
+ }
643
+ }
644
+ initLayoutState();
645
+ initialLayoutState = transformInitializationState(initialLayoutState);
646
+ if (initialLayoutState.views.containerToRestore.sideBar == null) {
647
+ layoutService.setPartHidden(true, "workbench.parts.sidebar" );
648
+ }
649
+ if (initialLayoutState.views.containerToRestore.panel == null) {
650
+ layoutService.setPartHidden(true, "workbench.parts.panel" );
651
+ }
652
+ if (initialLayoutState.views.containerToRestore.auxiliaryBar == null) {
653
+ layoutService.setPartHidden(true, "workbench.parts.auxiliarybar" );
654
+ }
486
655
  const invisibleContainer = document.createElement('div');
487
656
  invisibleContainer.style.display = 'none';
488
657
  document.body.append(invisibleContainer);
@@ -491,7 +660,7 @@ onRenderWorkbench(async (accessor) => {
491
660
  { id: "workbench.parts.banner" , role: 'banner', classes: ['banner'], enabled: withBannerPart },
492
661
  { id: "workbench.parts.activitybar" , role: 'none', classes: ['activitybar', 'left'] },
493
662
  { id: "workbench.parts.sidebar" , role: 'none', classes: ['sidebar', 'left'] },
494
- { id: "workbench.parts.editor" , role: 'main', classes: ['editor'], options: { restorePreviousState: restoreEditorView } },
663
+ { id: "workbench.parts.editor" , role: 'main', classes: ['editor'], options: { restorePreviousState: initialLayoutState.editor.restoreEditors } },
495
664
  { id: "workbench.parts.panel" , role: 'none', classes: ['panel', 'basepanel', positionToString(2 )] },
496
665
  { id: "workbench.parts.auxiliarybar" , role: 'none', classes: ['auxiliarybar', 'basepanel', 'right'] },
497
666
  { id: "workbench.parts.statusbar" , role: 'status', classes: ['statusbar'], enabled: withStatusBar }
@@ -503,18 +672,140 @@ onRenderWorkbench(async (accessor) => {
503
672
  const part = layoutService.getPart(id);
504
673
  part.create(partContainer, options);
505
674
  renderPart(partContainer, part);
675
+ part.layout(9999, 9999, 0, 0);
506
676
  invisibleContainer.append(partContainer);
507
677
  }
508
- await paneCompositePartService.openPaneComposite(viewDescriptorService.getDefaultViewContainer(0 )?.id, 0 );
509
- await paneCompositePartService.openPaneComposite(viewDescriptorService.getDefaultViewContainer(1 )?.id, 1 );
510
- await paneCompositePartService.openPaneComposite(viewDescriptorService.getDefaultViewContainer(2 )?.id, 2 );
678
+ const layoutReadyPromises = [];
679
+ const layoutRestoredPromises = [];
680
+ layoutReadyPromises.push((async () => {
681
+ mark('code/willRestoreEditors');
682
+ await editorGroupService.whenReady;
683
+ mark('code/restoreEditors/editorGroupsReady');
684
+ if (initialLayoutState.layout?.editors != null) {
685
+ editorGroupService.applyLayout(initialLayoutState.layout.editors);
686
+ }
687
+ const editors = await initialLayoutState.editor.editorsToOpen;
688
+ mark('code/restoreEditors/editorsToOpenResolved');
689
+ let openEditorsPromise;
690
+ if (editors.length > 0) {
691
+ const editorGroupsInVisualOrder = editorGroupService.getGroups(2 );
692
+ const mapEditorsToGroup = new Map();
693
+ for (const editor of editors) {
694
+ const group = editorGroupsInVisualOrder[(editor.viewColumn ?? 1) - 1];
695
+ let editorsByGroup = mapEditorsToGroup.get(group.id);
696
+ if (editorsByGroup == null) {
697
+ editorsByGroup = new Set();
698
+ mapEditorsToGroup.set(group.id, editorsByGroup);
699
+ }
700
+ editorsByGroup.add(editor.editor);
701
+ }
702
+ openEditorsPromise = Promise.all(( Array.from(mapEditorsToGroup).map(async ([groupId, editors]) => {
703
+ try {
704
+ await editorService.openEditors(Array.from(editors), groupId, { validateTrust: true });
705
+ }
706
+ catch (error) {
707
+ logService.error(error);
708
+ }
709
+ })));
710
+ }
711
+ layoutRestoredPromises.push(Promise.all([
712
+ openEditorsPromise?.finally(() => mark('code/restoreEditors/editorsOpened')),
713
+ editorGroupService.whenRestored.finally(() => mark('code/restoreEditors/editorGroupsRestored'))
714
+ ]).finally(() => {
715
+ mark('code/didRestoreEditors');
716
+ }));
717
+ })());
718
+ const restoreDefaultViewsPromise = (async () => {
719
+ if (initialLayoutState.views.defaults != null && initialLayoutState.views.defaults.length > 0) {
720
+ mark('code/willOpenDefaultViews');
721
+ const tryOpenView = (view) => {
722
+ const location = viewDescriptorService.getViewLocationById(view.id);
723
+ if (location !== null) {
724
+ const container = viewDescriptorService.getViewContainerByViewId(view.id);
725
+ if (container != null) {
726
+ const containerModel = viewDescriptorService.getViewContainerModel(container);
727
+ containerModel.setCollapsed(view.id, false);
728
+ containerModel.setVisible(view.id, true);
729
+ return true;
730
+ }
731
+ }
732
+ return false;
733
+ };
734
+ const defaultViews = ( [...initialLayoutState.views.defaults].reverse().map((v, index) => ({ id: v, order: index })));
735
+ let i = defaultViews.length;
736
+ while (i > 0) {
737
+ i--;
738
+ if (tryOpenView(defaultViews[i])) {
739
+ defaultViews.splice(i, 1);
740
+ }
741
+ }
742
+ if (defaultViews.length > 0) {
743
+ await extensionService.whenInstalledExtensionsRegistered();
744
+ let i = defaultViews.length;
745
+ while (i > 0) {
746
+ i--;
747
+ if (tryOpenView(defaultViews[i])) {
748
+ defaultViews.splice(i, 1);
749
+ }
750
+ }
751
+ }
752
+ mark('code/didOpenDefaultViews');
753
+ }
754
+ })();
755
+ layoutReadyPromises.push(restoreDefaultViewsPromise);
756
+ layoutReadyPromises.push((async () => {
757
+ await restoreDefaultViewsPromise;
758
+ if (initialLayoutState.views.containerToRestore.sideBar == null) {
759
+ return;
760
+ }
761
+ mark('code/willRestoreViewlet');
762
+ const viewlet = await paneCompositePartService.openPaneComposite(initialLayoutState.views.containerToRestore.sideBar, 0 );
763
+ if (viewlet == null) {
764
+ await paneCompositePartService.openPaneComposite(getDefaultViewContainer(0 )?.id, 0 );
765
+ }
766
+ mark('code/didRestoreViewlet');
767
+ })());
768
+ layoutReadyPromises.push((async () => {
769
+ await restoreDefaultViewsPromise;
770
+ if (initialLayoutState.views.containerToRestore.panel == null) {
771
+ return;
772
+ }
773
+ mark('code/willRestorePanel');
774
+ const panel = await paneCompositePartService.openPaneComposite(initialLayoutState.views.containerToRestore.panel, 1 );
775
+ if (panel == null) {
776
+ await paneCompositePartService.openPaneComposite(getDefaultViewContainer(1 )?.id, 1 );
777
+ }
778
+ mark('code/didRestorePanel');
779
+ })());
780
+ layoutReadyPromises.push((async () => {
781
+ await restoreDefaultViewsPromise;
782
+ if (initialLayoutState.views.containerToRestore.auxiliaryBar == null) {
783
+ return;
784
+ }
785
+ mark('code/willRestoreAuxiliaryBar');
786
+ const panel = await paneCompositePartService.openPaneComposite(initialLayoutState.views.containerToRestore.auxiliaryBar, 2 );
787
+ if (panel == null) {
788
+ await paneCompositePartService.openPaneComposite(getDefaultViewContainer(2 )?.id, 2 );
789
+ }
790
+ mark('code/didRestoreAuxiliaryBar');
791
+ })());
792
+ await Promises.settled(layoutReadyPromises);
793
+ await Promises.settled(layoutRestoredPromises);
511
794
  });
512
- function getServiceOverride(openEditorFallback, _webviewIframeAlternateDomains, _restoreEditorView) {
795
+ function getServiceOverride(openEditorFallback, _webviewIframeAlternateDomains, initializationStateOrRestoreEditors) {
513
796
  if (_webviewIframeAlternateDomains != null) {
514
797
  webviewIframeAlternateDomains = _webviewIframeAlternateDomains;
515
798
  }
516
- if (_restoreEditorView != null) {
517
- restoreEditorView = _restoreEditorView;
799
+ if (initializationStateOrRestoreEditors != null) {
800
+ transformInitializationState = typeof initializationStateOrRestoreEditors === 'boolean'
801
+ ? (state) => ({
802
+ ...state,
803
+ editor: {
804
+ ...state.editor,
805
+ restoreEditors: initializationStateOrRestoreEditors
806
+ }
807
+ })
808
+ : initializationStateOrRestoreEditors;
518
809
  }
519
810
  return {
520
811
  ...getServiceOverride$1(),
@@ -551,4 +842,4 @@ function getServiceOverride(openEditorFallback, _webviewIframeAlternateDomains,
551
842
  };
552
843
  }
553
844
 
554
- export { ActivityService, HoverService, SimpleEditorInput, SimpleEditorPane, attachPart, getServiceOverride as default, isEditorPartVisible, isPartVisibile, onPartVisibilityChange, registerCustomView, registerEditor, registerEditorPane, registerEditorSerializer, renderActivitybarPar, renderAuxiliaryPart, renderEditorPart, renderPanelPart, renderPart, renderSidebarPart, renderStatusBarPart, setPartVisibility };
845
+ export { ActivityService, HoverService, PanelPart, SidebarPart, SimpleEditorInput, SimpleEditorPane, attachPart, getServiceOverride as default, isEditorPartVisible, isPartVisibile, onPartVisibilityChange, registerCustomView, registerEditor, registerEditorPane, registerEditorSerializer, renderActivitybarPar, renderAuxiliaryPart, renderEditorPart, renderPanelPart, renderPart, renderSidebarPart, renderStatusBarPart, setPartVisibility };
@@ -0,0 +1,26 @@
1
+ import { IUntypedEditorInput } from 'vscode/vscode/vs/workbench/common/editor';
2
+ import { EditorGroupLayout } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
3
+
4
+ interface IEditorToOpen {
5
+ readonly editor: IUntypedEditorInput;
6
+ readonly viewColumn?: number;
7
+ }
8
+ interface ILayoutInitializationState {
9
+ readonly views: {
10
+ readonly defaults: string[] | undefined;
11
+ readonly containerToRestore: {
12
+ sideBar?: string;
13
+ panel?: string;
14
+ auxiliaryBar?: string;
15
+ };
16
+ };
17
+ readonly editor: {
18
+ readonly restoreEditors: boolean;
19
+ readonly editorsToOpen: Promise<IEditorToOpen[]>;
20
+ };
21
+ readonly layout?: {
22
+ readonly editors?: EditorGroupLayout;
23
+ };
24
+ }
25
+
26
+ export type { IEditorToOpen, ILayoutInitializationState };
@@ -1,6 +1,6 @@
1
1
  import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
2
  import { Disposable, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
3
- import { isMacintosh, isWeb } from 'monaco-editor/esm/vs/base/common/platform.js';
3
+ import { isMacintosh, isWeb, OS } from 'monaco-editor/esm/vs/base/common/platform.js';
4
4
  import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
5
5
  import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
6
6
  import * as nls from 'monaco-editor/esm/vs/nls.js';
@@ -8,8 +8,10 @@ import { IWorkspaceContextService } from 'monaco-editor/esm/vs/platform/workspac
8
8
  import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
9
9
  import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
10
10
  import { h, append, $, clearNode } from 'monaco-editor/esm/vs/base/browser/dom.js';
11
+ import { KeybindingLabel } from 'monaco-editor/esm/vs/base/browser/ui/keybindingLabel/keybindingLabel.js';
11
12
  import { CommandsRegistry } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
12
13
  import { ContextKeyExpr, IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
14
+ import { defaultKeybindingLabelStyles } from 'monaco-editor/esm/vs/platform/theme/browser/defaultStyles.js';
13
15
 
14
16
  const showCommands = { text: ( nls.localizeWithPath(
15
17
  'vs/workbench/browser/parts/editor/editorGroupWatermark',
@@ -145,12 +147,28 @@ let EditorGroupWatermark = class EditorGroupWatermark extends Disposable {
145
147
  }
146
148
  const box = append(this.shortcuts, $('.watermark-box'));
147
149
  const folder = this.workbenchState !== 1 ;
148
- (folder ? folderEntries : noFolderEntries)
150
+ const selected = (folder ? folderEntries : noFolderEntries)
149
151
  .filter(entry => !('when' in entry) || this.contextKeyService.contextMatchesRules(entry.when))
150
152
  .filter(entry => !('mac' in entry) || entry.mac === (isMacintosh && !isWeb))
151
153
  .filter(entry => !!CommandsRegistry.getCommand(entry.id));
152
154
  const update = () => {
153
155
  clearNode(box);
156
+ selected.forEach(entry => {
157
+ const keys = this.keybindingService.lookupKeybinding(entry.id);
158
+ if (!keys) {
159
+ return;
160
+ }
161
+ const dl = append(box, $('dl'));
162
+ const dt = append(dl, $('dt'));
163
+ dt.textContent = entry.text;
164
+ const dd = append(dl, $('dd'));
165
+ const keybinding = ( new KeybindingLabel(
166
+ dd,
167
+ OS,
168
+ { renderUnboundKeybindings: true, ...defaultKeybindingLabelStyles }
169
+ ));
170
+ keybinding.set(keys);
171
+ });
154
172
  };
155
173
  update();
156
174
  this.transientDisposables.add(this.keybindingService.onDidUpdateKeybindings(update));