@codingame/monaco-vscode-workbench-service-override 4.5.2 → 5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-workbench-service-override",
3
- "version": "4.5.2",
3
+ "version": "5.0.0",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -26,12 +26,12 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "vscode": "npm:@codingame/monaco-vscode-api@4.5.2",
30
- "@codingame/monaco-vscode-keybindings-service-override": "4.5.2",
31
- "@codingame/monaco-vscode-quickaccess-service-override": "4.5.2",
32
- "@codingame/monaco-vscode-view-title-bar-service-override": "4.5.2",
33
- "@codingame/monaco-vscode-view-status-bar-service-override": "4.5.2",
34
- "@codingame/monaco-vscode-view-banner-service-override": "4.5.2",
35
- "@codingame/monaco-vscode-view-common-service-override": "4.5.2"
29
+ "vscode": "npm:@codingame/monaco-vscode-api@5.0.0",
30
+ "@codingame/monaco-vscode-keybindings-service-override": "5.0.0",
31
+ "@codingame/monaco-vscode-quickaccess-service-override": "5.0.0",
32
+ "@codingame/monaco-vscode-view-title-bar-service-override": "5.0.0",
33
+ "@codingame/monaco-vscode-view-status-bar-service-override": "5.0.0",
34
+ "@codingame/monaco-vscode-view-banner-service-override": "5.0.0",
35
+ "@codingame/monaco-vscode-view-common-service-override": "5.0.0"
36
36
  }
37
37
  }
package/tools/views.js CHANGED
@@ -34,12 +34,11 @@ export { Parts } from 'vscode/vscode/vs/workbench/services/layout/browser/layout
34
34
  import { IWorkbenchLayoutService } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService.service';
35
35
  import { StandaloneServices } from 'vscode/vscode/vs/editor/standalone/browser/standaloneServices';
36
36
  export { SplitView } from 'vscode/vscode/vs/base/browser/ui/splitview/splitview';
37
- import { fakeActiveGroup } from './editor.js';
38
37
  import { withReadyServices } from 'vscode/services';
39
38
 
