@codingame/monaco-vscode-editor-service-override 9.0.3 → 10.0.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.
- package/editor.js +12 -4
- package/package.json +2 -2
- package/tools/editor.js +60 -22
- package/tools.js +4 -2
package/editor.js
CHANGED
|
@@ -64,8 +64,12 @@ class EmptyEditorPart {
|
|
|
64
64
|
this.onDidChangeEditorPartOptions = Event.None;
|
|
65
65
|
this.createEditorDropTarget = unsupported;
|
|
66
66
|
}
|
|
67
|
-
get contentDimension() {
|
|
68
|
-
|
|
67
|
+
get contentDimension() {
|
|
68
|
+
return unsupported();
|
|
69
|
+
}
|
|
70
|
+
get sideGroup() {
|
|
71
|
+
return unsupported();
|
|
72
|
+
}
|
|
69
73
|
}
|
|
70
74
|
class EmptyEditorGroupsService {
|
|
71
75
|
constructor() {
|
|
@@ -125,8 +129,12 @@ class EmptyEditorGroupsService {
|
|
|
125
129
|
this.onDidChangeEditorPartOptions = Event.None;
|
|
126
130
|
this.enforcePartOptions = unsupported;
|
|
127
131
|
}
|
|
128
|
-
get contentDimension() {
|
|
129
|
-
|
|
132
|
+
get contentDimension() {
|
|
133
|
+
return unsupported();
|
|
134
|
+
}
|
|
135
|
+
get sideGroup() {
|
|
136
|
+
return unsupported();
|
|
137
|
+
}
|
|
130
138
|
}
|
|
131
139
|
let MonacoEditorGroupsService = class MonacoEditorGroupsService extends MonacoDelegateEditorGroupsService {
|
|
132
140
|
constructor(instantiationService) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-editor-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@10.0.1"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/tools/editor.js
CHANGED
|
@@ -103,7 +103,9 @@ class EmptyEditorGroup {
|
|
|
103
103
|
get element() {
|
|
104
104
|
return unsupported();
|
|
105
105
|
}
|
|
106
|
-
get scopedContextKeyService() {
|
|
106
|
+
get scopedContextKeyService() {
|
|
107
|
+
return StandaloneServices.get(IContextKeyService);
|
|
108
|
+
}
|
|
107
109
|
focus() {
|
|
108
110
|
}
|
|
109
111
|
}
|
|
@@ -126,17 +128,27 @@ class SimpleEditorPane {
|
|
|
126
128
|
this.getTitle = unsupported;
|
|
127
129
|
this.focus = unsupported;
|
|
128
130
|
}
|
|
129
|
-
get minimumWidth() {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
get
|
|
131
|
+
get minimumWidth() {
|
|
132
|
+
return DEFAULT_EDITOR_MIN_DIMENSIONS.width;
|
|
133
|
+
}
|
|
134
|
+
get maximumWidth() {
|
|
135
|
+
return DEFAULT_EDITOR_MAX_DIMENSIONS.width;
|
|
136
|
+
}
|
|
137
|
+
get minimumHeight() {
|
|
138
|
+
return DEFAULT_EDITOR_MIN_DIMENSIONS.height;
|
|
139
|
+
}
|
|
140
|
+
get maximumHeight() {
|
|
141
|
+
return DEFAULT_EDITOR_MAX_DIMENSIONS.height;
|
|
142
|
+
}
|
|
133
143
|
getControl() {
|
|
134
144
|
return this.editor;
|
|
135
145
|
}
|
|
136
146
|
}
|
|
137
147
|
function wrapOpenEditor(textModelService, defaultBehavior, fallbackBahavior) {
|
|
138
148
|
async function openEditor(editor, optionsOrPreferredGroup, preferredGroup) {
|
|
139
|
-
const options = isEditorInput(editor)
|
|
149
|
+
const options = isEditorInput(editor)
|
|
150
|
+
? optionsOrPreferredGroup
|
|
151
|
+
: editor.options;
|
|
140
152
|
if (isPreferredGroup(optionsOrPreferredGroup)) {
|
|
141
153
|
preferredGroup = optionsOrPreferredGroup;
|
|
142
154
|
}
|
|
@@ -146,9 +158,13 @@ function wrapOpenEditor(textModelService, defaultBehavior, fallbackBahavior) {
|
|
|
146
158
|
}
|
|
147
159
|
let modelEditor;
|
|
148
160
|
const codeEditors = StandaloneServices.get(ICodeEditorService).listCodeEditors();
|
|
149
|
-
modelEditor = codeEditors.find(editor => editor instanceof StandaloneEditor &&
|
|
161
|
+
modelEditor = codeEditors.find((editor) => editor instanceof StandaloneEditor &&
|
|
162
|
+
editor.getModel() != null &&
|
|
163
|
+
( editor.getModel().uri.toString()) === ( resource.toString()));
|
|
150
164
|
if (modelEditor == null) {
|
|
151
|
-
const defaultBehaviorResult = await defaultBehavior(
|
|
165
|
+
const defaultBehaviorResult = await defaultBehavior(
|
|
166
|
+
editor,
|
|
167
|
+
optionsOrPreferredGroup, preferredGroup);
|
|
152
168
|
if (defaultBehaviorResult != null) {
|
|
153
169
|
return defaultBehaviorResult;
|
|
154
170
|
}
|
|
@@ -284,14 +300,17 @@ let StandaloneEditorGroup = StandaloneEditorGroup_1 = class StandaloneEditorGrou
|
|
|
284
300
|
this.isLocked = true;
|
|
285
301
|
this.stickyCount = 0;
|
|
286
302
|
this.getEditors = () => this.editors;
|
|
287
|
-
this.findEditors = (resource) => this.pane != null && ( resource.toString()) === ( this.pane.input.resource.toString())
|
|
303
|
+
this.findEditors = (resource) => this.pane != null && ( resource.toString()) === ( this.pane.input.resource.toString())
|
|
304
|
+
? [this.pane.input]
|
|
305
|
+
: [];
|
|
288
306
|
this.getEditorByIndex = (index) => this.pane != null && index === 0 ? this.pane.input : undefined;
|
|
289
307
|
this.getIndexOfEditor = (editorInput) => this.pane != null && this.pane.input === editorInput ? 0 : -1;
|
|
290
308
|
this.openEditor = async (editor) => {
|
|
291
309
|
if (editor.isDisposed()) {
|
|
292
310
|
return undefined;
|
|
293
311
|
}
|
|
294
|
-
if (editor instanceof TextResourceEditorInput &&
|
|
312
|
+
if (editor instanceof TextResourceEditorInput &&
|
|
313
|
+
( editor.resource.toString()) === this.pane?.input.resource.toString()) {
|
|
295
314
|
this.focus();
|
|
296
315
|
return this.pane;
|
|
297
316
|
}
|
|
@@ -394,7 +413,9 @@ let StandaloneEditorGroup = StandaloneEditorGroup_1 = class StandaloneEditorGrou
|
|
|
394
413
|
onDidChange: Event.None
|
|
395
414
|
};
|
|
396
415
|
}
|
|
397
|
-
get titleHeight() {
|
|
416
|
+
get titleHeight() {
|
|
417
|
+
return unsupported();
|
|
418
|
+
}
|
|
398
419
|
setActive(isActive) {
|
|
399
420
|
this.active = isActive;
|
|
400
421
|
}
|
|
@@ -453,7 +474,8 @@ let MonacoDelegateEditorGroupsService = class MonacoDelegateEditorGroupsService
|
|
|
453
474
|
return [...this.delegate.getGroups(order), ...this.additionalGroups];
|
|
454
475
|
};
|
|
455
476
|
this.getGroup = (identifier) => {
|
|
456
|
-
return this.delegate.getGroup(identifier) ??
|
|
477
|
+
return (this.delegate.getGroup(identifier) ??
|
|
478
|
+
this.additionalGroups.find((group) => group.id === identifier));
|
|
457
479
|
};
|
|
458
480
|
this.activateGroup = (...args) => {
|
|
459
481
|
return this.delegate.activateGroup(...args);
|
|
@@ -501,14 +523,18 @@ let MonacoDelegateEditorGroupsService = class MonacoDelegateEditorGroupsService
|
|
|
501
523
|
if (editor instanceof StandaloneEditor) {
|
|
502
524
|
let timeout;
|
|
503
525
|
const updateActiveGroup = (editor) => {
|
|
504
|
-
const newActiveGroup = editor != null
|
|
526
|
+
const newActiveGroup = editor != null
|
|
527
|
+
? this.additionalGroups.find((group) => group.editor === editor)
|
|
528
|
+
: undefined;
|
|
505
529
|
if (this.activeGroupOverride !== newActiveGroup) {
|
|
506
530
|
this.activeGroupOverride = newActiveGroup;
|
|
507
531
|
this._onDidChangeActiveGroup.fire(this.activeGroup);
|
|
508
532
|
}
|
|
509
533
|
};
|
|
510
534
|
const removeActiveGroup = (editor) => {
|
|
511
|
-
if (!emptyDelegate &&
|
|
535
|
+
if (!emptyDelegate &&
|
|
536
|
+
this.activeGroupOverride ===
|
|
537
|
+
this.additionalGroups.find((group) => group.editor === editor)) {
|
|
512
538
|
updateActiveGroup(undefined);
|
|
513
539
|
}
|
|
514
540
|
};
|
|
@@ -542,14 +568,14 @@ let MonacoDelegateEditorGroupsService = class MonacoDelegateEditorGroupsService
|
|
|
542
568
|
};
|
|
543
569
|
const handleCodeEditorRemoved = (editor) => {
|
|
544
570
|
if (editor instanceof StandaloneEditor) {
|
|
545
|
-
const removedGroup = this.additionalGroups.find(group => group.editor === editor);
|
|
571
|
+
const removedGroup = this.additionalGroups.find((group) => group.editor === editor);
|
|
546
572
|
if (removedGroup != null) {
|
|
547
573
|
removedGroup.dispose();
|
|
548
574
|
if (this.activeGroupOverride === removedGroup) {
|
|
549
575
|
this.activeGroupOverride = undefined;
|
|
550
576
|
this._onDidChangeActiveGroup.fire(this.activeGroup);
|
|
551
577
|
}
|
|
552
|
-
this.additionalGroups = this.additionalGroups.filter(group => group !== removedGroup);
|
|
578
|
+
this.additionalGroups = this.additionalGroups.filter((group) => group !== removedGroup);
|
|
553
579
|
this._onDidRemoveGroup.fire(removedGroup);
|
|
554
580
|
}
|
|
555
581
|
}
|
|
@@ -589,11 +615,15 @@ let MonacoDelegateEditorGroupsService = class MonacoDelegateEditorGroupsService
|
|
|
589
615
|
get hasRestorableState() {
|
|
590
616
|
return this.delegate.hasRestorableState;
|
|
591
617
|
}
|
|
592
|
-
get parts() {
|
|
618
|
+
get parts() {
|
|
619
|
+
return this.delegate.parts;
|
|
620
|
+
}
|
|
593
621
|
createAuxiliaryEditorPart(options) {
|
|
594
622
|
return this.delegate.createAuxiliaryEditorPart(options);
|
|
595
623
|
}
|
|
596
|
-
get mainPart() {
|
|
624
|
+
get mainPart() {
|
|
625
|
+
return this.delegate.mainPart;
|
|
626
|
+
}
|
|
597
627
|
getPart(container) {
|
|
598
628
|
return this.delegate.getPart(container);
|
|
599
629
|
}
|
|
@@ -612,10 +642,18 @@ let MonacoDelegateEditorGroupsService = class MonacoDelegateEditorGroupsService
|
|
|
612
642
|
get activeGroup() {
|
|
613
643
|
return this.activeGroupOverride ?? this.delegate.activeGroup;
|
|
614
644
|
}
|
|
615
|
-
get sideGroup() {
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
get
|
|
645
|
+
get sideGroup() {
|
|
646
|
+
return this.delegate.sideGroup;
|
|
647
|
+
}
|
|
648
|
+
get count() {
|
|
649
|
+
return this.delegate.count + this.additionalGroups.length;
|
|
650
|
+
}
|
|
651
|
+
get orientation() {
|
|
652
|
+
return this.delegate.orientation;
|
|
653
|
+
}
|
|
654
|
+
get partOptions() {
|
|
655
|
+
return this.delegate.partOptions;
|
|
656
|
+
}
|
|
619
657
|
};
|
|
620
658
|
MonacoDelegateEditorGroupsService = __decorate([
|
|
621
659
|
( __param(2, IInstantiationService))
|
package/tools.js
CHANGED
|
@@ -18,7 +18,7 @@ function memoizedConstructor(ctor) {
|
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
async function sleep(duration) {
|
|
21
|
-
await new Promise(resolve => setTimeout(resolve, duration));
|
|
21
|
+
await new Promise((resolve) => setTimeout(resolve, duration));
|
|
22
22
|
}
|
|
23
23
|
function throttle(fct, merge, delay) {
|
|
24
24
|
let lastPromise = Promise.resolve();
|
|
@@ -26,7 +26,9 @@ function throttle(fct, merge, delay) {
|
|
|
26
26
|
return async (param) => {
|
|
27
27
|
if (toConsume == null) {
|
|
28
28
|
toConsume = param;
|
|
29
|
-
lastPromise = lastPromise
|
|
29
|
+
lastPromise = lastPromise
|
|
30
|
+
.then(async () => await sleep(delay))
|
|
31
|
+
.then(async () => {
|
|
30
32
|
const _toConsume = toConsume;
|
|
31
33
|
toConsume = null;
|
|
32
34
|
await fct(_toConsume);
|