@codingame/monaco-vscode-api 1.81.2 → 1.81.3-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,47 @@
1
+ import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
2
+ import { Extensions } from './vscode/vs/workbench/common/contributions.js';
3
+ import { ILifecycleService } from './vscode/vs/workbench/services/lifecycle/common/lifecycle.js';
4
+ import { Barrier, RunOnceScheduler, runWhenIdle } from 'monaco-editor/esm/vs/base/common/async.js';
5
+ import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
6
+ const renderWorkbenchEmitter = new Emitter();
7
+ const onRenderWorkbench = renderWorkbenchEmitter.event;
8
+ const serviceInitializedBarrier = new Barrier();
9
+ const serviceInitializePreParticipants = [];
10
+ const serviceInitializeParticipants = [];
11
+ const serviceInitializePostParticipants = [];
12
+ function registerServiceInitializePreParticipant(participant) {
13
+ serviceInitializePreParticipants.push(participant);
14
+ }
15
+ function registerServiceInitializeParticipant(participant) {
16
+ serviceInitializeParticipants.push(participant);
17
+ }
18
+ function registerServiceInitializePostParticipant(participant) {
19
+ serviceInitializePostParticipants.push(participant);
20
+ }
21
+ async function startup(instantiationService) {
22
+ await instantiationService.invokeFunction(async (accessor) => {
23
+ await Promise.all(( serviceInitializePreParticipants.map(participant => participant(accessor))));
24
+ });
25
+ await instantiationService.invokeFunction(async (accessor) => {
26
+ const lifecycleService = accessor.get(ILifecycleService);
27
+ await Promise.all(( serviceInitializeParticipants.map(participant => participant(accessor))));
28
+ lifecycleService.phase = 2 ;
29
+ });
30
+ await instantiationService.invokeFunction(async (accessor) => {
31
+ await Promise.all(( serviceInitializePostParticipants.map(participant => participant(accessor))));
32
+ });
33
+ serviceInitializedBarrier.open();
34
+ instantiationService.invokeFunction(accessor => {
35
+ const lifecycleService = accessor.get(ILifecycleService);
36
+ ( Registry.as(Extensions.Workbench)).start(accessor);
37
+ renderWorkbenchEmitter.fire(accessor);
38
+ lifecycleService.phase = 3 ;
39
+ const eventuallyPhaseScheduler = new RunOnceScheduler(() => {
40
+ runWhenIdle(() => {
41
+ lifecycleService.phase = 4 ;
42
+ }, 2500);
43
+ }, 2500);
44
+ eventuallyPhaseScheduler.schedule();
45
+ });
46
+ }
47
+ export { onRenderWorkbench, registerServiceInitializeParticipant, registerServiceInitializePostParticipant, registerServiceInitializePreParticipant, serviceInitializedBarrier, startup };
@@ -33,7 +33,7 @@ import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
33
33
  import '../vscode/vs/workbench/api/common/configurationExtensionPoint.js';
34
34
  import getServiceOverride$1 from './files.js';
35
35
  import { memoizedConstructor, unsupported } from '../tools.js';
