@codingame/monaco-vscode-layout-service-override 1.85.0-next.2 → 1.85.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/layout.d.ts +9 -6
  2. package/layout.js +45 -15
  3. package/package.json +2 -2
package/layout.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { IEditorOverrideServices } from 'vscode/vscode/vs/editor/standalone/browser/standaloneServices';
2
- import { IWorkbenchLayoutService, Parts, PanelAlignment, Position } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService';
2
+ import { IWorkbenchLayoutService, Parts, Position, PanelAlignment } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService';
3
3
  import { ILayoutService, ILayoutOffsetInfo } from 'vscode/vscode/vs/platform/layout/browser/layoutService';
4
4
  import { Event } from 'vscode/vscode/vs/base/common/event';
5
5
  import { IDimension, Dimension } from 'vscode/vscode/vs/base/browser/dom';
@@ -18,6 +18,8 @@ declare class LayoutService extends Disposable implements ILayoutService, IWorkb
18
18
  private auxiliaryWindowService;
19
19
  private hostService;
20
20
  private activeContainerId;
21
+ private sideBarPosition;
22
+ private panelPosition;
21
23
  constructor(mainContainer?: HTMLElement);
22
24
  hasMainWindowBorder(): boolean;
23
25
  getMainWindowBorderRadius(): string | undefined;
@@ -56,7 +58,10 @@ declare class LayoutService extends Disposable implements ILayoutService, IWorkb
56
58
  onDidChangeZenMode: Event<any>;
57
59
  onDidChangeWindowMaximized: Event<any>;
58
60
  onDidChangeCenteredLayout: Event<any>;
59
- onDidChangePanelPosition: Event<any>;
61
+ private readonly _onDidChangePanelPosition;
62
+ readonly onDidChangePanelPosition: Event<string>;
63
+ private readonly _onDidChangeSideBarPosition;
64
+ readonly onDidChangeSideBarPosition: Event<string>;
60
65
  onDidChangePanelAlignment: Event<any>;
61
66
  onDidChangeNotificationsVisibility: Event<any>;
62
67
  openedDefaultEditors: boolean;
@@ -69,11 +74,8 @@ declare class LayoutService extends Disposable implements ILayoutService, IWorkb
69
74
  focusPart(part: Parts): void;
70
75
  getDimension(part: Parts): Dimension | undefined;
71
76
  toggleMaximizedPanel(): void;
72
- hasWindowBorder(): boolean;
73
- getWindowBorderWidth(): number;
74
- getWindowBorderRadius(): string | undefined;
75
77
  toggleMenuBar(): void;
76
- setPanelPosition(): void;
78
+ setPanelPosition(position: Position): void;
77
79
  getPanelAlignment(): PanelAlignment;
78
80
  setPanelAlignment(): void;
79
81
  toggleZenMode(): void;
@@ -96,6 +98,7 @@ declare class LayoutService extends Disposable implements ILayoutService, IWorkb
96
98
  setPartHidden(hidden: boolean, part: Parts): void;
97
99
  isVisible(part: Parts): boolean;
98
100
  getSideBarPosition(): Position;
101
+ setSideBarPosition(position: Position): void;
99
102
  registerPart(part: Part): void;
100
103
  isRestored(): boolean;
101
104
  private _onDidChangePartVisibility;
package/layout.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
2
+ import { positionFromString, positionToString } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService';
2
3
  import { ILayoutService } from 'monaco-editor/esm/vs/platform/layout/browser/layoutService.js';
3
4
  import { Emitter, Event } from 'monaco-editor/esm/vs/base/common/event.js';
4
5
  import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
@@ -16,6 +17,7 @@ import { IAuxiliaryWindowService } from 'vscode/vscode/vs/workbench/services/aux
16
17
  import { StandaloneCodeEditor } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneCodeEditor.js';
17
18
  import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host';
18
19
  import { ICodeEditorService } from 'monaco-editor/esm/vs/editor/browser/services/codeEditorService.js';
20
+ import { getMenuBarVisibility, getTitleBarStyle } from 'vscode/vscode/vs/platform/window/common/window';
19
21
  import { onRenderWorkbench } from 'vscode/lifecycle';
20
22
  import { getWorkbenchContainer } from 'vscode/workbench';
21
23
 
@@ -41,7 +43,10 @@ class LayoutService extends Disposable {
41
43
  this.onDidChangeZenMode = Event.None;
42
44
  this.onDidChangeWindowMaximized = Event.None;
43
45
  this.onDidChangeCenteredLayout = Event.None;
44
- this.onDidChangePanelPosition = Event.None;
46
+ this._onDidChangePanelPosition = this._register(new Emitter());
47
+ this.onDidChangePanelPosition = this._onDidChangePanelPosition.event;
48
+ this._onDidChangeSideBarPosition = this._register(new Emitter());
49
+ this.onDidChangeSideBarPosition = this._onDidChangeSideBarPosition.event;
45
50
  this.onDidChangePanelAlignment = Event.None;
46
51
  this.onDidChangeNotificationsVisibility = Event.None;
47
52
  this.openedDefaultEditors = false;
@@ -96,11 +101,19 @@ class LayoutService extends Disposable {
96
101
  this.setPartHidden(this.isActivityBarHidden(), "workbench.parts.activitybar" );
97
102
  }
98
103
  if (e.affectsConfiguration('workbench.statusBar.visible')) {
99
- this.setPartHidden(this.configurationService.getValue('workbench.statusBar.visible'), "workbench.parts.statusbar" );
104
+ this.setPartHidden(!this.configurationService.getValue('workbench.statusBar.visible'), "workbench.parts.statusbar" );
105
+ }
106
+ if (e.affectsConfiguration('workbench.sideBar.location')) {
107
+ this.setSideBarPosition(positionFromString(this.configurationService.getValue('workbench.sideBar.location') ?? 'left'));
108
+ }
109
+ if (e.affectsConfiguration('workbench.panel.defaultLocation')) {
110
+ this.setPanelPosition(positionFromString(this.configurationService.getValue('workbench.panel.defaultLocation') ?? 'bottom'));
100
111
  }
101
112
  }));