40
39
  class InjectedEditorPane extends EditorPane {
41
- constructor(id) {
42
- super(id, fakeActiveGroup, StandaloneServices.get(ITelemetryService), StandaloneServices.get(IThemeService), StandaloneServices.get(IStorageService));
40
+ constructor(id, group) {
41
+ super(id, group, StandaloneServices.get(ITelemetryService), StandaloneServices.get(IThemeService), StandaloneServices.get(IStorageService));
43
42
  }
44
43
  }
45
44
  class SimpleEditorPane extends InjectedEditorPane {
@@ -1,6 +1,6 @@
1
1
  import '@codingame/monaco-vscode-view-common-service-override/vscode/vs/workbench/browser/style';
2
2
  import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
- import { addDisposableListener, runWhenWindowIdle } from 'vscode/vscode/vs/base/browser/dom';
3
+ import { runWhenWindowIdle } from 'vscode/vscode/vs/base/browser/dom';
4
4
  import { Emitter, setGlobalLeakWarningThreshold, Event } from 'vscode/vscode/vs/base/common/event';
5
5
  import { timeout, RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
6
6
  import { isChrome, isFirefox, isSafari } from 'vscode/vscode/vs/base/browser/browser';
@@ -32,8 +32,8 @@ import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/h
32
32
  import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
33
33
  import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
34
34
  import { PixelRatio } from 'vscode/vscode/vs/base/browser/pixelRatio';
35
- import { WorkbenchHoverDelegate } from 'vscode/vscode/vs/platform/hover/browser/hover';
36
- import { setHoverDelegateFactory } from 'vscode/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
35
+ import { AccessibilityProgressSignalScheduler } from 'vscode/vscode/vs/platform/accessibilitySignal/browser/progressAccessibilitySignalScheduler';
36
+ import { setProgressAcccessibilitySignalScheduler } from 'vscode/vscode/vs/base/browser/ui/progressbar/progressAccessibilitySignal';
37
37
 
38
38
  const _moduleId = "vs/workbench/browser/workbench";
39
39
  class Workbench extends Layout {
@@ -50,10 +50,10 @@ class Workbench extends Layout {
50
50
  this.registerErrorHandler(logService);
51
51
  }
52
52
  registerErrorHandler(logService) {
53
- this._register(addDisposableListener(mainWindow, 'unhandledrejection', event => {
53
+ mainWindow.addEventListener('unhandledrejection', (event) => {
54
54
  onUnexpectedError(event.reason);
55
55
  event.preventDefault();
56
- }));
56
+ });
57
57
  setUnexpectedErrorHandler(error => this.handleUnexpectedError(error, logService));
58
58
  if (typeof mainWindow.require?.config === 'function') {
59
59
  mainWindow.require.config({
@@ -95,7 +95,6 @@ class Workbench extends Layout {
95
95
  const hostService = accessor.get(IHostService);
96
96
  const dialogService = accessor.get(IDialogService);
97
97
  const notificationService = accessor.get(INotificationService);
98
- setHoverDelegateFactory((placement, enableInstantHover) => instantiationService.createInstance(WorkbenchHoverDelegate, placement, enableInstantHover, {}));
99
98
  this.initLayout(accessor);
100
99
  this.registerListeners(lifecycleService, storageService, configurationService, hostService, dialogService);
101
100
  this.renderWorkbench(instantiationService, notificationService, storageService, configurationService);
@@ -192,6 +191,7 @@ class Workbench extends Layout {
192
191
  }
193
192
  renderWorkbench(instantiationService, notificationService, storageService, configurationService) {
194
193
  setARIAContainer(this.mainContainer);
194
+ setProgressAcccessibilitySignalScheduler((msDelayTime, msLoopTime) => instantiationService.createInstance(AccessibilityProgressSignalScheduler, msDelayTime, msLoopTime));
195
195
  const platformClass = isWindows ? 'windows' : isLinux ? 'linux' : 'mac';
196
196
  const workbenchClasses = coalesce([
197
197
  'monaco-workbench',
package/tools/editor.js DELETED
@@ -1,588 +0,0 @@
1
- import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
- import { StandaloneServices } from 'vscode/vscode/vs/editor/standalone/browser/standaloneServices';
3
- import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
4
- import { isPreferredGroup, SIDE_GROUP } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
5
- import { isEditorInput, isResourceEditorInput, EditorCloseContext } from 'vscode/vscode/vs/workbench/common/editor';
6
- import { applyTextEditorOptions } from 'vscode/vscode/vs/workbench/common/editor/editorOptions';
7
- import { DEFAULT_EDITOR_MIN_DIMENSIONS, DEFAULT_EDITOR_MAX_DIMENSIONS } from 'vscode/vscode/vs/workbench/browser/parts/editor/editor';
8
- import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
9
- import { StandaloneEditor, StandaloneCodeEditor } from 'vscode/vscode/vs/editor/standalone/browser/standaloneCodeEditor';
10
- import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
11
- import { EditorService } from 'vscode/vscode/vs/workbench/services/editor/browser/editorService';
12
- import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
13
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
14
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
15
- import { IWorkspaceTrustRequestService } from 'vscode/vscode/vs/platform/workspace/common/workspaceTrust.service';
16
- import { IEditorResolverService } from 'vscode/vscode/vs/workbench/services/editor/common/editorResolverService.service';
17
- import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
18
- import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
19
- import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
20
- import { ITextEditorService } from 'vscode/vscode/vs/workbench/services/textfile/common/textEditorService.service';
21
- import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host.service';
22
- import { Event, Emitter } from 'vscode/vscode/vs/base/common/event';
23
- import { TextResourceEditorInput } from 'vscode/vscode/vs/workbench/common/editor/textResourceEditorInput';
24
- import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
25
- import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
26
- import { unsupported } from '../tools.js';
27
-
28
- var StandaloneEditorGroup_1;
29
- class EmptyEditorGroup {
30
- constructor() {
31
- this.isTransient = () => false;
32
- this.windowId = mainWindow.vscodeWindowId;
33
- this.createEditorActions = unsupported;
34
- this.onDidFocus = Event.None;
35
- this.onDidOpenEditorFail = Event.None;
36
- this.whenRestored = Promise.resolve();
37
- this.disposed = false;
38
- this.setActive = unsupported;
39
- this.notifyIndexChanged = unsupported;
40
- this.relayout = unsupported;
41
- this.dispose = unsupported;
42
- this.toJSON = unsupported;
43
- this.minimumWidth = 0;
44
- this.maximumWidth = Number.POSITIVE_INFINITY;
45
- this.minimumHeight = 0;
46
- this.maximumHeight = Number.POSITIVE_INFINITY;
47
- this.onDidChange = Event.None;
48
- this.layout = unsupported;
49
- this.onDidModelChange = Event.None;
50
- this.onWillDispose = Event.None;
51
- this.onDidActiveEditorChange = Event.None;
52
- this.onWillCloseEditor = Event.None;
53
- this.onDidCloseEditor = Event.None;
54
- this.onWillMoveEditor = Event.None;
55
- this.onWillOpenEditor = Event.None;
56
- this.id = 0;
57
- this.index = 0;
58
- this.label = 'main';
59
- this.ariaLabel = 'main';
60
- this.activeEditorPane = undefined;
61
- this.activeEditor = null;
62
- this.previewEditor = null;
63
- this.count = 0;
64
- this.isEmpty = false;
65
- this.isLocked = false;
66
- this.stickyCount = 0;
67
- this.editors = [];
68
- this.getEditors = () => [];
69
- this.findEditors = () => [];
70
- this.getEditorByIndex = () => undefined;
71
- this.getIndexOfEditor = unsupported;
72
- this.openEditor = unsupported;
73
- this.openEditors = unsupported;
74
- this.isPinned = () => false;
75
- this.isSticky = () => false;
76
- this.isActive = () => false;
77
- this.contains = () => false;
78
- this.moveEditor = unsupported;
79
- this.moveEditors = unsupported;
80
- this.copyEditor = unsupported;
81
- this.copyEditors = unsupported;
82
- this.closeEditor = unsupported;
83
- this.closeEditors = unsupported;
84
- this.closeAllEditors = unsupported;
85
- this.replaceEditors = unsupported;
86
- this.pinEditor = () => { };
87
- this.stickEditor = () => { };
88
- this.unstickEditor = () => { };
89
- this.lock = () => { };
90
- this.isFirst = unsupported;
91
- this.isLast = unsupported;
92
- }
93
- get groupsView() {
94
- return unsupported();
95
- }
96
- notifyLabelChanged() { }
97
- get titleHeight() {
98
- return unsupported();
99
- }
100
- get element() {
101
- return unsupported();
102
- }
103
- get scopedContextKeyService() { return StandaloneServices.get(IContextKeyService); }
104
- focus() {
105
- }
106
- }
107
- const fakeActiveGroup = new EmptyEditorGroup();
108
- class SimpleEditorPane {
109
- constructor(editor) {
110
- this.editor = editor;
111
- this.onDidChangeControl = Event.None;
112
- this.onDidChangeSizeConstraints = Event.None;
113
- this.onDidFocus = Event.None;
114
- this.onDidBlur = Event.None;
115
- this.input = undefined;
116
- this.options = undefined;
117
- this.group = fakeActiveGroup;
118
- this.scopedContextKeyService = undefined;
119
- this.getViewState = unsupported;
120
- this.isVisible = unsupported;
121
- this.hasFocus = unsupported;
122
- this.getId = unsupported;
123
- this.getTitle = unsupported;
124
- this.focus = unsupported;
125
- }
126
- get minimumWidth() { return DEFAULT_EDITOR_MIN_DIMENSIONS.width; }
127
- get maximumWidth() { return DEFAULT_EDITOR_MAX_DIMENSIONS.width; }
128
- get minimumHeight() { return DEFAULT_EDITOR_MIN_DIMENSIONS.height; }
129
- get maximumHeight() { return DEFAULT_EDITOR_MAX_DIMENSIONS.height; }
130
- getControl() {
131
- return this.editor;
132
- }
133
- }
134
- function wrapOpenEditor(textModelService, defaultBehavior, fallbackBahavior) {
135
- async function openEditor(editor, optionsOrPreferredGroup, preferredGroup) {
136
- const options = isEditorInput(editor) ? optionsOrPreferredGroup : editor.options;
137
- if (isPreferredGroup(optionsOrPreferredGroup)) {
138
- preferredGroup = optionsOrPreferredGroup;
139
- }
140
- const resource = isResourceEditorInput(editor) || isEditorInput(editor) ? editor.resource : undefined;
141
- if (resource == null || !textModelService.canHandleResource(resource)) {
142
- return defaultBehavior(editor, optionsOrPreferredGroup, preferredGroup);
143
- }
144
- let modelEditor;
145
- const codeEditors = StandaloneServices.get(ICodeEditorService).listCodeEditors();
146
- modelEditor = codeEditors.find(editor => editor instanceof StandaloneEditor && editor.getModel() != null && ( editor.getModel().uri.toString()) === ( resource.toString()));
147
- if (modelEditor == null) {
148
- const defaultBehaviorResult = await defaultBehavior(editor, optionsOrPreferredGroup, preferredGroup);
149
- if (defaultBehaviorResult != null) {
150
- return defaultBehaviorResult;
151
- }
152
- const modelRef = await textModelService.createModelReference(resource);
153
- modelEditor = await fallbackBahavior?.(modelRef, options, preferredGroup === SIDE_GROUP);
154
- if (modelEditor == null) {
155
- modelRef.dispose();
156
- return undefined;
157
- }
158
- }
159
- if (options != null) {
160
- applyTextEditorOptions(options, modelEditor, 1 );
161
- }
162
- if (!(options?.preserveFocus ?? false)) {
163
- modelEditor.focus();
164
- modelEditor.getContainerDomNode().scrollIntoView();
165
- }
166
- return new SimpleEditorPane(modelEditor);
167
- }
168
- return openEditor;
169
- }
170
- let MonacoEditorService = class MonacoEditorService extends EditorService {
171
- constructor(_openEditorFallback, _isEditorPartVisible, _editorGroupService, instantiationService, fileService, configurationService, contextService, uriIdentityService, editorResolverService, workspaceTrustRequestService, hostService, textEditorService, textModelService) {
172
- super(undefined, _editorGroupService, instantiationService, fileService, configurationService, contextService, uriIdentityService, editorResolverService, workspaceTrustRequestService, hostService, textEditorService);
173
- this._isEditorPartVisible = _isEditorPartVisible;
174
- this.openEditor = wrapOpenEditor(textModelService, this.openEditor.bind(this), _openEditorFallback);
175
- }
176
- get activeTextEditorControl() {
177
- const focusedCodeEditor = StandaloneServices.get(ICodeEditorService).getFocusedCodeEditor();
178
- if (focusedCodeEditor != null && focusedCodeEditor instanceof StandaloneCodeEditor) {
179
- return focusedCodeEditor;
180
- }
181
- return super.activeTextEditorControl;
182
- }
183
- async openEditor(editor, optionsOrPreferredGroup, preferredGroup) {
184
- if (!this._isEditorPartVisible()) {
185
- return undefined;
186
- }
187
- return super.openEditor(editor, optionsOrPreferredGroup, preferredGroup);
188
- }
189
- };
190
- MonacoEditorService = __decorate([
191
- ( __param(2, IEditorGroupsService)),
192
- ( __param(3, IInstantiationService)),
193
- ( __param(4, IFileService)),
194
- ( __param(5, IConfigurationService)),
195
- ( __param(6, IWorkspaceContextService)),
196
- ( __param(7, IUriIdentityService)),
197
- ( __param(8, IEditorResolverService)),
198
- ( __param(9, IWorkspaceTrustRequestService)),
199
- ( __param(10, IHostService)),
200
- ( __param(11, ITextEditorService)),
201
- ( __param(12, ITextModelService))
202
- ], MonacoEditorService);
203
- class StandaloneEditorPane {
204
- constructor(editor, input, group) {
205
- this.editor = editor;
206
- this.input = input;
207
- this.group = group;
208
- this.onDidChangeControl = Event.None;
209
- this.options = undefined;
210
- this.minimumWidth = 0;
211
- this.maximumWidth = Number.POSITIVE_INFINITY;
212
- this.minimumHeight = 0;
213
- this.maximumHeight = Number.POSITIVE_INFINITY;
214
- this.onDidChangeSizeConstraints = Event.None;
215
- this.scopedContextKeyService = undefined;
216
- this.onDidFocus = this.editor.onDidFocusEditorWidget;
217
- this.onDidBlur = this.editor.onDidBlurEditorWidget;
218
- }
219
- getControl() {
220
- return this.editor;
221
- }
222
- getViewState() {
223
- return undefined;
224
- }
225
- isVisible() {
226
- return true;
227
- }
228
- hasFocus() {
229
- return this.editor.hasWidgetFocus();
230
- }
231
- getId() {
232
- return this.editor.getId();
233
- }
234
- getTitle() {
235
- return undefined;
236
- }
237
- focus() {
238
- this.editor.focus();
239
- }
240
- }
241
- let StandaloneEditorGroup = StandaloneEditorGroup_1 = class StandaloneEditorGroup extends Disposable {
242
- constructor(editor, instantiationService, scopedContextKeyService) {
243
- super();
244
- this.editor = editor;
245
- this.scopedContextKeyService = scopedContextKeyService;
246
- this.active = false;
247
- this.isTransient = () => false;
248
- this.windowId = mainWindow.vscodeWindowId;
249
- this.onDidFocus = this.editor.onDidFocusEditorWidget;
250
- this.onDidOpenEditorFail = Event.None;
251
- this.whenRestored = Promise.resolve();
252
- this.disposed = false;
253
- this.notifyIndexChanged = unsupported;
254
- this.relayout = unsupported;
255
- this.toJSON = unsupported;
256
- this.minimumWidth = 0;
257
- this.maximumWidth = Number.POSITIVE_INFINITY;
258
- this.minimumHeight = 0;
259
- this.maximumHeight = Number.POSITIVE_INFINITY;
260
- this.onDidChange = this.editor.onDidLayoutChange;
261
- this.layout = () => this.editor.layout();
262
- this._onDidModelChange = new Emitter();
263
- this.onDidModelChange = this._onDidModelChange.event;
264
- this.onWillDispose = this.editor.onDidDispose;
265
- this._onDidActiveEditorChange = new Emitter();
266
- this.onDidActiveEditorChange = this._onDidActiveEditorChange.event;
267
- this.onWillCloseEditor = Event.None;
268
- this._onDidCloseEditor = new Emitter();
269
- this.onDidCloseEditor = this._onDidCloseEditor.event;
270
- this.onWillMoveEditor = Event.None;
271
- this._onWillOpenEditor = new Emitter();
272
- this.onWillOpenEditor = this._onWillOpenEditor.event;
273
- this.id = --StandaloneEditorGroup_1.idCounter;
274
- this.index = -1;
275
- this.label = `standalone editor ${-this.id}`;
276
- this.ariaLabel = `standalone editor ${-this.id}`;
277
- this.previewEditor = null;
278
- this.isLocked = true;
279
- this.stickyCount = 0;
280
- this.getEditors = () => this.editors;
281
- this.findEditors = (resource) => this.pane != null && ( resource.toString()) === ( this.pane.input.resource.toString()) ? [this.pane.input] : [];
282
- this.getEditorByIndex = (index) => this.pane != null && index === 0 ? this.pane.input : undefined;
283
- this.getIndexOfEditor = (editorInput) => this.pane != null && this.pane.input === editorInput ? 0 : -1;
284
- this.openEditor = async (editor) => {
285
- if (editor.isDisposed()) {
286
- return undefined;
287
- }
288
- if (editor instanceof TextResourceEditorInput && ( editor.resource.toString()) === this.pane?.input.resource.toString()) {
289
- this.focus();
290
- return this.pane;
291
- }
292
- return undefined;
293
- };
294
- this.openEditors = async (editors) => {
295
- if (editors.length === 1) {
296
- return this.openEditor(editors[0].editor);
297
- }
298
- return undefined;
299
- };
300
- this.isPinned = () => false;
301
- this.isSticky = () => false;
302
- this.isActive = () => this.editor.hasWidgetFocus();
303
- this.contains = (candidate) => {
304
- return this.pane != null && this.pane.input === candidate;
305
- };
306
- this.moveEditor = unsupported;
307
- this.moveEditors = unsupported;
308
- this.copyEditor = unsupported;
309
- this.copyEditors = unsupported;
310
- this.closeEditor = unsupported;
311
- this.closeEditors = unsupported;
312
- this.closeAllEditors = unsupported;
313
- this.replaceEditors = unsupported;
314
- this.pinEditor = () => { };
315
- this.stickEditor = () => { };
316
- this.unstickEditor = () => { };
317
- this.lock = () => { };
318
- this.isFirst = unsupported;
319
- this.isLast = unsupported;
320
- const onNewModel = (uri) => {
321
- const editorInput = instantiationService.createInstance(TextResourceEditorInput, uri, undefined, undefined, undefined, undefined);
322
- this._onWillOpenEditor.fire({
323
- editor: editorInput,
324
- groupId: this.id
325
- });
326
- this.pane = new StandaloneEditorPane(editor, editorInput, this);
327
- this._onDidModelChange.fire({
328
- kind: 4 ,
329
- editor: editorInput,
330
- editorIndex: 0
331
- });
332
- this._onDidActiveEditorChange.fire({
333
- editor: editorInput
334
- });
335
- };
336
- const onRemovedModel = (uri) => {
337
- if (this.pane != null && ( this.pane.input.resource.toString()) === ( uri.toString())) {
338
- const pane = this.pane;
339
- this.pane = undefined;
340
- this._onDidModelChange.fire({
341
- kind: 5 ,
342
- editorIndex: 0
343
- });
344
- this._onDidActiveEditorChange.fire({
345
- editor: undefined
346
- });
347
- this._onDidCloseEditor.fire({
348
- context: EditorCloseContext.UNKNOWN,
349
- editor: pane.input,
350
- groupId: this.id,
351
- index: 0,
352
- sticky: false
353
- });
354
- }
355
- };
356
- editor.onDidChangeModel((e) => {
357
- if (e.oldModelUrl != null) {
358
- onRemovedModel(e.oldModelUrl);
359
- }
360
- if (e.newModelUrl != null) {
361
- onNewModel(e.newModelUrl);
362
- }
363
- });
364
- this._register({
365
- dispose: () => {
366
- const model = editor.getModel();
367
- if (model != null) {
368
- onRemovedModel(model.uri);
369
- }
370
- }
371
- });
372
- const currentModel = editor.getModel();
373
- if (currentModel != null) {
374
- const editorInput = instantiationService.createInstance(TextResourceEditorInput, currentModel.uri, undefined, undefined, undefined, undefined);
375
- this.pane = new StandaloneEditorPane(editor, editorInput, this);
376
- }
377
- }
378
- get groupsView() {
379
- return unsupported();
380
- }
381
- notifyLabelChanged() { }
382
- createEditorActions() {
383
- return {
384
- actions: {
385
- primary: [],
386
- secondary: []
387
- },
388
- onDidChange: Event.None
389
- };
390
- }
391
- get titleHeight() { return unsupported(); }
392
- setActive(isActive) {
393
- this.active = isActive;
394
- }
395
- get element() {
396
- return this.editor.getContainerDomNode();
397
- }
398
- get activeEditorPane() {
399
- return this.pane;
400
- }
401
- get activeEditor() {
402
- return this.pane?.input ?? null;
403
- }
404
- get count() {
405
- return this.pane != null ? 1 : 0;
406
- }
407
- get isEmpty() {
408
- return this.pane == null;
409
- }
410
- get editors() {
411
- return this.pane != null ? [this.pane.input] : [];
412
- }
413
- focus() {
414
- this.editor.focus();
415
- this.editor.getContainerDomNode().scrollIntoView();
416
- }
417
- };
418
- StandaloneEditorGroup.idCounter = 0;
419
- StandaloneEditorGroup = StandaloneEditorGroup_1 = __decorate([
420
- ( __param(1, IInstantiationService)),
421
- ( __param(2, IContextKeyService))
422
- ], StandaloneEditorGroup);
423
- let MonacoDelegateEditorGroupsService = class MonacoDelegateEditorGroupsService extends Disposable {
424
- constructor(delegate, instantiationService) {
425
- super();
426
- this.delegate = delegate;
427
- this._serviceBrand = undefined;
428
- this.additionalGroups = [];
429
- this.activeGroupOverride = undefined;
430
- this.onDidCreateAuxiliaryEditorPart = this.delegate.onDidCreateAuxiliaryEditorPart;
431
- this.onDidChangeGroupMaximized = this.delegate.onDidChangeGroupMaximized;
432
- this._onDidChangeActiveGroup = new Emitter();
433
- this.onDidChangeActiveGroup = Event.any(this._onDidChangeActiveGroup.event, this.delegate.onDidChangeActiveGroup);
434
- this._onDidAddGroup = new Emitter();
435
- this.onDidAddGroup = Event.any(this._onDidAddGroup.event, this.delegate.onDidAddGroup);
436
- this._onDidRemoveGroup = new Emitter();
437
- this.onDidRemoveGroup = Event.any(this._onDidRemoveGroup.event, this.delegate.onDidRemoveGroup);
438
- this.onDidMoveGroup = this.delegate.onDidMoveGroup;
439
- this.onDidActivateGroup = this.delegate.onDidActivateGroup;
440
- this.onDidChangeGroupIndex = this.delegate.onDidChangeGroupIndex;
441
- this.onDidChangeGroupLocked = this.delegate.onDidChangeGroupLocked;
442
- this.getLayout = () => {
443
- return this.delegate.getLayout();
444
- };
445
- this.getGroups = (order) => {
446
- return [...this.delegate.getGroups(order), ...this.additionalGroups];
447
- };
448
- this.getGroup = (identifier) => {
449
- return this.delegate.getGroup(identifier) ?? this.additionalGroups.find(group => group.id === identifier);
450
- };
451
- this.activateGroup = (...args) => {
452
- return this.delegate.activateGroup(...args);
453
- };
454
- this.getSize = (...args) => {
455
- return this.delegate.getSize(...args);
456
- };
457
- this.setSize = (...args) => {
458
- return this.delegate.setSize(...args);
459
- };
460
- this.arrangeGroups = (...args) => {
461
- return this.delegate.arrangeGroups(...args);
462
- };
463
- this.applyLayout = (...args) => {
464
- return this.delegate.applyLayout(...args);
465
- };
466
- this.setGroupOrientation = (...args) => {
467
- return this.delegate.setGroupOrientation(...args);
468
- };
469
- this.findGroup = (...args) => {
470
- return this.delegate.findGroup(...args);
471
- };
472
- this.addGroup = (...args) => {
473
- return this.delegate.addGroup(...args);
474
- };
475
- this.removeGroup = (...args) => {
476
- return this.delegate.removeGroup(...args);
477
- };
478
- this.moveGroup = (...args) => {
479
- return this.delegate.moveGroup(...args);
480
- };
481
- this.mergeGroup = (...args) => {
482
- return this.delegate.mergeGroup(...args);
483
- };
484
- this.mergeAllGroups = (...args) => {
485
- return this.delegate.mergeAllGroups(...args);
486
- };
487
- this.copyGroup = (...args) => {
488
- return this.delegate.copyGroup(...args);
489
- };
490
- this.onDidChangeEditorPartOptions = this.delegate.onDidChangeEditorPartOptions;
491
- setTimeout(() => {
492
- const codeEditorService = StandaloneServices.get(ICodeEditorService);
493
- const handleCodeEditor = (editor) => {
494
- if (editor instanceof StandaloneEditor) {
495
- let timeout;
496
- const onEditorFocused = () => {
497
- if (timeout != null)
498
- window.clearTimeout(timeout);
499
- this.activeGroupOverride = this.additionalGroups.find(group => group.editor === editor);
500
- this._onDidChangeActiveGroup.fire(this.activeGroup);
501
- };
502
- const onEditorBlurred = () => {
503
- if (timeout != null)
504
- window.clearTimeout(timeout);
505
- timeout = window.setTimeout(() => {
506
- timeout = undefined;
507
- if (this.activeGroupOverride === this.additionalGroups.find(group => group.editor === editor)) {
508
- this.activeGroupOverride = undefined;
509
- this._onDidChangeActiveGroup.fire(this.activeGroup);
510
- }
511
- }, 100);
512
- };
513
- editor.onDidFocusEditorText(onEditorFocused);
514
- editor.onDidFocusEditorWidget(onEditorFocused);
515
- editor.onDidBlurEditorText(onEditorBlurred);
516
- editor.onDidBlurEditorWidget(onEditorBlurred);
517
- if (editor.hasWidgetFocus()) {
518
- onEditorFocused();
519
- }
520
- const newGroup = instantiationService.createInstance(StandaloneEditorGroup, editor);
521
- this.additionalGroups.push(newGroup);
522
- this._onDidAddGroup.fire(newGroup);
523
- }
524
- };
525
- const handleCodeEditorRemoved = (editor) => {
526
- if (editor instanceof StandaloneEditor) {
527
- const removedGroup = this.additionalGroups.find(group => group.editor === editor);
528
- if (removedGroup != null) {
529
- removedGroup.dispose();
530
- if (this.activeGroupOverride === removedGroup) {
531
- this.activeGroupOverride = undefined;
532
- this._onDidChangeActiveGroup.fire(this.activeGroup);
533
- }
534
- this.additionalGroups = this.additionalGroups.filter(group => group !== removedGroup);
535
- this._onDidRemoveGroup.fire(removedGroup);
536
- }
537
- }
538
- };
539
- this._register(codeEditorService.onCodeEditorAdd(handleCodeEditor));
540
- this._register(codeEditorService.onCodeEditorRemove(handleCodeEditorRemoved));
541
- codeEditorService.listCodeEditors().forEach(handleCodeEditor);
542
- });
543
- }
544
- get isReady() {
545
- return this.delegate.isReady;
546
- }
547
- get whenReady() {
548
- return this.delegate.whenReady;
549
- }
550
- get whenRestored() {
551
- return this.delegate.whenRestored;
552
- }
553
- get hasRestorableState() {
554
- return this.delegate.hasRestorableState;
555
- }
556
- get parts() { return this.delegate.parts; }
557
- createAuxiliaryEditorPart(options) {
558
- return this.delegate.createAuxiliaryEditorPart(options);
559
- }
560
- get mainPart() { return this.delegate.mainPart; }
561
- getPart(container) {
562
- return this.delegate.getPart(container);
563
- }
564
- toggleMaximizeGroup(group) {
565
- return this.delegate.toggleMaximizeGroup(group);
566
- }
567
- toggleExpandGroup(group) {
568
- return this.delegate.toggleExpandGroup(group);
569
- }
570
- createEditorDropTarget(container, delegate) {
571
- return this.delegate.createEditorDropTarget(container, delegate);
572
- }
573
- get groups() {
574
- return [...this.additionalGroups, ...this.delegate.groups];
575
- }
576
- get activeGroup() {
577
- return this.activeGroupOverride ?? this.delegate.activeGroup;
578
- }
579
- get sideGroup() { return this.delegate.sideGroup; }
580
- get count() { return this.delegate.count + this.additionalGroups.length; }
581
- get orientation() { return this.delegate.orientation; }
582
- get partOptions() { return this.delegate.partOptions; }
583
- };
584
- MonacoDelegateEditorGroupsService = __decorate([
585
- ( __param(1, IInstantiationService))
586
- ], MonacoDelegateEditorGroupsService);
587
-
588
- export { MonacoDelegateEditorGroupsService, MonacoEditorService, fakeActiveGroup, wrapOpenEditor };
package/tools.js DELETED
@@ -1,42 +0,0 @@
1
- function unsupported() {
2
- throw new Error('unsupported');
3
- }
4
- function memoized(fct) {
5
- let v = null;
6
- return (...args) => {
7
- if (v == null) {
8
- v = fct(...args);
9
- }
10
- return v;
11
- };
12
- }
13
- function memoizedConstructor(ctor) {
14
- return new Proxy(ctor, {
15
- construct: memoized((target, args) => {
16
- return Reflect.construct(ctor, args);
17
- })
18
- });
19
- }
20
- async function sleep(duration) {
21
- await new Promise(resolve => setTimeout(resolve, duration));
22
- }
23
- function throttle(fct, merge, delay) {
24
- let lastPromise = Promise.resolve();
25
- let toConsume = null;
26
- return async (param) => {
27
- if (toConsume == null) {
28
- toConsume = param;
29
- lastPromise = lastPromise.then(async () => sleep(delay)).then(async () => {
30
- const _toConsume = toConsume;
31
- toConsume = null;
32
- await fct(_toConsume);
33
- });
34
- }
35
- else {
36
- toConsume = merge(toConsume, param);
37
- }
38
- await lastPromise;
39
- };
40
- }
41
-
42
- export { memoized, memoizedConstructor, sleep, throttle, unsupported };