@codingame/monaco-vscode-editor-service-override 1.82.4 → 1.82.5-next.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.d.ts +7 -0
- package/editor.js +158 -0
- package/external/tslib/tslib.es6.js +11 -0
- package/index.d.ts +5 -2
- package/index.js +2 -2
- package/package.json +2 -2
- package/tools/editor.d.ts +33 -0
- package/tools/editor.js +445 -0
- package/tools.js +5 -0
package/editor.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IEditorOverrideServices } from 'vscode/vscode/vs/editor/standalone/browser/standaloneServices';
|
|
2
|
+
import { OpenEditor } from './tools/editor.js';
|
|
3
|
+
export { MonacoEditorService } from './tools/editor.js';
|
|
4
|
+
|
|
5
|
+
declare function getServiceOverride(openEditor: OpenEditor): IEditorOverrideServices;
|
|
6
|
+
|
|
7
|
+
export { OpenEditor, getServiceOverride as default };
|
package/editor.js
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { __decorate, __param } from './external/tslib/tslib.es6.js';
|
|
2
|
+
import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
|
|
3
|
+
import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
4
|
+
import { ICodeEditorService } from 'monaco-editor/esm/vs/editor/browser/services/codeEditorService.js';
|
|
5
|
+
import { CodeEditorService } from 'vscode/vscode/vs/workbench/services/editor/browser/codeEditorService';
|
|
6
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
7
|
+
import { EditorExtensions } from 'vscode/vscode/vs/workbench/common/editor';
|
|
8
|
+
import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
|
|
9
|
+
import { ITextEditorService, TextEditorService } from 'vscode/vscode/vs/workbench/services/textfile/common/textEditorService';
|
|
10
|
+
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
11
|
+
import { FILE_EDITOR_INPUT_ID } from 'vscode/vscode/vs/workbench/contrib/files/common/files';
|
|
12
|
+
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
13
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
14
|
+
import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
15
|
+
import { MonacoEditorService, MonacoDelegateEditorGroupsService } from './tools/editor.js';
|
|
16
|
+
import { unsupported } from './tools.js';
|
|
17
|
+
import 'vscode/vscode/vs/workbench/browser/parts/editor/editor.contribution';
|
|
18
|
+
|
|
19
|
+
class EmptyEditorGroup {
|
|
20
|
+
constructor() {
|
|
21
|
+
this.onDidFocus = Event.None;
|
|
22
|
+
this.onDidOpenEditorFail = Event.None;
|
|
23
|
+
this.whenRestored = Promise.resolve();
|
|
24
|
+
this.disposed = false;
|
|
25
|
+
this.setActive = unsupported;
|
|
26
|
+
this.notifyIndexChanged = unsupported;
|
|
27
|
+
this.relayout = unsupported;
|
|
28
|
+
this.dispose = unsupported;
|
|
29
|
+
this.toJSON = unsupported;
|
|
30
|
+
this.minimumWidth = 0;
|
|
31
|
+
this.maximumWidth = Number.POSITIVE_INFINITY;
|
|
32
|
+
this.minimumHeight = 0;
|
|
33
|
+
this.maximumHeight = Number.POSITIVE_INFINITY;
|
|
34
|
+
this.onDidChange = Event.None;
|
|
35
|
+
this.layout = unsupported;
|
|
36
|
+
this.onDidModelChange = Event.None;
|
|
37
|
+
this.onWillDispose = Event.None;
|
|
38
|
+
this.onDidActiveEditorChange = Event.None;
|
|
39
|
+
this.onWillCloseEditor = Event.None;
|
|
40
|
+
this.onDidCloseEditor = Event.None;
|
|
41
|
+
this.onWillMoveEditor = Event.None;
|
|
42
|
+
this.onWillOpenEditor = Event.None;
|
|
43
|
+
this.id = 0;
|
|
44
|
+
this.index = 0;
|
|
45
|
+
this.label = 'main';
|
|
46
|
+
this.ariaLabel = 'main';
|
|
47
|
+
this.activeEditorPane = undefined;
|
|
48
|
+
this.activeEditor = null;
|
|
49
|
+
this.previewEditor = null;
|
|
50
|
+
this.count = 0;
|
|
51
|
+
this.isEmpty = false;
|
|
52
|
+
this.isLocked = false;
|
|
53
|
+
this.stickyCount = 0;
|
|
54
|
+
this.editors = [];
|
|
55
|
+
this.getEditors = () => [];
|
|
56
|
+
this.findEditors = () => [];
|
|
57
|
+
this.getEditorByIndex = () => undefined;
|
|
58
|
+
this.getIndexOfEditor = unsupported;
|
|
59
|
+
this.openEditor = unsupported;
|
|
60
|
+
this.openEditors = unsupported;
|
|
61
|
+
this.isPinned = () => false;
|
|
62
|
+
this.isSticky = () => false;
|
|
63
|
+
this.isActive = () => false;
|
|
64
|
+
this.contains = () => false;
|
|
65
|
+
this.moveEditor = unsupported;
|
|
66
|
+
this.moveEditors = unsupported;
|
|
67
|
+
this.copyEditor = unsupported;
|
|
68
|
+
this.copyEditors = unsupported;
|
|
69
|
+
this.closeEditor = unsupported;
|
|
70
|
+
this.closeEditors = unsupported;
|
|
71
|
+
this.closeAllEditors = unsupported;
|
|
72
|
+
this.replaceEditors = unsupported;
|
|
73
|
+
this.pinEditor = unsupported;
|
|
74
|
+
this.stickEditor = unsupported;
|
|
75
|
+
this.unstickEditor = unsupported;
|
|
76
|
+
this.lock = unsupported;
|
|
77
|
+
this.isFirst = unsupported;
|
|
78
|
+
this.isLast = unsupported;
|
|
79
|
+
}
|
|
80
|
+
get titleHeight() {
|
|
81
|
+
return unsupported();
|
|
82
|
+
}
|
|
83
|
+
get element() {
|
|
84
|
+
return unsupported();
|
|
85
|
+
}
|
|
86
|
+
get scopedContextKeyService() { return StandaloneServices.get(IContextKeyService); }
|
|
87
|
+
focus() {
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const fakeActiveGroup = new EmptyEditorGroup();
|
|
91
|
+
class EmptyEditorGroupsService {
|
|
92
|
+
constructor() {
|
|
93
|
+
this._serviceBrand = undefined;
|
|
94
|
+
this.getLayout = unsupported;
|
|
95
|
+
this.onDidChangeActiveGroup = Event.None;
|
|
96
|
+
this.onDidAddGroup = Event.None;
|
|
97
|
+
this.onDidRemoveGroup = Event.None;
|
|
98
|
+
this.onDidMoveGroup = Event.None;
|
|
99
|
+
this.onDidActivateGroup = Event.None;
|
|
100
|
+
this.onDidLayout = Event.None;
|
|
101
|
+
this.onDidScroll = Event.None;
|
|
102
|
+
this.onDidChangeGroupIndex = Event.None;
|
|
103
|
+
this.onDidChangeGroupLocked = Event.None;
|
|
104
|
+
this.activeGroup = fakeActiveGroup;
|
|
105
|
+
this.groups = [fakeActiveGroup];
|
|
106
|
+
this.count = 0;
|
|
107
|
+
this.orientation = 0 ;
|
|
108
|
+
this.isReady = false;
|
|
109
|
+
this.whenReady = Promise.resolve();
|
|
110
|
+
this.whenRestored = Promise.resolve();
|
|
111
|
+
this.hasRestorableState = false;
|
|
112
|
+
this.getGroups = () => [];
|
|
113
|
+
this.getGroup = () => undefined;
|
|
114
|
+
this.activateGroup = unsupported;
|
|
115
|
+
this.getSize = unsupported;
|
|
116
|
+
this.setSize = unsupported;
|
|
117
|
+
this.arrangeGroups = unsupported;
|
|
118
|
+
this.applyLayout = unsupported;
|
|
119
|
+
this.centerLayout = unsupported;
|
|
120
|
+
this.isLayoutCentered = () => false;
|
|
121
|
+
this.setGroupOrientation = unsupported;
|
|
122
|
+
this.findGroup = () => undefined;
|
|
123
|
+
this.addGroup = unsupported;
|
|
124
|
+
this.removeGroup = unsupported;
|
|
125
|
+
this.moveGroup = unsupported;
|
|
126
|
+
this.mergeGroup = unsupported;
|
|
127
|
+
this.mergeAllGroups = unsupported;
|
|
128
|
+
this.copyGroup = unsupported;
|
|
129
|
+
this.partOptions = {};
|
|
130
|
+
this.onDidChangeEditorPartOptions = Event.None;
|
|
131
|
+
this.enforcePartOptions = unsupported;
|
|
132
|
+
}
|
|
133
|
+
get contentDimension() { return unsupported(); }
|
|
134
|
+
get sideGroup() { return unsupported(); }
|
|
135
|
+
}
|
|
136
|
+
let MonacoEditorGroupsService = class MonacoEditorGroupsService extends MonacoDelegateEditorGroupsService {
|
|
137
|
+
constructor(instantiationService) {
|
|
138
|
+
super(instantiationService.createInstance(EmptyEditorGroupsService), instantiationService);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
MonacoEditorGroupsService = __decorate([
|
|
142
|
+
( __param(0, IInstantiationService))
|
|
143
|
+
], MonacoEditorGroupsService);
|
|
144
|
+
( Registry.as(EditorExtensions.EditorFactory)).registerFileEditorFactory({
|
|
145
|
+
typeId: FILE_EDITOR_INPUT_ID,
|
|
146
|
+
createFileEditor: unsupported,
|
|
147
|
+
isFileEditor: (obj) => false
|
|
148
|
+
});
|
|
149
|
+
function getServiceOverride(openEditor) {
|
|
150
|
+
return {
|
|
151
|
+
[( ICodeEditorService.toString())]: new SyncDescriptor(CodeEditorService, undefined, true),
|
|
152
|
+
[( IEditorService.toString())]: new SyncDescriptor(MonacoEditorService, [openEditor, () => false], true),
|
|
153
|
+
[( ITextEditorService.toString())]: new SyncDescriptor(TextEditorService, [], false),
|
|
154
|
+
[( IEditorGroupsService.toString())]: new SyncDescriptor(MonacoEditorGroupsService)
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export { MonacoEditorService, getServiceOverride as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function __decorate(decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
}
|
|
7
|
+
function __param(paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { __decorate, __param };
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export { default } from '
|
|
2
|
-
export
|
|
1
|
+
export { default } from './editor.js';
|
|
2
|
+
export { IResolvedTextEditorModel } from 'vscode/vscode/vs/editor/common/services/resolverService';
|
|
3
|
+
export { IEditorOptions } from 'vscode/vscode/vs/platform/editor/common/editor';
|
|
4
|
+
export { IReference } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
|
+
export { MonacoEditorService, OpenEditor } from './tools/editor.js';
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from '
|
|
2
|
-
export
|
|
1
|
+
export { default } from './editor.js';
|
|
2
|
+
export { MonacoEditorService } from './tools/editor.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-editor-service-override",
|
|
3
|
-
"version": "1.82.
|
|
3
|
+
"version": "1.82.5-next.0",
|
|
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.82.
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@1.82.5-next.0",
|
|
22
22
|
"monaco-editor": "0.43.0"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { IEditorPane, IUntypedEditorInput, IUntitledTextResourceEditorInput, IResourceDiffEditorInput, ITextDiffEditorPane } from 'vscode/vscode/vs/workbench/common/editor';
|
|
2
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
3
|
+
import { IResolvedTextEditorModel, ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
|
|
4
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
5
|
+
import { IReference } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
6
|
+
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
|
|
7
|
+
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
8
|
+
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
|
|
9
|
+
import { ICodeEditor, IDiffEditor } from 'vscode/vscode/vs/editor/browser/editorBrowser';
|
|
10
|
+
import { IEditorOptions, IResourceEditorInput, ITextResourceEditorInput } from 'vscode/vscode/vs/platform/editor/common/editor';
|
|
11
|
+
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
12
|
+
import { EditorInput } from 'vscode/vscode/vs/workbench/common/editor/editorInput';
|
|
13
|
+
import { PreferredGroup } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
14
|
+
import { IEditorResolverService } from 'vscode/vscode/vs/workbench/services/editor/common/editorResolverService';
|
|
15
|
+
import { ITextEditorService } from 'vscode/vscode/vs/workbench/services/textfile/common/textEditorService';
|
|
16
|
+
import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host';
|
|
17
|
+
import { IWorkspaceTrustRequestService } from 'vscode/vscode/vs/platform/workspace/common/workspaceTrust';
|
|
18
|
+
import { EditorService } from 'vscode/vscode/vs/workbench/services/editor/browser/editorService';
|
|
19
|
+
|
|
20
|
+
type OpenEditor = (modelRef: IReference<IResolvedTextEditorModel>, options: IEditorOptions | undefined, sideBySide?: boolean) => Promise<ICodeEditor | undefined>;
|
|
21
|
+
declare class MonacoEditorService extends EditorService {
|
|
22
|
+
private _isEditorPartVisible;
|
|
23
|
+
constructor(_openEditorFallback: OpenEditor | undefined, _isEditorPartVisible: () => boolean, _editorGroupService: IEditorGroupsService, instantiationService: IInstantiationService, fileService: IFileService, configurationService: IConfigurationService, contextService: IWorkspaceContextService, uriIdentityService: IUriIdentityService, editorResolverService: IEditorResolverService, workspaceTrustRequestService: IWorkspaceTrustRequestService, hostService: IHostService, textEditorService: ITextEditorService, textModelService: ITextModelService);
|
|
24
|
+
get activeTextEditorControl(): ICodeEditor | IDiffEditor | undefined;
|
|
25
|
+
openEditor(editor: EditorInput, options?: IEditorOptions, group?: PreferredGroup): Promise<IEditorPane | undefined>;
|
|
26
|
+
openEditor(editor: IUntypedEditorInput, group?: PreferredGroup): Promise<IEditorPane | undefined>;
|
|
27
|
+
openEditor(editor: IResourceEditorInput, group?: PreferredGroup): Promise<IEditorPane | undefined>;
|
|
28
|
+
openEditor(editor: ITextResourceEditorInput | IUntitledTextResourceEditorInput, group?: PreferredGroup): Promise<IEditorPane | undefined>;
|
|
29
|
+
openEditor(editor: IResourceDiffEditorInput, group?: PreferredGroup): Promise<ITextDiffEditorPane | undefined>;
|
|
30
|
+
openEditor(editor: EditorInput | IUntypedEditorInput, optionsOrPreferredGroup?: IEditorOptions | PreferredGroup, preferredGroup?: PreferredGroup): Promise<IEditorPane | undefined>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { MonacoEditorService, type OpenEditor };
|
package/tools/editor.js
ADDED
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
import { __decorate, __param } from '../external/tslib/tslib.es6.js';
|
|
2
|
+
import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
|
|
3
|
+
import { ICodeEditorService } from 'monaco-editor/esm/vs/editor/browser/services/codeEditorService.js';
|
|
4
|
+
import { isPreferredGroup, SIDE_GROUP } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
5
|
+
import { EditorCloseContext, isEditorInput, isResourceEditorInput } 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 'monaco-editor/esm/vs/editor/common/services/resolverService.js';
|
|
9
|
+
import { StandaloneCodeEditor, StandaloneEditor } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneCodeEditor.js';
|
|
10
|
+
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
11
|
+
import { EditorService } from 'vscode/vscode/vs/workbench/services/editor/browser/editorService';
|
|
12
|
+
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
13
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
14
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
15
|
+
import { IWorkspaceTrustRequestService } from 'monaco-editor/esm/vs/platform/workspace/common/workspaceTrust.js';
|
|
16
|
+
import { IEditorResolverService } from 'vscode/vscode/vs/workbench/services/editor/common/editorResolverService';
|
|
17
|
+
import { IUriIdentityService } from 'monaco-editor/esm/vs/platform/uriIdentity/common/uriIdentity.js';
|
|
18
|
+
import { IWorkspaceContextService } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
|
|
19
|
+
import { IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
20
|
+
import { ITextEditorService } from 'vscode/vscode/vs/workbench/services/textfile/common/textEditorService';
|
|
21
|
+
import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host';
|
|
22
|
+
import { Event, Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
23
|
+
import { TextResourceEditorInput } from 'vscode/vscode/vs/workbench/common/editor/textResourceEditorInput';
|
|
24
|
+
import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
25
|
+
import { unsupported } from '../tools.js';
|
|
26
|
+
|
|
27
|
+
var StandaloneEditorGroup_1;
|
|
28
|
+
class SimpleEditorPane {
|
|
29
|
+
constructor(editor) {
|
|
30
|
+
this.editor = editor;
|
|
31
|
+
this.onDidChangeControl = Event.None;
|
|
32
|
+
this.onDidChangeSizeConstraints = Event.None;
|
|
33
|
+
this.onDidFocus = Event.None;
|
|
34
|
+
this.onDidBlur = Event.None;
|
|
35
|
+
this.input = undefined;
|
|
36
|
+
this.options = undefined;
|
|
37
|
+
this.group = undefined;
|
|
38
|
+
this.scopedContextKeyService = undefined;
|
|
39
|
+
this.getViewState = unsupported;
|
|
40
|
+
this.isVisible = unsupported;
|
|
41
|
+
this.hasFocus = unsupported;
|
|
42
|
+
this.getId = unsupported;
|
|
43
|
+
this.getTitle = unsupported;
|
|
44
|
+
this.focus = unsupported;
|
|
45
|
+
}
|
|
46
|
+
get minimumWidth() { return DEFAULT_EDITOR_MIN_DIMENSIONS.width; }
|
|
47
|
+
get maximumWidth() { return DEFAULT_EDITOR_MAX_DIMENSIONS.width; }
|
|
48
|
+
get minimumHeight() { return DEFAULT_EDITOR_MIN_DIMENSIONS.height; }
|
|
49
|
+
get maximumHeight() { return DEFAULT_EDITOR_MAX_DIMENSIONS.height; }
|
|
50
|
+
getControl() {
|
|
51
|
+
return this.editor;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function wrapOpenEditor(textModelService, defaultBehavior, fallbackBahavior) {
|
|
55
|
+
async function openEditor(editor, optionsOrPreferredGroup, preferredGroup) {
|
|
56
|
+
const options = isEditorInput(editor) ? optionsOrPreferredGroup : editor.options;
|
|
57
|
+
if (isPreferredGroup(optionsOrPreferredGroup)) {
|
|
58
|
+
preferredGroup = optionsOrPreferredGroup;
|
|
59
|
+
}
|
|
60
|
+
const resource = isResourceEditorInput(editor) || isEditorInput(editor) ? editor.resource : undefined;
|
|
61
|
+
if (resource == null || !textModelService.canHandleResource(resource)) {
|
|
62
|
+
return defaultBehavior(editor, optionsOrPreferredGroup, preferredGroup);
|
|
63
|
+
}
|
|
64
|
+
let modelEditor;
|
|
65
|
+
const codeEditors = StandaloneServices.get(ICodeEditorService).listCodeEditors();
|
|
66
|
+
modelEditor = codeEditors.find(editor => editor instanceof StandaloneEditor && editor.getModel() != null && ( editor.getModel().uri.toString()) === ( resource.toString()));
|
|
67
|
+
if (modelEditor == null) {
|
|
68
|
+
const defaultBehaviorResult = await defaultBehavior(editor, optionsOrPreferredGroup, preferredGroup);
|
|
69
|
+
if (defaultBehaviorResult != null) {
|
|
70
|
+
return defaultBehaviorResult;
|
|
71
|
+
}
|
|
72
|
+
const modelRef = await textModelService.createModelReference(resource);
|
|
73
|
+
modelEditor = await fallbackBahavior?.(modelRef, options, preferredGroup === SIDE_GROUP);
|
|
74
|
+
if (modelEditor == null) {
|
|
75
|
+
modelRef.dispose();
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (options != null) {
|
|
80
|
+
applyTextEditorOptions(options, modelEditor, 1 );
|
|
81
|
+
}
|
|
82
|
+
if (!(options?.preserveFocus ?? false)) {
|
|
83
|
+
modelEditor.focus();
|
|
84
|
+
modelEditor.getContainerDomNode().scrollIntoView();
|
|
85
|
+
}
|
|
86
|
+
return new SimpleEditorPane(modelEditor);
|
|
87
|
+
}
|
|
88
|
+
return openEditor;
|
|
89
|
+
}
|
|
90
|
+
let MonacoEditorService = class MonacoEditorService extends EditorService {
|
|
91
|
+
constructor(_openEditorFallback, _isEditorPartVisible, _editorGroupService, instantiationService, fileService, configurationService, contextService, uriIdentityService, editorResolverService, workspaceTrustRequestService, hostService, textEditorService, textModelService) {
|
|
92
|
+
super(_editorGroupService, instantiationService, fileService, configurationService, contextService, uriIdentityService, editorResolverService, workspaceTrustRequestService, hostService, textEditorService);
|
|
93
|
+
this._isEditorPartVisible = _isEditorPartVisible;
|
|
94
|
+
this.openEditor = wrapOpenEditor(textModelService, this.openEditor.bind(this), _openEditorFallback);
|
|
95
|
+
}
|
|
96
|
+
get activeTextEditorControl() {
|
|
97
|
+
const focusedCodeEditor = StandaloneServices.get(ICodeEditorService).getFocusedCodeEditor();
|
|
98
|
+
if (focusedCodeEditor != null && focusedCodeEditor instanceof StandaloneCodeEditor) {
|
|
99
|
+
return focusedCodeEditor;
|
|
100
|
+
}
|
|
101
|
+
return super.activeTextEditorControl;
|
|
102
|
+
}
|
|
103
|
+
async openEditor(editor, optionsOrPreferredGroup, preferredGroup) {
|
|
104
|
+
if (!this._isEditorPartVisible()) {
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
return super.openEditor(editor, optionsOrPreferredGroup, preferredGroup);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
MonacoEditorService = __decorate([
|
|
111
|
+
( __param(2, IEditorGroupsService)),
|
|
112
|
+
( __param(3, IInstantiationService)),
|
|
113
|
+
( __param(4, IFileService)),
|
|
114
|
+
( __param(5, IConfigurationService)),
|
|
115
|
+
( __param(6, IWorkspaceContextService)),
|
|
116
|
+
( __param(7, IUriIdentityService)),
|
|
117
|
+
( __param(8, IEditorResolverService)),
|
|
118
|
+
( __param(9, IWorkspaceTrustRequestService)),
|
|
119
|
+
( __param(10, IHostService)),
|
|
120
|
+
( __param(11, ITextEditorService)),
|
|
121
|
+
( __param(12, ITextModelService))
|
|
122
|
+
], MonacoEditorService);
|
|
123
|
+
class StandaloneEditorPane {
|
|
124
|
+
constructor(editor, input, group) {
|
|
125
|
+
this.editor = editor;
|
|
126
|
+
this.input = input;
|
|
127
|
+
this.group = group;
|
|
128
|
+
this.onDidChangeControl = Event.None;
|
|
129
|
+
this.options = undefined;
|
|
130
|
+
this.minimumWidth = 0;
|
|
131
|
+
this.maximumWidth = Number.POSITIVE_INFINITY;
|
|
132
|
+
this.minimumHeight = 0;
|
|
133
|
+
this.maximumHeight = Number.POSITIVE_INFINITY;
|
|
134
|
+
this.onDidChangeSizeConstraints = Event.None;
|
|
135
|
+
this.scopedContextKeyService = undefined;
|
|
136
|
+
this.onDidFocus = this.editor.onDidFocusEditorWidget;
|
|
137
|
+
this.onDidBlur = this.editor.onDidBlurEditorWidget;
|
|
138
|
+
}
|
|
139
|
+
getControl() {
|
|
140
|
+
return this.editor;
|
|
141
|
+
}
|
|
142
|
+
getViewState() {
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
isVisible() {
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
hasFocus() {
|
|
149
|
+
return this.editor.hasWidgetFocus();
|
|
150
|
+
}
|
|
151
|
+
getId() {
|
|
152
|
+
return this.editor.getId();
|
|
153
|
+
}
|
|
154
|
+
getTitle() {
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
focus() {
|
|
158
|
+
this.editor.focus();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
let StandaloneEditorGroup = StandaloneEditorGroup_1 = class StandaloneEditorGroup extends Disposable {
|
|
162
|
+
constructor(editor, instantiationService, scopedContextKeyService) {
|
|
163
|
+
super();
|
|
164
|
+
this.editor = editor;
|
|
165
|
+
this.scopedContextKeyService = scopedContextKeyService;
|
|
166
|
+
this.active = false;
|
|
167
|
+
this.onDidFocus = this.editor.onDidFocusEditorWidget;
|
|
168
|
+
this.onDidOpenEditorFail = Event.None;
|
|
169
|
+
this.whenRestored = Promise.resolve();
|
|
170
|
+
this.disposed = false;
|
|
171
|
+
this.notifyIndexChanged = unsupported;
|
|
172
|
+
this.relayout = unsupported;
|
|
173
|
+
this.toJSON = unsupported;
|
|
174
|
+
this.minimumWidth = 0;
|
|
175
|
+
this.maximumWidth = Number.POSITIVE_INFINITY;
|
|
176
|
+
this.minimumHeight = 0;
|
|
177
|
+
this.maximumHeight = Number.POSITIVE_INFINITY;
|
|
178
|
+
this.onDidChange = this.editor.onDidLayoutChange;
|
|
179
|
+
this.layout = () => this.editor.layout();
|
|
180
|
+
this._onDidModelChange = new Emitter();
|
|
181
|
+
this.onDidModelChange = this._onDidModelChange.event;
|
|
182
|
+
this.onWillDispose = this.editor.onDidDispose;
|
|
183
|
+
this._onDidActiveEditorChange = new Emitter();
|
|
184
|
+
this.onDidActiveEditorChange = this._onDidActiveEditorChange.event;
|
|
185
|
+
this.onWillCloseEditor = Event.None;
|
|
186
|
+
this._onDidCloseEditor = new Emitter();
|
|
187
|
+
this.onDidCloseEditor = this._onDidCloseEditor.event;
|
|
188
|
+
this.onWillMoveEditor = Event.None;
|
|
189
|
+
this._onWillOpenEditor = new Emitter();
|
|
190
|
+
this.onWillOpenEditor = this._onWillOpenEditor.event;
|
|
191
|
+
this.id = --StandaloneEditorGroup_1.idCounter;
|
|
192
|
+
this.index = -1;
|
|
193
|
+
this.label = `standalone editor ${this.editor.getId()}`;
|
|
194
|
+
this.ariaLabel = `standalone editor ${this.editor.getId()}`;
|
|
195
|
+
this.previewEditor = null;
|
|
196
|
+
this.isLocked = true;
|
|
197
|
+
this.stickyCount = 0;
|
|
198
|
+
this.getEditors = () => this.editors;
|
|
199
|
+
this.findEditors = (resource) => this.pane != null && ( resource.toString()) === ( this.pane.input.resource.toString()) ? [this.pane.input] : [];
|
|
200
|
+
this.getEditorByIndex = (index) => this.pane != null && index === 0 ? this.pane.input : undefined;
|
|
201
|
+
this.getIndexOfEditor = (editorInput) => this.pane != null && this.pane.input === editorInput ? 0 : -1;
|
|
202
|
+
this.openEditor = unsupported;
|
|
203
|
+
this.openEditors = unsupported;
|
|
204
|
+
this.isPinned = () => false;
|
|
205
|
+
this.isSticky = () => false;
|
|
206
|
+
this.isActive = () => this.editor.hasWidgetFocus();
|
|
207
|
+
this.contains = (candidate) => {
|
|
208
|
+
return this.pane != null && this.pane.input === candidate;
|
|
209
|
+
};
|
|
210
|
+
this.moveEditor = unsupported;
|
|
211
|
+
this.moveEditors = unsupported;
|
|
212
|
+
this.copyEditor = unsupported;
|
|
213
|
+
this.copyEditors = unsupported;
|
|
214
|
+
this.closeEditor = unsupported;
|
|
215
|
+
this.closeEditors = unsupported;
|
|
216
|
+
this.closeAllEditors = unsupported;
|
|
217
|
+
this.replaceEditors = unsupported;
|
|
218
|
+
this.pinEditor = unsupported;
|
|
219
|
+
this.stickEditor = unsupported;
|
|
220
|
+
this.unstickEditor = unsupported;
|
|
221
|
+
this.lock = unsupported;
|
|
222
|
+
this.isFirst = unsupported;
|
|
223
|
+
this.isLast = unsupported;
|
|
224
|
+
const onNewModel = (uri) => {
|
|
225
|
+
const editorInput = instantiationService.createInstance(TextResourceEditorInput, uri, undefined, undefined, undefined, undefined);
|
|
226
|
+
this._onWillOpenEditor.fire({
|
|
227
|
+
editor: editorInput,
|
|
228
|
+
groupId: this.id
|
|
229
|
+
});
|
|
230
|
+
this.pane = new StandaloneEditorPane(editor, editorInput, this);
|
|
231
|
+
this._onDidModelChange.fire({
|
|
232
|
+
kind: 3 ,
|
|
233
|
+
editor: editorInput,
|
|
234
|
+
editorIndex: 0
|
|
235
|
+
});
|
|
236
|
+
this._onDidActiveEditorChange.fire({
|
|
237
|
+
editor: editorInput
|
|
238
|
+
});
|
|
239
|
+
};
|
|
240
|
+
const onRemovedModel = (uri) => {
|
|
241
|
+
if (this.pane != null && ( this.pane.input.resource.toString()) === ( uri.toString())) {
|
|
242
|
+
const pane = this.pane;
|
|
243
|
+
this.pane = undefined;
|
|
244
|
+
this._onDidModelChange.fire({
|
|
245
|
+
kind: 4 ,
|
|
246
|
+
editorIndex: 0
|
|
247
|
+
});
|
|
248
|
+
this._onDidActiveEditorChange.fire({
|
|
249
|
+
editor: undefined
|
|
250
|
+
});
|
|
251
|
+
this._onDidCloseEditor.fire({
|
|
252
|
+
context: EditorCloseContext.UNKNOWN,
|
|
253
|
+
editor: pane.input,
|
|
254
|
+
groupId: this.id,
|
|
255
|
+
index: 0,
|
|
256
|
+
sticky: false
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
editor.onDidChangeModel((e) => {
|
|
261
|
+
if (e.oldModelUrl != null) {
|
|
262
|
+
onRemovedModel(e.oldModelUrl);
|
|
263
|
+
}
|
|
264
|
+
if (e.newModelUrl != null) {
|
|
265
|
+
onNewModel(e.newModelUrl);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
this._register({
|
|
269
|
+
dispose: () => {
|
|
270
|
+
const model = editor.getModel();
|
|
271
|
+
if (model != null) {
|
|
272
|
+
onRemovedModel(model.uri);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
const currentModel = editor.getModel();
|
|
277
|
+
if (currentModel != null) {
|
|
278
|
+
const editorInput = instantiationService.createInstance(TextResourceEditorInput, currentModel.uri, undefined, undefined, undefined, undefined);
|
|
279
|
+
this.pane = new StandaloneEditorPane(editor, editorInput, this);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
get titleHeight() { return unsupported(); }
|
|
283
|
+
setActive(isActive) {
|
|
284
|
+
this.active = isActive;
|
|
285
|
+
}
|
|
286
|
+
get element() { return unsupported(); }
|
|
287
|
+
get activeEditorPane() {
|
|
288
|
+
return this.pane;
|
|
289
|
+
}
|
|
290
|
+
get activeEditor() {
|
|
291
|
+
return this.pane?.input ?? null;
|
|
292
|
+
}
|
|
293
|
+
get count() {
|
|
294
|
+
return this.pane != null ? 1 : 0;
|
|
295
|
+
}
|
|
296
|
+
get isEmpty() {
|
|
297
|
+
return this.pane == null;
|
|
298
|
+
}
|
|
299
|
+
get editors() {
|
|
300
|
+
return this.pane != null ? [this.pane.input] : [];
|
|
301
|
+
}
|
|
302
|
+
focus() {
|
|
303
|
+
this.editor.focus();
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
StandaloneEditorGroup.idCounter = 0;
|
|
307
|
+
StandaloneEditorGroup = StandaloneEditorGroup_1 = __decorate([
|
|
308
|
+
( __param(1, IInstantiationService)),
|
|
309
|
+
( __param(2, IContextKeyService))
|
|
310
|
+
], StandaloneEditorGroup);
|
|
311
|
+
let MonacoDelegateEditorGroupsService = class MonacoDelegateEditorGroupsService extends Disposable {
|
|
312
|
+
constructor(delegate, instantiationService) {
|
|
313
|
+
super();
|
|
314
|
+
this.delegate = delegate;
|
|
315
|
+
this._serviceBrand = undefined;
|
|
316
|
+
this.additionalGroups = [];
|
|
317
|
+
this.activeGroupOverride = undefined;
|
|
318
|
+
this._onDidChangeActiveGroup = new Emitter();
|
|
319
|
+
this.onDidChangeActiveGroup = Event.any(this._onDidChangeActiveGroup.event, this.delegate.onDidChangeActiveGroup);
|
|
320
|
+
this._onDidAddGroup = new Emitter();
|
|
321
|
+
this.onDidAddGroup = Event.any(this._onDidAddGroup.event, this.delegate.onDidAddGroup);
|
|
322
|
+
this._onDidRemoveGroup = new Emitter();
|
|
323
|
+
this.onDidRemoveGroup = Event.any(this._onDidRemoveGroup.event, this.delegate.onDidRemoveGroup);
|
|
324
|
+
this.onDidMoveGroup = this.delegate.onDidMoveGroup;
|
|
325
|
+
this.onDidActivateGroup = this.delegate.onDidActivateGroup;
|
|
326
|
+
this.onDidLayout = this.delegate.onDidLayout;
|
|
327
|
+
this.onDidScroll = this.delegate.onDidScroll;
|
|
328
|
+
this.onDidChangeGroupIndex = this.delegate.onDidChangeGroupIndex;
|
|
329
|
+
this.onDidChangeGroupLocked = this.delegate.onDidChangeGroupLocked;
|
|
330
|
+
this.getLayout = () => {
|
|
331
|
+
return this.delegate.getLayout();
|
|
332
|
+
};
|
|
333
|
+
this.getGroups = (order) => {
|
|
334
|
+
return [...this.additionalGroups, ...this.delegate.getGroups(order)];
|
|
335
|
+
};
|
|
336
|
+
this.getGroup = (identifier) => {
|
|
337
|
+
return this.delegate.getGroup(identifier) ?? this.additionalGroups.find(group => group.id === identifier);
|
|
338
|
+
};
|
|
339
|
+
this.activateGroup = (...args) => {
|
|
340
|
+
return this.delegate.activateGroup(...args);
|
|
341
|
+
};
|
|
342
|
+
this.getSize = (...args) => {
|
|
343
|
+
return this.delegate.getSize(...args);
|
|
344
|
+
};
|
|
345
|
+
this.setSize = (...args) => {
|
|
346
|
+
return this.delegate.setSize(...args);
|
|
347
|
+
};
|
|
348
|
+
this.arrangeGroups = (...args) => {
|
|
349
|
+
return this.delegate.arrangeGroups(...args);
|
|
350
|
+
};
|
|
351
|
+
this.applyLayout = (...args) => {
|
|
352
|
+
return this.delegate.applyLayout(...args);
|
|
353
|
+
};
|
|
354
|
+
this.centerLayout = (...args) => {
|
|
355
|
+
return this.delegate.centerLayout(...args);
|
|
356
|
+
};
|
|
357
|
+
this.isLayoutCentered = (...args) => {
|
|
358
|
+
return this.delegate.isLayoutCentered(...args);
|
|
359
|
+
};
|
|
360
|
+
this.setGroupOrientation = (...args) => {
|
|
361
|
+
return this.delegate.setGroupOrientation(...args);
|
|
362
|
+
};
|
|
363
|
+
this.findGroup = (...args) => {
|
|
364
|
+
return this.delegate.findGroup(...args);
|
|
365
|
+
};
|
|
366
|
+
this.addGroup = (...args) => {
|
|
367
|
+
return this.delegate.addGroup(...args);
|
|
368
|
+
};
|
|
369
|
+
this.removeGroup = (...args) => {
|
|
370
|
+
return this.delegate.removeGroup(...args);
|
|
371
|
+
};
|
|
372
|
+
this.moveGroup = (...args) => {
|
|
373
|
+
return this.delegate.moveGroup(...args);
|
|
374
|
+
};
|
|
375
|
+
this.mergeGroup = (...args) => {
|
|
376
|
+
return this.delegate.mergeGroup(...args);
|
|
377
|
+
};
|
|
378
|
+
this.mergeAllGroups = (...args) => {
|
|
379
|
+
return this.delegate.mergeAllGroups(...args);
|
|
380
|
+
};
|
|
381
|
+
this.copyGroup = (...args) => {
|
|
382
|
+
return this.delegate.copyGroup(...args);
|
|
383
|
+
};
|
|
384
|
+
this.enforcePartOptions = (...args) => {
|
|
385
|
+
return this.delegate.enforcePartOptions(...args);
|
|
386
|
+
};
|
|
387
|
+
this.onDidChangeEditorPartOptions = this.delegate.onDidChangeEditorPartOptions;
|
|
388
|
+
setTimeout(() => {
|
|
389
|
+
const codeEditorService = StandaloneServices.get(ICodeEditorService);
|
|
390
|
+
const handleCodeEditor = (editor) => {
|
|
391
|
+
if (editor instanceof StandaloneEditor) {
|
|
392
|
+
const onEditorFocused = () => {
|
|
393
|
+
this.activeGroupOverride = this.additionalGroups.find(group => group.editor === editor);
|
|
394
|
+
this._onDidChangeActiveGroup.fire(this.activeGroup);
|
|
395
|
+
};
|
|
396
|
+
editor.onDidFocusEditorText(onEditorFocused);
|
|
397
|
+
editor.onDidFocusEditorWidget(onEditorFocused);
|
|
398
|
+
if (editor.hasWidgetFocus()) {
|
|
399
|
+
onEditorFocused();
|
|
400
|
+
}
|
|
401
|
+
const newGroup = instantiationService.createInstance(StandaloneEditorGroup, editor);
|
|
402
|
+
this.additionalGroups.push(newGroup);
|
|
403
|
+
this._onDidAddGroup.fire(newGroup);
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
const handleCodeEditorRemoved = (editor) => {
|
|
407
|
+
if (editor instanceof StandaloneEditor) {
|
|
408
|
+
const removedGroup = this.additionalGroups.find(group => group.editor === editor);
|
|
409
|
+
if (removedGroup != null) {
|
|
410
|
+
removedGroup.dispose();
|
|
411
|
+
if (this.activeGroupOverride === removedGroup) {
|
|
412
|
+
this.activeGroupOverride = undefined;
|
|
413
|
+
this._onDidChangeActiveGroup.fire(this.activeGroup);
|
|
414
|
+
}
|
|
415
|
+
this.additionalGroups = this.additionalGroups.filter(group => group !== removedGroup);
|
|
416
|
+
this._onDidRemoveGroup.fire(removedGroup);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
this._register(codeEditorService.onCodeEditorAdd(handleCodeEditor));
|
|
421
|
+
this._register(codeEditorService.onCodeEditorRemove(handleCodeEditorRemoved));
|
|
422
|
+
codeEditorService.listCodeEditors().forEach(handleCodeEditor);
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
get groups() {
|
|
426
|
+
return [...this.additionalGroups, ...this.delegate.groups];
|
|
427
|
+
}
|
|
428
|
+
get activeGroup() {
|
|
429
|
+
return this.activeGroupOverride ?? this.delegate.activeGroup;
|
|
430
|
+
}
|
|
431
|
+
get contentDimension() { return this.delegate.contentDimension; }
|
|
432
|
+
get sideGroup() { return this.delegate.sideGroup; }
|
|
433
|
+
get count() { return this.delegate.count + this.additionalGroups.length; }
|
|
434
|
+
get orientation() { return this.delegate.orientation; }
|
|
435
|
+
get isReady() { return this.delegate.isReady; }
|
|
436
|
+
get whenReady() { return this.delegate.whenReady; }
|
|
437
|
+
get whenRestored() { return this.delegate.whenRestored; }
|
|
438
|
+
get hasRestorableState() { return this.delegate.hasRestorableState; }
|
|
439
|
+
get partOptions() { return this.delegate.partOptions; }
|
|
440
|
+
};
|
|
441
|
+
MonacoDelegateEditorGroupsService = __decorate([
|
|
442
|
+
( __param(1, IInstantiationService))
|
|
443
|
+
], MonacoDelegateEditorGroupsService);
|
|
444
|
+
|
|
445
|
+
export { MonacoDelegateEditorGroupsService, MonacoEditorService, wrapOpenEditor };
|