102
113
  this.setPartHidden(this.isActivityBarHidden(), "workbench.parts.activitybar" );
103
114
  this.setPartHidden(!this.configurationService.getValue('workbench.statusBar.visible'), "workbench.parts.statusbar" );
115
+ this.sideBarPosition = positionFromString(this.configurationService.getValue('workbench.sideBar.location') ?? 'left');
116
+ this.panelPosition = positionFromString(this.configurationService.getValue('workbench.panel.defaultLocation') ?? 'bottom');
104
117
  this._register(this.hostService.onDidChangeActiveWindow(() => this.onActiveWindowChanged()));
105
118
  this._register(this.auxiliaryWindowService.onDidOpenAuxiliaryWindow(({ window, disposables }) => {
106
119
  this._onDidAddContainer.fire({ container: window.container, disposables: new DisposableStore() });
@@ -166,18 +179,25 @@ class LayoutService extends Disposable {
166
179
  }
167
180
  toggleMaximizedPanel() {
168
181
  }
169
- hasWindowBorder() {
170
- return false;
171
- }
172
- getWindowBorderWidth() {
173
- return 0;
174
- }
175
- getWindowBorderRadius() {
176
- return undefined;
177
- }
178
182
  toggleMenuBar() {
183
+ let currentVisibilityValue = getMenuBarVisibility(this.configurationService);
184
+ if (typeof currentVisibilityValue !== 'string') {
185
+ currentVisibilityValue = 'classic';
186
+ }
187
+ let newVisibilityValue;
188
+ if (currentVisibilityValue === 'visible' || currentVisibilityValue === 'classic') {
189
+ newVisibilityValue = getTitleBarStyle(this.configurationService) === 'native' ? 'toggle' : 'compact';
190
+ }
191
+ else {
192
+ newVisibilityValue = 'classic';
193
+ }
194
+ void this.configurationService.updateValue('window.menuBarVisibility', newVisibilityValue);
179
195
  }
180
- setPanelPosition() {
196
+ setPanelPosition(position) {
197
+ this.panelPosition = position;
198
+ const panelPart = this.getPart("workbench.parts.panel" );
199
+ panelPart?.updateStyles();
200
+ this._onDidChangePanelPosition.fire(positionToString(position));
181
201
  }
182
202
  getPanelAlignment() {
183
203
  return 'left';
@@ -208,7 +228,7 @@ class LayoutService extends Disposable {
208
228
  return false;
209
229
  }
210
230
  getPanelPosition() {
211
- return 2 ;
231
+ return this.panelPosition;
212
232
  }
213
233
  hasFocus(part) {
214
234
  const activeElement = document.activeElement;
@@ -277,7 +297,17 @@ class LayoutService extends Disposable {
277
297
  return !( this.hiddenParts.has(part));
278
298
  }
279
299
  getSideBarPosition() {
280
- return 0 ;
300
+ return this.sideBarPosition;
301
+ }
302
+ setSideBarPosition(position) {
303
+ this.sideBarPosition = position;
304
+ const activityBar = this.getPart("workbench.parts.activitybar" );
305
+ const sideBar = this.getPart("workbench.parts.sidebar" );
306
+ const auxiliaryBar = this.getPart("workbench.parts.auxiliarybar" );
307
+ activityBar?.updateStyles();
308
+ sideBar?.updateStyles();
309
+ auxiliaryBar?.updateStyles();
310
+ this._onDidChangeSideBarPosition.fire(positionToString(position));
281
311
  }
282
312
  registerPart(part) {
283
313
  this.parts.set(part.getId(), part);
@@ -314,7 +344,7 @@ class LayoutService extends Disposable {
314
344
  }
315
345
  }
316
346
  else {
317
- this.editorGroupService.getPart(activeContainer)?.activeGroup.focus();
347
+ this.editorGroupService.getPart(activeContainer).activeGroup.focus();
318
348
  }
319
349
  }
320
350
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-layout-service-override",
3
- "version": "1.85.0-next.2",
3
+ "version": "1.85.1",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -18,7 +18,7 @@
18
18
  "module": "index.js",
19
19
  "types": "index.d.ts",
20
20
  "dependencies": {
21
- "vscode": "npm:@codingame/monaco-vscode-api@1.85.0-next.2",
21
+ "vscode": "npm:@codingame/monaco-vscode-api@1.85.1",
22
22
  "monaco-editor": "0.45.0"
23
23
  }
24
24
  }