@codingame/monaco-vscode-layout-service-override 25.1.1 → 26.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
+ import type { IDisposable } from "@xterm/headless";
2
+ import * as dom from "@codingame/monaco-vscode-api/vscode/vs/base/browser/dom";
3
+ import type { IViewSize } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/grid/gridview";
4
+ import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
5
+ import { Disposable, DisposableStore } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
1
6
  import { type IEditorOverrideServices } from "@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneServices";
2
- import { type PanelAlignment, Parts, Position } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService";
3
- import { IWorkbenchLayoutService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService.service";
7
+ import type { ServicesAccessor } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
4
8
  import type { ILayoutOffsetInfo } from "@codingame/monaco-vscode-api/vscode/vs/platform/layout/browser/layoutService";
5
9
  import { ILayoutService } from "@codingame/monaco-vscode-api/vscode/vs/platform/layout/browser/layoutService.service";
6
- import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
7
- import * as dom from "@codingame/monaco-vscode-api/vscode/vs/base/browser/dom";
8
10
  import { Part } from "@codingame/monaco-vscode-api/vscode/vs/workbench/browser/part";
9
- import type { ServicesAccessor } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
10
- import { Disposable, DisposableStore } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
11
- import type { IDisposable } from "@xterm/headless";
12
- import type { IViewSize } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/grid/gridview";
11
+ import { type IPartVisibilityChangeEvent, type PanelAlignment, Parts, Position } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService";
12
+ import { IWorkbenchLayoutService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService.service";
13
13
  import { unsupported } from "@codingame/monaco-vscode-api/tools";
14
14
  export declare class LayoutService extends Disposable implements ILayoutService, IWorkbenchLayoutService {
15
15
  mainContainer: HTMLElement;
@@ -115,7 +115,7 @@ export declare class LayoutService extends Disposable implements ILayoutService,
115
115
  registerPart(part: Part): IDisposable;
116
116
  isRestored(): boolean;
117
117
  private _onDidChangePartVisibility;
118
- onDidChangePartVisibility: Event<void>;
118
+ onDidChangePartVisibility: Event<IPartVisibilityChangeEvent>;
119
119
  readonly offset: ILayoutOffsetInfo;
120
120
  private readonly _onDidLayout;
121
121
  readonly onDidLayout: Event<dom.IDimension>;
package/index.js CHANGED
@@ -1,30 +1,32 @@
1
1
 
2
- import { StandaloneServices } from '@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneServices';
3
- import { LayoutSettings, Parts, positionFromString, ActivityBarPosition, positionToString } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService';
4
- import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
5
- import { ILayoutService } from '@codingame/monaco-vscode-api/vscode/vs/platform/layout/browser/layoutService.service';
6
- import { Event, Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
7
2
  import { getActiveDocument, getWindows, isActiveDocument, getWindow, Dimension, isAncestorUsingFlowTo, getClientArea } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
3
+ import { coalesce } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
4
+ import { Event, Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
5
+ import { Disposable, DisposableStore, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
6
+ import { isWindows, isLinux, isChrome, isFirefox, isSafari } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
7
+ import { ICodeEditorService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService.service';
8
+ import { StandaloneCodeEditor } from '@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneCodeEditor';
9
+ import { StandaloneServices } from '@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneServices';
10
+ import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
8
11
  import { SyncDescriptor } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/descriptors';
12
+ import { ILayoutService } from '@codingame/monaco-vscode-api/vscode/vs/platform/layout/browser/layoutService.service';
13
+ import { getMenuBarVisibility, getTitleBarStyle } from '@codingame/monaco-vscode-api/vscode/vs/platform/window/common/window';
9
14
  import '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/part';
10
- import { IPaneCompositePartService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/panecomposite/browser/panecomposite.service';
15
+ import '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/activitybar/activitybarPart';
11
16
  import { ViewContainerLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views';
12
17
  import { IViewDescriptorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views.service';
13
- import { isWindows, isLinux, isChrome, isFirefox, isSafari } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
14
- import { coalesce } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
15
- import '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/activitybar/activitybarPart';
16
- import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
17
- import { IStatusbarService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/statusbar/browser/statusbar.service';
18
- import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
19
- import { Disposable, DisposableStore, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
20
18
  import { IAuxiliaryWindowService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.service';
21
- import { StandaloneCodeEditor } from '@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneCodeEditor';
19
+ import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
22
20
  import { IHostService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service';
23
- import { ICodeEditorService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService.service';
24
- import { getMenuBarVisibility, getTitleBarStyle } from '@codingame/monaco-vscode-api/vscode/vs/platform/window/common/window';
21
+ import { LayoutSettings, Parts, positionFromString, ActivityBarPosition, positionToString } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService';
22
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
23
+ import { WorkbenchModeService } from './vscode/src/vs/workbench/services/layout/browser/workbenchModeService.js';
24
+ import { IWorkbenchModeService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/common/workbenchModeService.service';
25
+ import { IPaneCompositePartService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/panecomposite/browser/panecomposite.service';
26
+ import { IStatusbarService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/statusbar/browser/statusbar.service';
25
27
  import { onRenderWorkbench } from '@codingame/monaco-vscode-api/lifecycle';
26
- import { getWorkbenchContainer } from '@codingame/monaco-vscode-api/workbench';
27
28
  import { unsupported } from '@codingame/monaco-vscode-api/tools';
29
+ import { getWorkbenchContainer } from '@codingame/monaco-vscode-api/workbench';
28
30
 
29
31
  class LayoutService extends Disposable {
30
32
  constructor(mainContainer = getWorkbenchContainer()) {
@@ -305,7 +307,7 @@ class LayoutService extends Disposable {
305
307
  else {
306
308
  this.hiddenParts.delete(part);
307
309
  }
308
- this._onDidChangePartVisibility.fire();
310
+ this._onDidChangePartVisibility.fire({ partId: part, visible: !hidden });
309
311
  const location = {
310
312
  [Parts.SIDEBAR_PART]: ViewContainerLocation.Sidebar,
311
313
  [Parts.AUXILIARYBAR_PART]: ViewContainerLocation.AuxiliaryBar,
@@ -397,7 +399,8 @@ onRenderWorkbench((accessor) => {
397
399
  });
398
400
  function getServiceOverride(container) {
399
401
  return {
400
- [ILayoutService.toString()]: new SyncDescriptor(LayoutService, [container], true)
402
+ [ILayoutService.toString()]: new SyncDescriptor(LayoutService, [container], true),
403
+ [IWorkbenchModeService.toString()]: new SyncDescriptor(WorkbenchModeService, [], true)
401
404
  };
402
405
  }
403
406
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-layout-service-override",
3
- "version": "25.1.1",
3
+ "version": "26.0.0",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor - layout service-override",
6
6
  "keywords": [],
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "type": "module",
17
17
  "dependencies": {
18
- "@codingame/monaco-vscode-api": "25.1.1"
18
+ "@codingame/monaco-vscode-api": "26.0.0"
19
19
  },
20
20
  "main": "index.js",
21
21
  "module": "index.js",
@@ -0,0 +1,38 @@
1
+ import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
2
+ import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
3
+ import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
4
+ import { IEnvironmentService } from "@codingame/monaco-vscode-api/vscode/vs/platform/environment/common/environment.service";
5
+ import { IWorkbenchModeConfiguration } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/common/workbenchModeService";
6
+ import { IWorkbenchModeService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/common/workbenchModeService.service";
7
+ import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
8
+ import { IUriIdentityService } from "@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service";
9
+ import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service";
10
+ import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
11
+ export declare class WorkbenchModeService extends Disposable implements IWorkbenchModeService {
12
+ private readonly workspaceContextService;
13
+ private readonly fileService;
14
+ private readonly environmentService;
15
+ private readonly uriIdentityService;
16
+ private readonly logService;
17
+ private readonly storageService;
18
+ readonly _serviceBrand: undefined;
19
+ private static readonly WORKBENCH_MODE_STORAGE_KEY;
20
+ private _workbenchMode;
21
+ get workbenchMode(): string | undefined;
22
+ private readonly _onDidChangeWorkbenchMode;
23
+ readonly onDidChangeWorkbenchMode: Event<string | undefined>;
24
+ private readonly workbenchModeFileWatcherDiposables;
25
+ private readonly configurationRegistry;
26
+ private configurationDefaults;
27
+ constructor(workspaceContextService: IWorkspaceContextService, fileService: IFileService, environmentService: IEnvironmentService, uriIdentityService: IUriIdentityService, logService: ILogService, storageService: IStorageService);
28
+ initialize(): Promise<void>;
29
+ private updateWorkbenchModeConfiguration;
30
+ private updateConfigurationDefaults;
31
+ private watchCurrentModeFile;
32
+ private getWorkbenchModeFileUri;
33
+ getWorkbenchModeConfiguration(id: string): Promise<IWorkbenchModeConfiguration | undefined>;
34
+ getWorkbenchModeConfigurations(): Promise<IWorkbenchModeConfiguration[]>;
35
+ private resolveWorkbenchModeConfiguration;
36
+ setWorkbenchMode(modeId: string | undefined): Promise<void>;
37
+ private updateWorkbenchMode;
38
+ }
@@ -0,0 +1,165 @@
1
+
2
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
4
+ import { Disposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
5
+ import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
6
+ import { IEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/platform/environment/common/environment.service';
7
+ import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
8
+ import { IUriIdentityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
9
+ import { parse } from '@codingame/monaco-vscode-api/vscode/vs/base/common/json';
10
+ import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
11
+ import { Registry } from '@codingame/monaco-vscode-api/vscode/vs/platform/registry/common/platform';
12
+ import { Extensions } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configurationRegistry';
13
+ import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
14
+ import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
15
+
16
+ var WorkbenchModeService_1;
17
+ let WorkbenchModeService = class WorkbenchModeService extends Disposable {
18
+ static {
19
+ WorkbenchModeService_1 = this;
20
+ }
21
+ static {
22
+ this.WORKBENCH_MODE_STORAGE_KEY = "workbench.mode";
23
+ }
24
+ get workbenchMode() {
25
+ return this._workbenchMode;
26
+ }
27
+ constructor(
28
+ workspaceContextService,
29
+ fileService,
30
+ environmentService,
31
+ uriIdentityService,
32
+ logService,
33
+ storageService
34
+ ) {
35
+ super();
36
+ this.workspaceContextService = workspaceContextService;
37
+ this.fileService = fileService;
38
+ this.environmentService = environmentService;
39
+ this.uriIdentityService = uriIdentityService;
40
+ this.logService = logService;
41
+ this.storageService = storageService;
42
+ this._onDidChangeWorkbenchMode = this._register(( new Emitter()));
43
+ this.onDidChangeWorkbenchMode = this._onDidChangeWorkbenchMode.event;
44
+ this.workbenchModeFileWatcherDiposables = this._register(( new DisposableStore()));
45
+ this.configurationRegistry = ( Registry.as(Extensions.Configuration));
46
+ this._workbenchMode = this.workspaceContextService.getWorkspace().isAgentSessionsWorkspace ? "agent-sessions" : this.storageService.get(WorkbenchModeService_1.WORKBENCH_MODE_STORAGE_KEY, StorageScope.WORKSPACE);
47
+ this.watchCurrentModeFile();
48
+ }
49
+ async initialize() {
50
+ return this.updateWorkbenchModeConfiguration();
51
+ }
52
+ async updateWorkbenchModeConfiguration() {
53
+ const workbenchModeConfiguration = this._workbenchMode ? await this.getWorkbenchModeConfiguration(this._workbenchMode) : undefined;
54
+ this.updateConfigurationDefaults(workbenchModeConfiguration?.settings);
55
+ }
56
+ updateConfigurationDefaults(configurationDefaults) {
57
+ if (this.configurationDefaults) {
58
+ this.configurationRegistry.deregisterDefaultConfigurations([this.configurationDefaults]);
59
+ }
60
+ if (configurationDefaults) {
61
+ this.configurationDefaults = {
62
+ overrides: configurationDefaults,
63
+ donotCache: true
64
+ };
65
+ this.configurationRegistry.registerDefaultConfigurations([this.configurationDefaults]);
66
+ } else {
67
+ this.configurationDefaults = undefined;
68
+ }
69
+ }
70
+ watchCurrentModeFile() {
71
+ if (!this._workbenchMode) {
72
+ this.workbenchModeFileWatcherDiposables.clear();
73
+ return;
74
+ }
75
+ const workbenchModeFileUri = this.getWorkbenchModeFileUri(this._workbenchMode);
76
+ if (!workbenchModeFileUri) {
77
+ this.workbenchModeFileWatcherDiposables.clear();
78
+ return;
79
+ }
80
+ this.workbenchModeFileWatcherDiposables.add(this.fileService.watch(workbenchModeFileUri));
81
+ this.workbenchModeFileWatcherDiposables.add(this.fileService.onDidFilesChange(e => {
82
+ if (e.affects(workbenchModeFileUri)) {
83
+ this.updateWorkbenchModeConfiguration();
84
+ this._onDidChangeWorkbenchMode.fire(this._workbenchMode);
85
+ }
86
+ }));
87
+ }
88
+ getWorkbenchModeFileUri(layoutId) {
89
+ return this.uriIdentityService.extUri.joinPath(
90
+ this.environmentService.builtinWorkbenchModesHome,
91
+ `${layoutId}.code-workbench-mode`
92
+ );
93
+ }
94
+ async getWorkbenchModeConfiguration(id) {
95
+ const resource = this.getWorkbenchModeFileUri(id);
96
+ return this.resolveWorkbenchModeConfiguration(resource);
97
+ }
98
+ async getWorkbenchModeConfigurations() {
99
+ const result = [];
100
+ const workbenchModesFolder = this.environmentService.builtinWorkbenchModesHome;
101
+ try {
102
+ const stat = await this.fileService.resolve(workbenchModesFolder);
103
+ if (!stat.children?.length) {
104
+ return result;
105
+ }
106
+ for (const child of stat.children) {
107
+ if (child.isDirectory) {
108
+ continue;
109
+ }
110
+ const workbenchModeConfiguration = await this.resolveWorkbenchModeConfiguration(child.resource);
111
+ if (workbenchModeConfiguration) {
112
+ result.push(workbenchModeConfiguration);
113
+ }
114
+ }
115
+ } catch (error) {
116
+ this.logService.error(`Error while reading workbench mode files from ${( workbenchModesFolder.toString())}`, error);
117
+ }
118
+ return result;
119
+ }
120
+ async resolveWorkbenchModeConfiguration(workbenchConfigurationModeFile) {
121
+ if (this.uriIdentityService.extUri.extname(workbenchConfigurationModeFile) !== ".code-workbench-mode") {
122
+ return undefined;
123
+ }
124
+ try {
125
+ const content = ( (await this.fileService.readFile(workbenchConfigurationModeFile)).value.toString());
126
+ const name = this.uriIdentityService.extUri.basename(workbenchConfigurationModeFile);
127
+ const workbenchModeConfiguration = {
128
+ id: name.substring(0, name.length - ".code-workbench-mode".length),
129
+ ...parse(content)
130
+ };
131
+ return workbenchModeConfiguration;
132
+ } catch (error) {
133
+ this.logService.error(`Error while reading workbench mode file from ${( workbenchConfigurationModeFile.toString())}`, error);
134
+ return undefined;
135
+ }
136
+ }
137
+ async setWorkbenchMode(modeId) {
138
+ if (this.workspaceContextService.getWorkspace().isAgentSessionsWorkspace) {
139
+ throw ( new Error("Cannot set workbench mode in an agent sessions workspace"));
140
+ }
141
+ if (this._workbenchMode === modeId) {
142
+ return;
143
+ }
144
+ this.updateWorkbenchMode(modeId);
145
+ await this.updateWorkbenchModeConfiguration();
146
+ this.watchCurrentModeFile();
147
+ this._onDidChangeWorkbenchMode.fire(modeId);
148
+ }
149
+ updateWorkbenchMode(modeId) {
150
+ this._workbenchMode = modeId;
151
+ if (modeId === undefined) {
152
+ this.storageService.remove(WorkbenchModeService_1.WORKBENCH_MODE_STORAGE_KEY, StorageScope.WORKSPACE);
153
+ } else {
154
+ this.storageService.store(
155
+ WorkbenchModeService_1.WORKBENCH_MODE_STORAGE_KEY,
156
+ modeId,
157
+ StorageScope.WORKSPACE,
158
+ StorageTarget.MACHINE
159
+ );
160
+ }
161
+ }
162
+ };
163
+ WorkbenchModeService = WorkbenchModeService_1 = ( __decorate([( __param(0, IWorkspaceContextService)), ( __param(1, IFileService)), ( __param(2, IEnvironmentService)), ( __param(3, IUriIdentityService)), ( __param(4, ILogService)), ( __param(5, IStorageService))], WorkbenchModeService));
164
+
165
+ export { WorkbenchModeService };