36
- import { registerServiceInitializePreParticipant } from '../services.js';
36
+ import { registerServiceInitializePreParticipant } from '../lifecycle.js';
37
37
  async function updateUserConfiguration(configurationJson) {
38
38
  const userDataProfilesService = StandaloneServices.get(IUserDataProfilesService);
39
39
  await StandaloneServices.get(IFileService).writeFile(userDataProfilesService.defaultProfile.settingsResource, VSBuffer.fromString(configurationJson));
@@ -1,17 +1,46 @@
1
1
  import { IEditorOverrideServices } from '../vscode/vs/editor/standalone/browser/standaloneServices.js';
2
- import { IWorkbenchLayoutService, Position, Parts } from '../vscode/vs/workbench/services/layout/browser/layoutService.js';
2
+ import { IWorkbenchLayoutService, Parts, PanelAlignment, Position } from '../vscode/vs/workbench/services/layout/browser/layoutService.js';
3
3
  import { ILayoutService, ILayoutOffsetInfo } from '../vscode/vs/platform/layout/browser/layoutService.js';
4
4
  import { Event } from '../vscode/vs/base/common/event.js';
5
5
  import { Dimension, IDimension } from '../vscode/vs/base/browser/dom.js';
6
6
  import { Part } from '../vscode/vs/workbench/browser/part.js';
7
- import { IPaneCompositePartService } from '../vscode/vs/workbench/services/panecomposite/browser/panecomposite.js';
7
+ import { ServicesAccessor } from '../vscode/vs/platform/instantiation/common/instantiation.js';
8
8
 
9
- declare class LayoutService implements ILayoutService, Pick<IWorkbenchLayoutService, 'isVisible' | 'onDidChangePartVisibility' | 'isRestored' | 'registerPart' | 'getSideBarPosition' | 'setPartHidden' | 'hasFocus' | 'getPanelPosition' | 'isPanelMaximized' | 'getMaximumEditorDimensions' | 'onDidChangeFullscreen'> {
9
+ declare class LayoutService implements ILayoutService, IWorkbenchLayoutService {
10
10
  container: HTMLElement;
11
- private paneCompositeService;
12
11
  readonly _serviceBrand: undefined;
13
- constructor(container: HTMLElement, paneCompositeService: IPaneCompositePartService);
12
+ private paneCompositeService;
13
+ private editorGroupService;
14
+ private statusBarService;
15
+ private viewDescriptorService;
16
+ constructor(container: HTMLElement);
14
17
  onDidChangeFullscreen: Event<any>;
18
+ onDidChangeZenMode: Event<any>;
19
+ onDidChangeWindowMaximized: Event<any>;
20
+ onDidChangeCenteredLayout: Event<any>;
21
+ onDidChangePanelPosition: Event<any>;
22
+ onDidChangePanelAlignment: Event<any>;
23
+ onDidChangeNotificationsVisibility: Event<any>;
24
+ openedDefaultEditors: boolean;
25
+ whenRestored: Promise<void>;
26
+ init(accessor: ServicesAccessor): void;
27
+ focusPart(part: Parts): void;
28
+ getDimension(part: Parts): Dimension | undefined;
29
+ toggleMaximizedPanel(): void;
30
+ hasWindowBorder(): boolean;
31
+ getWindowBorderWidth(): number;
32
+ getWindowBorderRadius(): string | undefined;
33
+ toggleMenuBar(): void;
34
+ setPanelPosition(): void;
35
+ getPanelAlignment(): PanelAlignment;
36
+ setPanelAlignment(): void;
37
+ toggleZenMode(): void;
38
+ isEditorLayoutCentered(): boolean;
39
+ centerEditorLayout(): void;
40
+ resizePart(): void;
41
+ isWindowMaximized(): boolean;
42
+ updateWindowMaximizedState(): void;
43
+ getVisibleNeighborPart(): Parts | undefined;
15
44
  getMaximumEditorDimensions(): Dimension;
16
45
  isPanelMaximized(): boolean;
17
46
  getPanelPosition(): Position;
@@ -20,6 +49,7 @@ declare class LayoutService implements ILayoutService, Pick<IWorkbenchLayoutServ
20
49
  getContainer(part: Parts): HTMLElement | undefined;
21
50
  getPart(key: Parts): Part;
22
51
  private hiddenParts;
52
+ private hasViews;
23
53
  setPartHidden(hidden: boolean, part: Exclude<Parts, Parts.STATUSBAR_PART | Parts.TITLEBAR_PART>): void;
24
54
  isVisible(part: Parts): boolean;
25
55
  getSideBarPosition(): Position;
@@ -1,4 +1,3 @@
1
- import { __decorate, __param } from '../node_modules/tslib/tslib.es6.js';
2
1
  import '../missing-services.js';
3
2
  import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
4
3
  import { IWorkbenchLayoutService } from '../vscode/vs/workbench/services/layout/browser/layoutService.js';
@@ -9,13 +8,24 @@ import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
9
8
  import { isAncestorUsingFlowTo } from 'monaco-editor/esm/vs/base/browser/dom.js';
10
9
  import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
11
10
  import { IPaneCompositePartService } from '../vscode/vs/workbench/services/panecomposite/browser/panecomposite.js';
11
+ import { IViewDescriptorService } from '../vscode/vs/workbench/common/views.js';
12
12
  import { isChrome, isFirefox, isSafari, isWindows, isLinux } from 'monaco-editor/esm/vs/base/common/platform.js';
13
13
  import { coalesce } from 'monaco-editor/esm/vs/base/common/arrays.js';
14
- let LayoutService = class LayoutService {
15
- constructor(container, paneCompositeService) {
14
+ import { IEditorGroupsService } from '../vscode/vs/workbench/services/editor/common/editorGroupsService.js';
15
+ import { IStatusbarService } from '../vscode/vs/workbench/services/statusbar/browser/statusbar.js';
16
+ import { onRenderWorkbench } from '../lifecycle.js';
17
+ class LayoutService {
18
+ constructor(container) {
16
19
  this.container = container;
17
- this.paneCompositeService = paneCompositeService;
18
20
  this.onDidChangeFullscreen = Event.None;
21
+ this.onDidChangeZenMode = Event.None;
22
+ this.onDidChangeWindowMaximized = Event.None;
23
+ this.onDidChangeCenteredLayout = Event.None;
24
+ this.onDidChangePanelPosition = Event.None;
25
+ this.onDidChangePanelAlignment = Event.None;
26
+ this.onDidChangeNotificationsVisibility = Event.None;
27
+ this.openedDefaultEditors = false;
28
+ this.whenRestored = Promise.resolve();
19
29
  this.parts = new Map();
20
30
  this.hiddenParts = new Set();
21
31
  this._onDidChangePartVisibility = new Emitter();
@@ -26,6 +36,79 @@ let LayoutService = class LayoutService {
26
36
  window.addEventListener('resize', () => this.layout());
27
37
  this.layout();
28
38
  }
39
+ init(accessor) {
40
+ this.editorGroupService = accessor.get(IEditorGroupsService);
41
+ this.paneCompositeService = accessor.get(IPaneCompositePartService);
42
+ this.statusBarService = accessor.get(IStatusbarService);
43
+ this.viewDescriptorService = accessor.get(IViewDescriptorService);
44
+ }
45
+ focusPart(part) {
46
+ switch (part) {
47
+ case "workbench.parts.editor" :
48
+ this.editorGroupService.activeGroup.focus();
49
+ break;
50
+ case "workbench.parts.panel" : {
51
+ const activePanel = this.paneCompositeService.getActivePaneComposite(1 );
52
+ activePanel?.focus();
53
+ break;
54
+ }
55
+ case "workbench.parts.sidebar" : {
56
+ const activeViewlet = this.paneCompositeService.getActivePaneComposite(0 );
57
+ activeViewlet?.focus();
58
+ break;
59
+ }
60
+ case "workbench.parts.activitybar" :
61
+ this.getPart("workbench.parts.activitybar" ).focus();
62
+ break;
63
+ case "workbench.parts.statusbar" :
64
+ this.statusBarService.focus();
65
+ break;
66
+ default: {
67
+ const container = this.getContainer(part);
68
+ container?.focus();
69
+ }
70
+ }
71
+ }
72
+ getDimension(part) {
73
+ return this.getPart(part).dimension;
74
+ }
75
+ toggleMaximizedPanel() {
76
+ }
77
+ hasWindowBorder() {
78
+ return false;
79
+ }
80
+ getWindowBorderWidth() {
81
+ return 0;
82
+ }
83
+ getWindowBorderRadius() {
84
+ return undefined;
85
+ }
86
+ toggleMenuBar() {
87
+ }
88
+ setPanelPosition() {
89
+ }
90
+ getPanelAlignment() {
91
+ return 'left';
92
+ }
93
+ setPanelAlignment() {
94
+ }
95
+ toggleZenMode() {
96
+ }
97
+ isEditorLayoutCentered() {
98
+ return false;
99
+ }
100
+ centerEditorLayout() {
101
+ }
102
+ resizePart() {
103
+ }
104
+ isWindowMaximized() {
105
+ return false;
106
+ }
107
+ updateWindowMaximizedState() {
108
+ }
109
+ getVisibleNeighborPart() {
110
+ return undefined;
111
+ }
29
112
  getMaximumEditorDimensions() {
30
113
  return new dom.Dimension(Infinity, Infinity);
31
114
  }
@@ -56,6 +139,17 @@ let LayoutService = class LayoutService {
56
139
  }
57
140
  return part;
58
141
  }
142
+ hasViews(id) {
143
+ const viewContainer = this.viewDescriptorService.getViewContainerById(id);
144
+ if (viewContainer == null) {
145
+ return false;
146
+ }
147
+ const viewContainerModel = this.viewDescriptorService.getViewContainerModel(viewContainer);
148
+ if (viewContainerModel == null) {
149
+ return false;
150
+ }
151
+ return viewContainerModel.activeViewDescriptors.length >= 1;
152
+ }
59
153
  setPartHidden(hidden, part) {
60
154
  if (hidden) {
61
155
  this.hiddenParts.add(part);
@@ -71,18 +165,24 @@ let LayoutService = class LayoutService {
71
165
  }[part];
72
166
  if (location != null) {
73
167
  const paneComposite = this.paneCompositeService.getActivePaneComposite(location);
74
- if (paneComposite != null) {
75
- if (hidden) {
76
- this.paneCompositeService.hideActivePaneComposite(location);
168
+ if (paneComposite != null && hidden) {
169
+ this.paneCompositeService.hideActivePaneComposite(location);
170
+ }
171
+ else if (paneComposite == null && !hidden) {
172
+ let panelToOpen = this.paneCompositeService.getLastActivePaneCompositeId(location);
173
+ if (panelToOpen == null || !this.hasViews(panelToOpen)) {
174
+ panelToOpen = this.viewDescriptorService
175
+ .getViewContainersByLocation(1 )
176
+ .find(viewContainer => this.hasViews(viewContainer.id))?.id;
177
+ }
178
+ if (panelToOpen != null) {
179
+ void this.paneCompositeService.openPaneComposite(panelToOpen, 1 , true);
77
180
  }
78
181
  }
79
182
  if (this.paneCompositeService.getPartByLocation != null) {
80
183
  this.paneCompositeService.getPartByLocation(location).setVisible(!hidden);
81
184
  }
82
185
  }
83
- setTimeout(() => {
84
- this.setPartHidden(false, part);
85
- });
86
186
  }
87
187
  isVisible(part) {
88
188
  return !( this.hiddenParts.has(part));
@@ -107,10 +207,13 @@ let LayoutService = class LayoutService {
107
207
  focus() {
108
208
  StandaloneServices.get(ICodeEditorService).getFocusedCodeEditor()?.focus();
109
209
  }
110
- };
111
- LayoutService = __decorate([
112
- ( __param(1, IPaneCompositePartService))
113
- ], LayoutService);
210
+ }
211
+ onRenderWorkbench((accessor) => {
212
+ const layoutService = accessor.get(ILayoutService);
213
+ if (layoutService instanceof LayoutService) {
214
+ layoutService.init(accessor);
215
+ }
216
+ });
114
217
  function getServiceOverride(container = document.body) {
115
218
  const platformClass = isWindows ? 'windows' : isLinux ? 'linux' : 'mac';
116
219
  const workbenchClasses = coalesce([
@@ -11,7 +11,7 @@ import { NotificationsAlerts } from '../vscode/vs/workbench/browser/parts/notifi
11
11
  import { NotificationsTelemetry } from '../vscode/vs/workbench/browser/parts/notifications/notificationsTelemetry.js';
12
12
  import { ILayoutService } from 'monaco-editor/esm/vs/platform/layout/browser/layoutService.js';
13
13
  import getServiceOverride$1 from './layout.js';
14
- import { onRenderWorkbench } from '../services.js';
14
+ import { onRenderWorkbench } from '../lifecycle.js';
15
15
  onRenderWorkbench(async (accessor) => {
16
16
  const container = accessor.get(ILayoutService).container;
17
17
  const model = accessor.get(INotificationService).model;
@@ -5,7 +5,7 @@ import { ISnippetsService } from '../vscode/vs/workbench/contrib/snippets/browse
5
5
  import { SnippetsService } from '../vscode/vs/workbench/contrib/snippets/browser/snippetsService.js';
6
6
  import { ILifecycleService } from '../vscode/vs/workbench/services/lifecycle/common/lifecycle.js';
7
7
  import getServiceOverride$1 from './files.js';
8
- import { registerServiceInitializeParticipant } from '../services.js';
8
+ import { registerServiceInitializeParticipant } from '../lifecycle.js';
9
9
  import '../vscode/vs/workbench/contrib/snippets/browser/snippets.contribution.js';
10
10
  registerServiceInitializeParticipant(async (accessor) => {
11
11
  void accessor.get(ILifecycleService).when(2 ).then(() => {
@@ -1,6 +1,12 @@
1
1
  import { IDisposable } from '../vscode/vs/base/common/lifecycle.js';
2
- import { IStorageItemsChangeEvent } from '../vscode/vs/base/parts/storage/common/storage.js';
2
+ import { IStorageItemsChangeEvent, IStorage } from '../vscode/vs/base/parts/storage/common/storage.js';
3
3
  import { IEditorOverrideServices } from '../vscode/vs/editor/standalone/browser/standaloneServices.js';
4
+ import { AbstractStorageService, StorageScope as StorageScope$1 } from '../vscode/vs/platform/storage/common/storage.js';
5
+ import { IUserDataProfile } from '../vscode/vs/platform/userDataProfile/common/userDataProfile.js';
6
+ import { IAnyWorkspaceIdentifier } from '../vscode/vs/platform/workspace/common/workspace.js';
7
+ import { BrowserStorageService } from '../vscode/vs/workbench/services/storage/browser/storageService.js';
8
+ import { ILogService } from '../vscode/vs/platform/log/common/log.js';
9
+ import { IUserDataProfileService } from '../vscode/vs/workbench/services/userDataProfile/common/userDataProfile.js';
4
10
 
5
11
  declare enum StorageScope {
6
12
  APPLICATION = -1,
@@ -13,6 +19,22 @@ interface IStorageProvider {
13
19
  close?(scope: StorageScope): Promise<void>;
14
20
  onDidChange?(listener: (event: IStorageItemsChangeEvent) => void): IDisposable;
15
21
  }
16
- declare function getStorageServiceOverride(provider: IStorageProvider): IEditorOverrideServices;
22
+ declare class ExternalStorageService extends AbstractStorageService {
23
+ protected readonly provider: IStorageProvider;
24
+ private readonly applicationStorage;
25
+ private readonly profileStorage;
26
+ private readonly workspaceStorage;
27
+ constructor(provider: IStorageProvider);
28
+ protected getStorage(scope: StorageScope$1): IStorage;
29
+ protected getLogDetails(scope: StorageScope$1): string | undefined;
30
+ protected doInitialize(): Promise<void>;
31
+ protected switchToProfile(): Promise<void>;
32
+ protected switchToWorkspace(): Promise<void>;
33
+ hasScope(_scope: IAnyWorkspaceIdentifier | IUserDataProfile): boolean;
34
+ }
35
+ declare class InjectedBrowserStorageService extends BrowserStorageService {
36
+ constructor(userDataProfileService: IUserDataProfileService, logService: ILogService);
37
+ }
38
+ declare function getStorageServiceOverride(provider?: IStorageProvider): IEditorOverrideServices;
17
39
 
18
- export { IStorageItemsChangeEvent, IStorageProvider, StorageScope, getStorageServiceOverride as default };
40
+ export { ExternalStorageService, IStorageItemsChangeEvent, IStorageProvider, InjectedBrowserStorageService, StorageScope, getStorageServiceOverride as default };
@@ -1,8 +1,13 @@
1
+ import { __decorate, __param } from '../node_modules/tslib/tslib.es6.js';
1
2
  import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
2
3
  import { Storage } from 'monaco-editor/esm/vs/base/parts/storage/common/storage.js';
3
4
  import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
4
- import { IStorageService, AbstractStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
5
- import { registerServiceInitializePreParticipant } from '../services.js';
5
+ import { AbstractStorageService, IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
6
+ import { BrowserStorageService } from '../vscode/vs/workbench/services/storage/browser/storageService.js';
7
+ import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
8
+ import { IUserDataProfileService } from '../vscode/vs/workbench/services/userDataProfile/common/userDataProfile.js';
9
+ import { generateUuid } from 'monaco-editor/esm/vs/base/common/uuid.js';
10
+ import { registerServiceInitializePreParticipant } from '../lifecycle.js';
6
11
  var StorageScope;
7
12
  ( (function(StorageScope) {
8
13
  StorageScope[StorageScope["APPLICATION"] = -1] = "APPLICATION";
@@ -85,9 +90,27 @@ class ExternalStorageService extends AbstractStorageService {
85
90
  registerServiceInitializePreParticipant(async (accessor) => {
86
91
  await accessor.get(IStorageService).initialize();
87
92
  });
93
+ let InjectedBrowserStorageService = class InjectedBrowserStorageService extends BrowserStorageService {
94
+ constructor(userDataProfileService, logService) {
95
+ super({
96
+ id: generateUuid()
97
+ }, userDataProfileService, logService);
98
+ }
99
+ };
100
+ InjectedBrowserStorageService = __decorate([
101
+ ( __param(0, IUserDataProfileService)),
102
+ ( __param(1, ILogService))
103
+ ], InjectedBrowserStorageService);
88
104
  function getStorageServiceOverride(provider) {
89
- return {
90
- [( IStorageService.toString())]: new SyncDescriptor(ExternalStorageService, [provider], true)
91
- };
105
+ if (provider != null) {
106
+ return {
107
+ [( IStorageService.toString())]: new SyncDescriptor(ExternalStorageService, [provider], true)
108
+ };
109
+ }
110
+ else {
111
+ return {
112
+ [( IStorageService.toString())]: new SyncDescriptor(InjectedBrowserStorageService, [], true)
113
+ };
114
+ }
92
115
  }
93
- export { StorageScope, getStorageServiceOverride as default };
116
+ export { ExternalStorageService, InjectedBrowserStorageService, StorageScope, getStorageServiceOverride as default };
@@ -10,7 +10,7 @@ import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform
10
10
  import { ILifecycleService } from '../vscode/vs/workbench/services/lifecycle/common/lifecycle.js';
11
11
  import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
12
12
  import getServiceOverride$1 from './files.js';
13
- import { registerServiceInitializeParticipant } from '../services.js';
13
+ import { registerServiceInitializeParticipant } from '../lifecycle.js';
14
14
  import { registerAssets } from '../assets.js';
15
15
  const _onigWasm = new URL('vscode-oniguruma/release/onig.wasm', import.meta.url).href;
16
16
  registerAssets({
@@ -8,14 +8,21 @@ import { IDisposable } from '../vscode/vs/base/common/lifecycle.js';
8
8
  export { IReference } from '../vscode/vs/base/common/lifecycle.js';
9
9
  export { HoverService } from '../vscode/vs/workbench/services/hover/browser/hoverService.js';
10
10
  export { PanelPart } from '../vscode/vs/workbench/browser/parts/panel/panelPart.js';
11
+ import { Part } from '../vscode/vs/workbench/browser/part.js';
11
12
  export { IEditorOptions } from '../vscode/vs/platform/editor/common/editor.js';
12
13
  import { Codicon } from '../vscode/vs/base/common/codicons.js';
13
14
  import { IEditorCloseHandler, EditorInput } from '../vscode/vs/workbench/common/editor/editorInput.js';
14
15
  export { IResolvedTextEditorModel } from '../vscode/vs/editor/common/services/resolverService.js';
15
16
  export { StatusbarPart } from '../vscode/vs/workbench/browser/parts/statusbar/statusbarPart.js';
17
+ import { Parts } from '../vscode/vs/workbench/services/layout/browser/layoutService.js';
16
18
  export { ConfirmResult } from '../vscode/vs/platform/dialogs/common/dialogs.js';
17
19
  import { OpenEditor } from '../dist/types/src/service-override/tools/editor.js';
18
20
 
21
+ declare function renderPart(partContainer: HTMLElement, part: Part): void;
22
+ declare function attachPart(part: Parts, container: HTMLElement): IDisposable;
23
+ declare function onPartVisibilityChange(part: Parts, listener: (visible: boolean) => void): IDisposable;
24
+ declare function isPartVisibile(part: Parts): boolean;
25
+ declare function setPartVisibility(part: Exclude<Parts, Parts.STATUSBAR_PART | Parts.TITLEBAR_PART>, visible: boolean): void;
19
26
  declare function renderActivitybarPar(container: HTMLElement): IDisposable;
20
27
  declare function renderSidebarPart(container: HTMLElement): IDisposable;
21
28
  declare function renderPanelPart(container: HTMLElement): IDisposable;
@@ -65,4 +72,4 @@ declare function registerCustomView(options: CustomViewOption): IDisposable;
65
72
  declare function isEditorPartVisible(): boolean;
66
73
  declare function getServiceOverride(openEditorFallback?: OpenEditor, _webviewIframeAlternateDomains?: string): IEditorOverrideServices;
67
74
 
68
- export { CustomViewOption, EditorPanelOption, IEditorCloseHandler, OpenEditor, ViewContainerLocation, getServiceOverride as default, isEditorPartVisible, registerCustomView, registerEditorPane, renderActivitybarPar, renderAuxiliaryPart, renderEditorPart, renderPanelPart, renderSidebarPart, renderStatusBarPart };
75
+ export { CustomViewOption, EditorPanelOption, IEditorCloseHandler, OpenEditor, Parts, ViewContainerLocation, attachPart, getServiceOverride as default, isEditorPartVisible, isPartVisibile, onPartVisibilityChange, registerCustomView, registerEditorPane, renderActivitybarPar, renderAuxiliaryPart, renderEditorPart, renderPanelPart, renderPart, renderSidebarPart, renderStatusBarPart, setPartVisibility };
@@ -84,7 +84,8 @@ import { IWebviewWorkbenchService, WebviewEditorService } from '../vscode/vs/wor
84
84
  import { IWebviewService } from '../vscode/vs/workbench/contrib/webview/browser/webview.js';
85
85
  import { IWebviewViewService, WebviewViewService } from '../vscode/vs/workbench/contrib/webviewView/browser/webviewViewService.js';
86
86
  import { ILifecycleService } from '../vscode/vs/workbench/services/lifecycle/common/lifecycle.js';
87
- import { positionToString } from '../vscode/vs/workbench/services/layout/browser/layoutService.js';
87
+ import { IWorkbenchLayoutService, positionToString } from '../vscode/vs/workbench/services/layout/browser/layoutService.js';
88
+ export { Parts } from '../vscode/vs/workbench/services/layout/browser/layoutService.js';
88
89
  import { EditorPaneDescriptor } from '../vscode/vs/workbench/browser/editor.js';
89
90
  import { EditorPane } from '../vscode/vs/workbench/browser/parts/editor/editorPane.js';
90
91
  import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
@@ -98,7 +99,7 @@ import getServiceOverride$1 from './layout.js';
98
99
  import getServiceOverride$3 from './quickaccess.js';
99
100
  import { changeUrlDomain } from './tools/url.js';
100
101
  import { registerAssets } from '../assets.js';
101
- import { registerServiceInitializePostParticipant } from '../services.js';
102
+ import { registerServiceInitializePostParticipant } from '../lifecycle.js';
102
103
  function createPart(id, role, classes) {
103
104
  const part = document.createElement(role === 'status' ? 'footer' : 'div');
104
105
  part.classList.add('part', ...classes);
@@ -131,7 +132,7 @@ function renderPart(partContainer, part) {
131
132
  function getPart(part) {
132
133
  return StandaloneServices.get(ILayoutService).getPart(part);
133
134
  }
134
- function attachPart(part, container) {
135
+ function _attachPart(part, container) {
135
136
  container.append(part.getContainer());
136
137
  const observer = new ResizeObserver(() => layoutPart(part));
137
138
  observer.observe(container);
@@ -141,23 +142,35 @@ function attachPart(part, container) {
141
142
  }
142
143
  };
143
144
  }
145
+ function attachPart(part, container) {
146
+ return _attachPart(getPart(part), container);
147
+ }
148
+ function onPartVisibilityChange(part, listener) {
149
+ return getPart(part).onDidVisibilityChange(listener);
150
+ }
151
+ function isPartVisibile(part) {
152
+ return StandaloneServices.get(IWorkbenchLayoutService).isVisible(part);
153
+ }
154
+ function setPartVisibility(part, visible) {
155
+ StandaloneServices.get(IWorkbenchLayoutService).setPartHidden(!visible, part);
156
+ }
144
157
  function renderActivitybarPar(container) {
145
- return attachPart(getPart("workbench.parts.activitybar" ), container);
158
+ return attachPart("workbench.parts.activitybar" , container);
146
159
  }
147
160
  function renderSidebarPart(container) {
148
- return attachPart(getPart("workbench.parts.sidebar" ), container);
161
+ return attachPart("workbench.parts.sidebar" , container);
149
162
  }
150
163
  function renderPanelPart(container) {
151
- return attachPart(getPart("workbench.parts.panel" ), container);
164
+ return attachPart("workbench.parts.panel" , container);
152
165
  }
153
166
  function renderAuxiliaryPart(container) {
154
- return attachPart(getPart("workbench.parts.auxiliarybar" ), container);
167
+ return attachPart("workbench.parts.auxiliarybar" , container);
155
168
  }
156
169
  function renderEditorPart(container) {
157
- return attachPart(getPart("workbench.parts.editor" ), container);
170
+ return attachPart("workbench.parts.editor" , container);
158
171
  }
159
172
  function renderStatusBarPart(container) {
160
- return attachPart(getPart("workbench.parts.statusbar" ), container);
173
+ return attachPart("workbench.parts.statusbar" , container);
161
174
  }
162
175
  function registerEditorPane(options) {
163
176
  let CustomEditorPane = class CustomEditorPane extends EditorPane {
@@ -439,4 +452,4 @@ function getServiceOverride(openEditorFallback, _webviewIframeAlternateDomains)
439
452
  [( IWebviewWorkbenchService.toString())]: new SyncDescriptor(WebviewEditorService, [], true)
440
453
  };
441
454
  }
442
- export { ActivityService, HoverService, StatusbarPart, getServiceOverride as default, isEditorPartVisible, registerCustomView, registerEditorPane, renderActivitybarPar, renderAuxiliaryPart, renderEditorPart, renderPanelPart, renderSidebarPart, renderStatusBarPart };
455
+ export { ActivityService, HoverService, StatusbarPart, attachPart, getServiceOverride as default, isEditorPartVisible, isPartVisibile, onPartVisibilityChange, registerCustomView, registerEditorPane, renderActivitybarPar, renderAuxiliaryPart, renderEditorPart, renderPanelPart, renderPart, renderSidebarPart, renderStatusBarPart, setPartVisibility };
@@ -1,4 +1,3 @@
1
- import { Event } from './vscode/vs/base/common/event.js';
2
1
  export { default as Severity } from './vscode/vs/base/common/severity.js';
3
2
  export { IConfigurationChangeEvent, IConfigurationService } from './vscode/vs/platform/configuration/common/configuration.js';
4
3
  export { ITextModelContentProvider, ITextModelService } from './vscode/vs/editor/common/services/resolverService.js';
@@ -6,7 +5,7 @@ export { IColorTheme, IThemeService } from './vscode/vs/platform/theme/common/th
6
5
  export { IStorageService, StorageScope, StorageTarget } from './vscode/vs/platform/storage/common/storage.js';
7
6
  import { IEditorOverrideServices } from './vscode/vs/editor/standalone/browser/standaloneServices.js';
8
7
  export { StandaloneServices } from './vscode/vs/editor/standalone/browser/standaloneServices.js';
9
- import { ServicesAccessor, ServiceIdentifier } from './vscode/vs/platform/instantiation/common/instantiation.js';
8
+ import { ServiceIdentifier } from './vscode/vs/platform/instantiation/common/instantiation.js';
10
9
  export { IInstantiationService } from './vscode/vs/platform/instantiation/common/instantiation.js';
11
10
  export { IAction } from './vscode/vs/base/common/actions.js';
12
11
  export { SyncDescriptor } from './vscode/vs/platform/instantiation/common/descriptors.js';
@@ -64,14 +63,7 @@ export { IHoverService } from './vscode/vs/workbench/services/hover/browser/hove
64
63
  export { IExplorerService } from './vscode/vs/workbench/contrib/files/browser/files.js';
65
64
  export { IStatusbarService } from './vscode/vs/workbench/services/statusbar/browser/statusbar.js';
66
65
 
67
- interface ServiceInitializeParticipant {
68
- (accessor: ServicesAccessor): Promise<void>;
69
- }
70
- declare function registerServiceInitializePreParticipant(participant: ServiceInitializeParticipant): void;
71
- declare function registerServiceInitializeParticipant(participant: ServiceInitializeParticipant): void;
72
- declare function registerServiceInitializePostParticipant(participant: ServiceInitializeParticipant): void;
73
- declare const onRenderWorkbench: Event<ServicesAccessor>;
74
- declare function getService<T>(identifier: ServiceIdentifier<T>): Promise<T>;
75
66
  declare function initialize(overrides: IEditorOverrideServices): Promise<void>;
67
+ declare function getService<T>(identifier: ServiceIdentifier<T>): Promise<T>;
76
68
 
77
- export { getService, initialize, onRenderWorkbench, registerServiceInitializeParticipant, registerServiceInitializePostParticipant, registerServiceInitializePreParticipant };
69
+ export { getService, initialize };
package/dist/services.js CHANGED
@@ -1,17 +1,13 @@
1
1
  export { default as Severity } from 'monaco-editor/esm/vs/base/common/severity.js';
2
2
  export { StorageScope, StorageTarget } from './vscode/vs/platform/storage/common/storage.js';
3
- import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
4
- import { Extensions } from './vscode/vs/workbench/common/contributions.js';
5
3
  import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
6
4
  export { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
7
- import { ILifecycleService } from './vscode/vs/workbench/services/lifecycle/common/lifecycle.js';
8
- import { Barrier, RunOnceScheduler, runWhenIdle } from 'monaco-editor/esm/vs/base/common/async.js';
9
- import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
10
5
  import getServiceOverride from './service-override/layout.js';
11
6
  import getServiceOverride$1 from './service-override/environment.js';
12
7
  import getServiceOverride$2 from './service-override/extensions.js';
13
8
  import getServiceOverride$3 from './service-override/files.js';
14
9
  import getServiceOverride$4 from './service-override/quickaccess.js';
10
+ import { startup, serviceInitializedBarrier } from './lifecycle.js';
15
11
  export { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
16
12
  export { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
17
13
  export { INotificationService, NeverShowAgainScope, NoOpNotification, NoOpProgress, NotificationPriority, NotificationsFilter } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
@@ -68,19 +64,7 @@ export { IHoverService } from './vscode/vs/workbench/services/hover/browser/hove
68
64
  export { IExplorerService } from './vscode/vs/workbench/contrib/files/browser/files.js';
69
65
  export { IStatusbarService } from './vscode/vs/workbench/services/statusbar/browser/statusbar.js';
70
66
  export { IDialogService } from './vscode/vs/platform/dialogs/common/dialogs.js';
71
- const serviceInitializePreParticipants = [];
72
- const serviceInitializeParticipants = [];
73
- const serviceInitializePostParticipants = [];
74
- function registerServiceInitializePreParticipant(participant) {
75
- serviceInitializePreParticipants.push(participant);
76
- }
77
- function registerServiceInitializeParticipant(participant) {
78
- serviceInitializeParticipants.push(participant);
79
- }
80
- function registerServiceInitializePostParticipant(participant) {
81
- serviceInitializePostParticipants.push(participant);
82
- }
83
- async function initServices(overrides) {
67
+ async function initialize(overrides) {
84
68
  const instantiationService = StandaloneServices.initialize({
85
69
  ...getServiceOverride(),
86
70
  ...getServiceOverride$1(),
@@ -89,40 +73,10 @@ async function initServices(overrides) {
89
73
  ...getServiceOverride$4(),
90
74
  ...overrides
91
75
  });
92
- await instantiationService.invokeFunction(async (accessor) => {
93
- await Promise.all(( serviceInitializePreParticipants.map(participant => participant(accessor))));
94
- });
95
- await instantiationService.invokeFunction(async (accessor) => {
96
- const lifecycleService = accessor.get(ILifecycleService);
97
- await Promise.all(( serviceInitializeParticipants.map(participant => participant(accessor))));
98
- lifecycleService.phase = 2 ;
99
- });
100
- await instantiationService.invokeFunction(async (accessor) => {
101
- await Promise.all(( serviceInitializePostParticipants.map(participant => participant(accessor))));
102
- });
103
- return instantiationService;
76
+ await startup(instantiationService);
104
77
  }
105
- const renderWorkbenchEmitter = new Emitter();
106
- const onRenderWorkbench = renderWorkbenchEmitter.event;
107
- const serviceInitializedBarrier = new Barrier();
108
78
  async function getService(identifier) {
109
79
  await serviceInitializedBarrier.wait();
110
80
  return StandaloneServices.get(identifier);
111
81
  }
112
- async function initialize(overrides) {
113
- const instantiationService = await initServices(overrides);
114
- serviceInitializedBarrier.open();
115
- instantiationService.invokeFunction(accessor => {
116
- const lifecycleService = accessor.get(ILifecycleService);
117
- ( Registry.as(Extensions.Workbench)).start(accessor);
118
- renderWorkbenchEmitter.fire(accessor);
119
- lifecycleService.phase = 3 ;
120
- const eventuallyPhaseScheduler = new RunOnceScheduler(() => {
121
- runWhenIdle(() => {
122
- lifecycleService.phase = 4 ;
123
- }, 2500);
124
- }, 2500);
125
- eventuallyPhaseScheduler.schedule();
126
- });
127
- }
128
- export { getService, initialize, onRenderWorkbench, registerServiceInitializeParticipant, registerServiceInitializePostParticipant, registerServiceInitializePreParticipant };
82
+ export { getService, initialize };