@codingame/monaco-vscode-editor-service-override 4.5.1 → 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/editor.js +8 -4
- package/package.json +2 -2
- package/tools/editor.js +31 -8
package/editor.js
CHANGED
|
@@ -12,9 +12,9 @@ import { DEFAULT_EDITOR_PART_OPTIONS } from 'vscode/vscode/vs/workbench/browser/
|
|
|
12
12
|
import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
|
|
13
13
|
import { fakeActiveGroup, MonacoDelegateEditorGroupsService, MonacoEditorService } from './tools/editor.js';
|
|
14
14
|
import { unsupported } from './tools.js';
|
|
15
|
-
import 'vscode/vscode/vs/workbench/browser/parts/editor/editor.
|
|
16
|
-
import 'vscode/vscode/vs/workbench/contrib/files/browser/files.
|
|
17
|
-
import 'vscode/vscode/vs/workbench/contrib/files/browser/fileCommands.
|
|
15
|
+
import 'vscode/vscode/vs/workbench/browser/parts/editor/editor.contribution._autosave';
|
|
16
|
+
import 'vscode/vscode/vs/workbench/contrib/files/browser/files.contribution._fileEditorFactory';
|
|
17
|
+
import 'vscode/vscode/vs/workbench/contrib/files/browser/fileCommands._save';
|
|
18
18
|
|
|
19
19
|
class EmptyEditorPart {
|
|
20
20
|
constructor() {
|
|
@@ -68,6 +68,10 @@ class EmptyEditorPart {
|
|
|
68
68
|
}
|
|
69
69
|
class EmptyEditorGroupsService {
|
|
70
70
|
constructor() {
|
|
71
|
+
this.saveWorkingSet = unsupported;
|
|
72
|
+
this.getWorkingSets = unsupported;
|
|
73
|
+
this.applyWorkingSet = unsupported;
|
|
74
|
+
this.deleteWorkingSet = unsupported;
|
|
71
75
|
this.onDidCreateAuxiliaryEditorPart = Event.None;
|
|
72
76
|
this.mainPart = new EmptyEditorPart();
|
|
73
77
|
this.activePart = this.mainPart;
|
|
@@ -123,7 +127,7 @@ class EmptyEditorGroupsService {
|
|
|
123
127
|
}
|
|
124
128
|
let MonacoEditorGroupsService = class MonacoEditorGroupsService extends MonacoDelegateEditorGroupsService {
|
|
125
129
|
constructor(instantiationService) {
|
|
126
|
-
super(instantiationService.createInstance(EmptyEditorGroupsService), instantiationService);
|
|
130
|
+
super(instantiationService.createInstance(EmptyEditorGroupsService), true, instantiationService);
|
|
127
131
|
}
|
|
128
132
|
};
|
|
129
133
|
MonacoEditorGroupsService = __decorate([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-editor-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
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@5.0.0"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/tools/editor.js
CHANGED
|
@@ -421,7 +421,7 @@ StandaloneEditorGroup = StandaloneEditorGroup_1 = __decorate([
|
|
|
421
421
|
( __param(2, IContextKeyService))
|
|
422
422
|
], StandaloneEditorGroup);
|
|
423
423
|
let MonacoDelegateEditorGroupsService = class MonacoDelegateEditorGroupsService extends Disposable {
|
|
424
|
-
constructor(delegate, instantiationService) {
|
|
424
|
+
constructor(delegate, emptyDelegate, instantiationService) {
|
|
425
425
|
super();
|
|
426
426
|
this.delegate = delegate;
|
|
427
427
|
this._serviceBrand = undefined;
|
|
@@ -493,23 +493,34 @@ let MonacoDelegateEditorGroupsService = class MonacoDelegateEditorGroupsService
|
|
|
493
493
|
const handleCodeEditor = (editor) => {
|
|
494
494
|
if (editor instanceof StandaloneEditor) {
|
|
495
495
|
let timeout;
|
|
496
|
+
const updateActiveGroup = (editor) => {
|
|
497
|
+
const newActiveGroup = editor != null ? this.additionalGroups.find(group => group.editor === editor) : undefined;
|
|
498
|
+
if (this.activeGroupOverride !== newActiveGroup) {
|
|
499
|
+
this.activeGroupOverride = newActiveGroup;
|
|
500
|
+
this._onDidChangeActiveGroup.fire(this.activeGroup);
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
const remoteActiveGroup = (editor) => {
|
|
504
|
+
if (!emptyDelegate && this.activeGroupOverride === this.additionalGroups.find(group => group.editor === editor)) {
|
|
505
|
+
updateActiveGroup(undefined);
|
|
506
|
+
}
|
|
507
|
+
};
|
|
496
508
|
const onEditorFocused = () => {
|
|
497
509
|
if (timeout != null)
|
|
498
510
|
window.clearTimeout(timeout);
|
|
499
|
-
|
|
500
|
-
this._onDidChangeActiveGroup.fire(this.activeGroup);
|
|
511
|
+
updateActiveGroup(editor);
|
|
501
512
|
};
|
|
502
513
|
const onEditorBlurred = () => {
|
|
503
514
|
if (timeout != null)
|
|
504
515
|
window.clearTimeout(timeout);
|
|
505
516
|
timeout = window.setTimeout(() => {
|
|
506
517
|
timeout = undefined;
|
|
507
|
-
|
|
508
|
-
this.activeGroupOverride = undefined;
|
|
509
|
-
this._onDidChangeActiveGroup.fire(this.activeGroup);
|
|
510
|
-
}
|
|
518
|
+
remoteActiveGroup(editor);
|
|
511
519
|
}, 100);
|
|
512
520
|
};
|
|
521
|
+
editor.onDidDispose(() => {
|
|
522
|
+
remoteActiveGroup(editor);
|
|
523
|
+
});
|
|
513
524
|
editor.onDidFocusEditorText(onEditorFocused);
|
|
514
525
|
editor.onDidFocusEditorWidget(onEditorFocused);
|
|
515
526
|
editor.onDidBlurEditorText(onEditorBlurred);
|
|
@@ -541,6 +552,18 @@ let MonacoDelegateEditorGroupsService = class MonacoDelegateEditorGroupsService
|
|
|
541
552
|
codeEditorService.listCodeEditors().forEach(handleCodeEditor);
|
|
542
553
|
});
|
|
543
554
|
}
|
|
555
|
+
saveWorkingSet(name) {
|
|
556
|
+
return this.delegate.saveWorkingSet(name);
|
|
557
|
+
}
|
|
558
|
+
getWorkingSets() {
|
|
559
|
+
return this.delegate.getWorkingSets();
|
|
560
|
+
}
|
|
561
|
+
applyWorkingSet(workingSet) {
|
|
562
|
+
return this.delegate.applyWorkingSet(workingSet);
|
|
563
|
+
}
|
|
564
|
+
deleteWorkingSet(workingSet) {
|
|
565
|
+
return this.delegate.deleteWorkingSet(workingSet);
|
|
566
|
+
}
|
|
544
567
|
get isReady() {
|
|
545
568
|
return this.delegate.isReady;
|
|
546
569
|
}
|
|
@@ -582,7 +605,7 @@ let MonacoDelegateEditorGroupsService = class MonacoDelegateEditorGroupsService
|
|
|
582
605
|
get partOptions() { return this.delegate.partOptions; }
|
|
583
606
|
};
|
|
584
607
|
MonacoDelegateEditorGroupsService = __decorate([
|
|
585
|
-
( __param(
|
|
608
|
+
( __param(2, IInstantiationService))
|
|
586
609
|
], MonacoDelegateEditorGroupsService);
|
|
587
610
|
|
|
588
611
|
export { MonacoDelegateEditorGroupsService, MonacoEditorService, fakeActiveGroup, wrapOpenEditor };
|