@theia/monaco 1.24.0-next.46 → 1.24.0-next.49
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/lib/browser/monaco-bulk-edit-service.d.ts +6 -4
- package/lib/browser/monaco-bulk-edit-service.d.ts.map +1 -1
- package/lib/browser/monaco-bulk-edit-service.js.map +1 -1
- package/lib/browser/monaco-color-registry.d.ts +6 -3
- package/lib/browser/monaco-color-registry.d.ts.map +1 -1
- package/lib/browser/monaco-color-registry.js +17 -13
- package/lib/browser/monaco-color-registry.js.map +1 -1
- package/lib/browser/monaco-command-service.d.ts +6 -5
- package/lib/browser/monaco-command-service.d.ts.map +1 -1
- package/lib/browser/monaco-command-service.js +2 -2
- package/lib/browser/monaco-command-service.js.map +1 -1
- package/lib/browser/monaco-command.d.ts +2 -1
- package/lib/browser/monaco-command.d.ts.map +1 -1
- package/lib/browser/monaco-command.js +17 -16
- package/lib/browser/monaco-command.js.map +1 -1
- package/lib/browser/monaco-context-key-service.d.ts +10 -8
- package/lib/browser/monaco-context-key-service.d.ts.map +1 -1
- package/lib/browser/monaco-context-key-service.js +18 -9
- package/lib/browser/monaco-context-key-service.js.map +1 -1
- package/lib/browser/monaco-context-menu.d.ts +8 -2
- package/lib/browser/monaco-context-menu.d.ts.map +1 -1
- package/lib/browser/monaco-context-menu.js +22 -4
- package/lib/browser/monaco-context-menu.js.map +1 -1
- package/lib/browser/monaco-diagnostic-collection.d.ts +4 -6
- package/lib/browser/monaco-diagnostic-collection.d.ts.map +1 -1
- package/lib/browser/monaco-diagnostic-collection.js +1 -0
- package/lib/browser/monaco-diagnostic-collection.js.map +1 -1
- package/lib/browser/monaco-diff-editor.d.ts +8 -10
- package/lib/browser/monaco-diff-editor.d.ts.map +1 -1
- package/lib/browser/monaco-diff-editor.js +4 -1
- package/lib/browser/monaco-diff-editor.js.map +1 -1
- package/lib/browser/monaco-diff-navigator-factory.d.ts +3 -4
- package/lib/browser/monaco-diff-navigator-factory.d.ts.map +1 -1
- package/lib/browser/monaco-diff-navigator-factory.js +14 -9
- package/lib/browser/monaco-diff-navigator-factory.js.map +1 -1
- package/lib/browser/monaco-editor-model.d.ts +20 -13
- package/lib/browser/monaco-editor-model.d.ts.map +1 -1
- package/lib/browser/monaco-editor-model.js +39 -14
- package/lib/browser/monaco-editor-model.js.map +1 -1
- package/lib/browser/monaco-editor-provider.d.ts +13 -19
- package/lib/browser/monaco-editor-provider.d.ts.map +1 -1
- package/lib/browser/monaco-editor-provider.js +39 -96
- package/lib/browser/monaco-editor-provider.js.map +1 -1
- package/lib/browser/monaco-editor-service.d.ts +9 -8
- package/lib/browser/monaco-editor-service.d.ts.map +1 -1
- package/lib/browser/monaco-editor-service.js +19 -8
- package/lib/browser/monaco-editor-service.js.map +1 -1
- package/lib/browser/monaco-editor-zone-widget.d.ts +3 -3
- package/lib/browser/monaco-editor-zone-widget.d.ts.map +1 -1
- package/lib/browser/monaco-editor-zone-widget.js +3 -2
- package/lib/browser/monaco-editor-zone-widget.js.map +1 -1
- package/lib/browser/monaco-editor.d.ts +20 -18
- package/lib/browser/monaco-editor.d.ts.map +1 -1
- package/lib/browser/monaco-editor.js +53 -19
- package/lib/browser/monaco-editor.js.map +1 -1
- package/lib/browser/monaco-formatting-conflicts.d.ts +1 -1
- package/lib/browser/monaco-formatting-conflicts.d.ts.map +1 -1
- package/lib/browser/monaco-formatting-conflicts.js +2 -1
- package/lib/browser/monaco-formatting-conflicts.js.map +1 -1
- package/lib/browser/monaco-frontend-application-contribution.d.ts +10 -1
- package/lib/browser/monaco-frontend-application-contribution.d.ts.map +1 -1
- package/lib/browser/monaco-frontend-application-contribution.js +42 -1
- package/lib/browser/monaco-frontend-application-contribution.js.map +1 -1
- package/lib/browser/monaco-frontend-module.d.ts +2 -1
- package/lib/browser/monaco-frontend-module.d.ts.map +1 -1
- package/lib/browser/monaco-frontend-module.js +8 -5
- package/lib/browser/monaco-frontend-module.js.map +1 -1
- package/lib/browser/monaco-gotoline-quick-access.d.ts +4 -2
- package/lib/browser/monaco-gotoline-quick-access.d.ts.map +1 -1
- package/lib/browser/monaco-gotoline-quick-access.js +9 -4
- package/lib/browser/monaco-gotoline-quick-access.js.map +1 -1
- package/lib/browser/monaco-gotosymbol-quick-access.d.ts +10 -3
- package/lib/browser/monaco-gotosymbol-quick-access.d.ts.map +1 -1
- package/lib/browser/monaco-gotosymbol-quick-access.js +19 -8
- package/lib/browser/monaco-gotosymbol-quick-access.js.map +1 -1
- package/lib/browser/monaco-indexed-db.d.ts +1 -1
- package/lib/browser/monaco-indexed-db.d.ts.map +1 -1
- package/lib/browser/monaco-indexed-db.js.map +1 -1
- package/lib/browser/monaco-keybinding.d.ts.map +1 -1
- package/lib/browser/monaco-keybinding.js +4 -2
- package/lib/browser/monaco-keybinding.js.map +1 -1
- package/lib/browser/monaco-keycode-map.d.ts +2 -2
- package/lib/browser/monaco-keycode-map.d.ts.map +1 -1
- package/lib/browser/monaco-keycode-map.js +122 -122
- package/lib/browser/monaco-keycode-map.js.map +1 -1
- package/lib/browser/monaco-languages.d.ts +1 -1
- package/lib/browser/monaco-languages.d.ts.map +1 -1
- package/lib/browser/monaco-languages.js +1 -0
- package/lib/browser/monaco-languages.js.map +1 -1
- package/lib/browser/monaco-menu.js +7 -7
- package/lib/browser/monaco-menu.js.map +1 -1
- package/lib/browser/monaco-mime-service.d.ts.map +1 -1
- package/lib/browser/monaco-mime-service.js +8 -4
- package/lib/browser/monaco-mime-service.js.map +1 -1
- package/lib/browser/monaco-outline-contribution.d.ts +15 -16
- package/lib/browser/monaco-outline-contribution.d.ts.map +1 -1
- package/lib/browser/monaco-outline-contribution.js +21 -19
- package/lib/browser/monaco-outline-contribution.js.map +1 -1
- package/lib/browser/monaco-quick-access-registry.d.ts.map +1 -1
- package/lib/browser/monaco-quick-access-registry.js +11 -13
- package/lib/browser/monaco-quick-access-registry.js.map +1 -1
- package/lib/browser/monaco-quick-input-service.d.ts +46 -25
- package/lib/browser/monaco-quick-input-service.d.ts.map +1 -1
- package/lib/browser/monaco-quick-input-service.js +40 -29
- package/lib/browser/monaco-quick-input-service.js.map +1 -1
- package/lib/browser/monaco-resolved-keybinding.d.ts +9 -7
- package/lib/browser/monaco-resolved-keybinding.d.ts.map +1 -1
- package/lib/browser/monaco-resolved-keybinding.js +35 -14
- package/lib/browser/monaco-resolved-keybinding.js.map +1 -1
- package/lib/browser/monaco-snippet-suggest-provider.d.ts +1 -1
- package/lib/browser/monaco-snippet-suggest-provider.d.ts.map +1 -1
- package/lib/browser/monaco-snippet-suggest-provider.js +5 -3
- package/lib/browser/monaco-snippet-suggest-provider.js.map +1 -1
- package/lib/browser/monaco-status-bar-contribution.d.ts +2 -2
- package/lib/browser/monaco-status-bar-contribution.d.ts.map +1 -1
- package/lib/browser/monaco-status-bar-contribution.js.map +1 -1
- package/lib/browser/monaco-text-model-service.d.ts +14 -8
- package/lib/browser/monaco-text-model-service.d.ts.map +1 -1
- package/lib/browser/monaco-text-model-service.js +35 -17
- package/lib/browser/monaco-text-model-service.js.map +1 -1
- package/lib/browser/monaco-theming-service.d.ts +1 -1
- package/lib/browser/monaco-theming-service.d.ts.map +1 -1
- package/lib/browser/monaco-theming-service.js.map +1 -1
- package/lib/browser/monaco-to-protocol-converter.d.ts +1 -1
- package/lib/browser/monaco-to-protocol-converter.d.ts.map +1 -1
- package/lib/browser/monaco-to-protocol-converter.js.map +1 -1
- package/lib/browser/monaco-workspace.d.ts +7 -6
- package/lib/browser/monaco-workspace.d.ts.map +1 -1
- package/lib/browser/monaco-workspace.js +13 -7
- package/lib/browser/monaco-workspace.js.map +1 -1
- package/lib/browser/protocol-to-monaco-converter.d.ts +1 -1
- package/lib/browser/protocol-to-monaco-converter.d.ts.map +1 -1
- package/lib/browser/protocol-to-monaco-converter.js +1 -0
- package/lib/browser/protocol-to-monaco-converter.js.map +1 -1
- package/lib/browser/textmate/monaco-textmate-service.d.ts.map +1 -1
- package/lib/browser/textmate/monaco-textmate-service.js +14 -11
- package/lib/browser/textmate/monaco-textmate-service.js.map +1 -1
- package/lib/browser/textmate/monaco-theme-registry.d.ts +5 -3
- package/lib/browser/textmate/monaco-theme-registry.d.ts.map +1 -1
- package/lib/browser/textmate/monaco-theme-registry.js +6 -3
- package/lib/browser/textmate/monaco-theme-registry.js.map +1 -1
- package/lib/browser/textmate/monaco-theme-types.d.ts +5 -4
- package/lib/browser/textmate/monaco-theme-types.d.ts.map +1 -1
- package/lib/browser/textmate/monaco-theme-types.js +1 -0
- package/lib/browser/textmate/monaco-theme-types.js.map +1 -1
- package/lib/browser/textmate/textmate-contribution.d.ts.map +1 -1
- package/lib/browser/textmate/textmate-contribution.js +1 -0
- package/lib/browser/textmate/textmate-contribution.js.map +1 -1
- package/lib/browser/textmate/textmate-snippet-completion-provider.d.ts +1 -1
- package/lib/browser/textmate/textmate-snippet-completion-provider.d.ts.map +1 -1
- package/lib/browser/textmate/textmate-snippet-completion-provider.js +3 -1
- package/lib/browser/textmate/textmate-snippet-completion-provider.js.map +1 -1
- package/lib/browser/textmate/textmate-tokenizer.d.ts +1 -1
- package/lib/browser/textmate/textmate-tokenizer.d.ts.map +1 -1
- package/lib/browser/textmate/textmate-tokenizer.js +2 -2
- package/lib/browser/textmate/textmate-tokenizer.js.map +1 -1
- package/package.json +9 -10
- package/src/browser/monaco-bulk-edit-service.ts +9 -4
- package/src/browser/monaco-color-registry.ts +17 -14
- package/src/browser/monaco-command-service.ts +8 -7
- package/src/browser/monaco-command.ts +18 -16
- package/src/browser/monaco-context-key-service.ts +25 -16
- package/src/browser/monaco-context-menu.ts +23 -6
- package/src/browser/monaco-diagnostic-collection.ts +4 -5
- package/src/browser/monaco-diff-editor.ts +12 -14
- package/src/browser/monaco-diff-navigator-factory.ts +18 -14
- package/src/browser/monaco-editor-model.ts +56 -24
- package/src/browser/monaco-editor-provider.ts +48 -114
- package/src/browser/monaco-editor-service.ts +27 -16
- package/src/browser/monaco-editor-zone-widget.ts +6 -2
- package/src/browser/monaco-editor.ts +85 -44
- package/src/browser/monaco-formatting-conflicts.ts +10 -5
- package/src/browser/monaco-frontend-application-contribution.ts +40 -2
- package/src/browser/monaco-frontend-module.ts +18 -14
- package/src/browser/monaco-gotoline-quick-access.ts +10 -5
- package/src/browser/monaco-gotosymbol-quick-access.ts +17 -6
- package/src/browser/monaco-indexed-db.ts +1 -0
- package/src/browser/monaco-keybinding.ts +3 -2
- package/src/browser/monaco-keycode-map.ts +72 -71
- package/src/browser/monaco-languages.ts +1 -0
- package/src/browser/monaco-menu.ts +7 -7
- package/src/browser/monaco-mime-service.ts +9 -5
- package/src/browser/monaco-outline-contribution.ts +36 -32
- package/src/browser/monaco-quick-access-registry.ts +29 -19
- package/src/browser/monaco-quick-input-service.ts +102 -59
- package/src/browser/monaco-resolved-keybinding.ts +52 -28
- package/src/browser/monaco-snippet-suggest-provider.ts +5 -3
- package/src/browser/monaco-status-bar-contribution.ts +2 -1
- package/src/browser/monaco-text-model-service.ts +49 -26
- package/src/browser/monaco-theming-service.ts +1 -0
- package/src/browser/monaco-to-protocol-converter.ts +1 -0
- package/src/browser/monaco-workspace.ts +28 -19
- package/src/browser/protocol-to-monaco-converter.ts +1 -0
- package/src/browser/textmate/monaco-textmate-service.ts +15 -12
- package/src/browser/textmate/monaco-theme-registry.ts +10 -5
- package/src/browser/textmate/monaco-theme-types.ts +5 -4
- package/src/browser/textmate/textmate-contribution.ts +1 -0
- package/src/browser/textmate/textmate-snippet-completion-provider.ts +4 -1
- package/src/browser/textmate/textmate-tokenizer.ts +3 -2
- package/lib/browser/monaco-browser-module.d.ts +0 -5
- package/lib/browser/monaco-browser-module.d.ts.map +0 -1
- package/lib/browser/monaco-browser-module.js +0 -27
- package/lib/browser/monaco-browser-module.js.map +0 -1
- package/lib/browser/monaco-comparers.d.ts +0 -10
- package/lib/browser/monaco-comparers.d.ts.map +0 -1
- package/lib/browser/monaco-comparers.js +0 -109
- package/lib/browser/monaco-comparers.js.map +0 -1
- package/lib/browser/monaco-loader.d.ts +0 -4
- package/lib/browser/monaco-loader.d.ts.map +0 -1
- package/lib/browser/monaco-loader.js +0 -177
- package/lib/browser/monaco-loader.js.map +0 -1
- package/lib/electron-browser/monaco-electron-module.d.ts +0 -5
- package/lib/electron-browser/monaco-electron-module.d.ts.map +0 -1
- package/lib/electron-browser/monaco-electron-module.js +0 -50
- package/lib/electron-browser/monaco-electron-module.js.map +0 -1
- package/src/browser/monaco-browser-module.ts +0 -26
- package/src/browser/monaco-comparers.ts +0 -125
- package/src/browser/monaco-loader.ts +0 -193
- package/src/electron-browser/monaco-electron-module.ts +0 -52
- package/src/typings/monaco/index.d.ts +0 -2471
|
@@ -25,14 +25,12 @@ import { MonacoCommandServiceFactory } from './monaco-command-service';
|
|
|
25
25
|
import { MonacoContextMenuService } from './monaco-context-menu';
|
|
26
26
|
import { MonacoDiffEditor } from './monaco-diff-editor';
|
|
27
27
|
import { MonacoDiffNavigatorFactory } from './monaco-diff-navigator-factory';
|
|
28
|
-
import { MonacoEditor, MonacoEditorServices } from './monaco-editor';
|
|
28
|
+
import { EditorServiceOverrides, MonacoEditor, MonacoEditorServices } from './monaco-editor';
|
|
29
29
|
import { MonacoEditorModel, WillSaveMonacoModelEvent } from './monaco-editor-model';
|
|
30
30
|
import { MonacoEditorService } from './monaco-editor-service';
|
|
31
31
|
import { MonacoTextModelService } from './monaco-text-model-service';
|
|
32
32
|
import { MonacoWorkspace } from './monaco-workspace';
|
|
33
33
|
import { MonacoBulkEditService } from './monaco-bulk-edit-service';
|
|
34
|
-
|
|
35
|
-
import IEditorOverrideServices = monaco.editor.IEditorOverrideServices;
|
|
36
34
|
import { ApplicationServer } from '@theia/core/lib/common/application-protocol';
|
|
37
35
|
import { ContributionProvider } from '@theia/core';
|
|
38
36
|
import { KeybindingRegistry, OpenerService, open, WidgetOpenerOptions, FormatType, PreferenceValidationService } from '@theia/core/lib/browser';
|
|
@@ -42,12 +40,27 @@ import { MonacoToProtocolConverter } from './monaco-to-protocol-converter';
|
|
|
42
40
|
import { ProtocolToMonacoConverter } from './protocol-to-monaco-converter';
|
|
43
41
|
import { FileSystemPreferences } from '@theia/filesystem/lib/browser';
|
|
44
42
|
import { MonacoQuickInputImplementation } from './monaco-quick-input-service';
|
|
43
|
+
import { ContextKeyService } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/browser/contextKeyService';
|
|
44
|
+
import * as monaco from '@theia/monaco-editor-core';
|
|
45
|
+
import { OpenerService as MonacoOpenerService } from '@theia/monaco-editor-core/esm/vs/editor/browser/services/openerService';
|
|
46
|
+
import { StandaloneCommandService, StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
|
|
47
|
+
import { IOpenerService, OpenExternalOptions, OpenInternalOptions } from '@theia/monaco-editor-core/esm/vs/platform/opener/common/opener';
|
|
48
|
+
import { SimpleKeybinding } from '@theia/monaco-editor-core/esm/vs/base/common/keybindings';
|
|
49
|
+
import { ICodeEditorService } from '@theia/monaco-editor-core/esm/vs/editor/browser/services/codeEditorService';
|
|
50
|
+
import { IInstantiationService } from '@theia/monaco-editor-core/esm/vs/platform/instantiation/common/instantiation';
|
|
51
|
+
import { IKeybindingService } from '@theia/monaco-editor-core/esm/vs/platform/keybinding/common/keybinding';
|
|
45
52
|
import { timeoutReject } from '@theia/core/lib/common/promise-util';
|
|
53
|
+
import { ITextModelService } from '@theia/monaco-editor-core/esm/vs/editor/common/services/resolverService';
|
|
54
|
+
import { IContextMenuService } from '@theia/monaco-editor-core/esm/vs/platform/contextview/browser/contextView';
|
|
55
|
+
import { IBulkEditService } from '@theia/monaco-editor-core/esm/vs/editor/browser/services/bulkEditService';
|
|
56
|
+
import { IContextKeyService } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey';
|
|
57
|
+
import { IQuickInputService } from '@theia/monaco-editor-core/esm/vs/platform/quickinput/common/quickInput';
|
|
58
|
+
import { ICommandService } from '@theia/monaco-editor-core/esm/vs/platform/commands/common/commands';
|
|
46
59
|
|
|
47
60
|
export const MonacoEditorFactory = Symbol('MonacoEditorFactory');
|
|
48
61
|
export interface MonacoEditorFactory {
|
|
49
62
|
readonly scheme: string;
|
|
50
|
-
create(model: MonacoEditorModel, defaultOptions: MonacoEditor.IOptions, defaultOverrides:
|
|
63
|
+
create(model: MonacoEditorModel, defaultOptions: MonacoEditor.IOptions, defaultOverrides: EditorServiceOverrides): MonacoEditor;
|
|
51
64
|
}
|
|
52
65
|
|
|
53
66
|
@injectable()
|
|
@@ -100,16 +113,11 @@ export class MonacoEditorProvider {
|
|
|
100
113
|
@inject(MonacoDiffNavigatorFactory) protected readonly diffNavigatorFactory: MonacoDiffNavigatorFactory,
|
|
101
114
|
/** @deprecated since 1.6.0 */
|
|
102
115
|
@inject(ApplicationServer) protected readonly applicationServer: ApplicationServer,
|
|
103
|
-
@inject(
|
|
116
|
+
@inject(ContextKeyService) protected readonly contextKeyService: ContextKeyService
|
|
104
117
|
) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
monaco.services.StaticServices.init = o => {
|
|
109
|
-
const result = init(o);
|
|
110
|
-
result[0].set(monaco.services.ICodeEditorService, codeEditorService);
|
|
111
|
-
return result;
|
|
112
|
-
};
|
|
118
|
+
StandaloneServices.initialize({
|
|
119
|
+
[ICodeEditorService.toString()]: codeEditorService,
|
|
120
|
+
});
|
|
113
121
|
}
|
|
114
122
|
|
|
115
123
|
protected async getModel(uri: URI, toDispose: DisposableCollection): Promise<MonacoEditorModel> {
|
|
@@ -131,35 +139,36 @@ export class MonacoEditorProvider {
|
|
|
131
139
|
return this.doCreateEditor(uri, (override, toDispose) => this.createEditor(uri, override, toDispose));
|
|
132
140
|
}
|
|
133
141
|
|
|
134
|
-
protected async doCreateEditor(uri: URI, factory: (
|
|
142
|
+
protected async doCreateEditor(uri: URI, factory: (
|
|
143
|
+
override: EditorServiceOverrides, toDispose: DisposableCollection) => Promise<MonacoEditor>
|
|
144
|
+
): Promise<MonacoEditor> {
|
|
135
145
|
const commandService = this.commandServiceFactory();
|
|
136
146
|
const domNode = document.createElement('div');
|
|
137
147
|
const contextKeyService = this.contextKeyService.createScoped(domNode);
|
|
138
148
|
const { codeEditorService, textModelService, contextMenuService } = this;
|
|
139
|
-
const
|
|
149
|
+
const workspaceEditService = this.bulkEditService;
|
|
140
150
|
const toDispose = new DisposableCollection(commandService);
|
|
141
|
-
const openerService = new
|
|
151
|
+
const openerService = new MonacoOpenerService(codeEditorService, commandService);
|
|
142
152
|
openerService.registerOpener({
|
|
143
153
|
open: (u, options) => this.interceptOpen(u, options)
|
|
144
154
|
});
|
|
145
|
-
const
|
|
146
|
-
codeEditorService,
|
|
147
|
-
textModelService,
|
|
148
|
-
contextMenuService,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
+
const overrides: EditorServiceOverrides = [
|
|
156
|
+
[ICodeEditorService, codeEditorService],
|
|
157
|
+
[ITextModelService, textModelService],
|
|
158
|
+
[IContextMenuService, contextMenuService],
|
|
159
|
+
[IBulkEditService, workspaceEditService],
|
|
160
|
+
[IContextKeyService, contextKeyService],
|
|
161
|
+
[IOpenerService, openerService],
|
|
162
|
+
[IQuickInputService, this.quickInputService],
|
|
163
|
+
[ICommandService, commandService]
|
|
164
|
+
];
|
|
165
|
+
const editor = await factory(overrides, toDispose);
|
|
155
166
|
editor.onDispose(() => toDispose.dispose());
|
|
156
167
|
|
|
157
|
-
this.suppressMonacoKeybindingListener(editor);
|
|
158
168
|
this.injectKeybindingResolver(editor);
|
|
159
169
|
|
|
160
|
-
const standaloneCommandService = new
|
|
170
|
+
const standaloneCommandService = new StandaloneCommandService(StandaloneServices.get(IInstantiationService));
|
|
161
171
|
commandService.setDelegate(standaloneCommandService);
|
|
162
|
-
toDispose.push(this.installReferencesController(editor));
|
|
163
172
|
|
|
164
173
|
toDispose.push(editor.onFocusChanged(focused => {
|
|
165
174
|
if (focused) {
|
|
@@ -178,7 +187,7 @@ export class MonacoEditorProvider {
|
|
|
178
187
|
/**
|
|
179
188
|
* Intercept internal Monaco open calls and delegate to OpenerService.
|
|
180
189
|
*/
|
|
181
|
-
protected async interceptOpen(monacoUri: monaco.Uri | string, monacoOptions?:
|
|
190
|
+
protected async interceptOpen(monacoUri: monaco.Uri | string, monacoOptions?: OpenInternalOptions | OpenExternalOptions): Promise<boolean> {
|
|
182
191
|
let options = undefined;
|
|
183
192
|
if (monacoOptions) {
|
|
184
193
|
if ('openToSide' in monacoOptions && monacoOptions.openToSide) {
|
|
@@ -204,30 +213,11 @@ export class MonacoEditorProvider {
|
|
|
204
213
|
}
|
|
205
214
|
}
|
|
206
215
|
|
|
207
|
-
/**
|
|
208
|
-
* Suppresses Monaco keydown listener to avoid triggering default Monaco keybindings
|
|
209
|
-
* if they are overridden by a user. Monaco keybindings should be registered as Theia keybindings
|
|
210
|
-
* to allow a user to customize them.
|
|
211
|
-
*/
|
|
212
|
-
protected suppressMonacoKeybindingListener(editor: MonacoEditor): void {
|
|
213
|
-
let keydownListener: monaco.IDisposable | undefined;
|
|
214
|
-
const keybindingService = editor.getControl()._standaloneKeybindingService;
|
|
215
|
-
for (const listener of keybindingService._store._toDispose) {
|
|
216
|
-
if ((listener as any)['_type'] === 'keydown') {
|
|
217
|
-
keydownListener = listener;
|
|
218
|
-
break;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
if (keydownListener) {
|
|
222
|
-
keydownListener.dispose();
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
216
|
protected injectKeybindingResolver(editor: MonacoEditor): void {
|
|
227
|
-
const keybindingService =
|
|
217
|
+
const keybindingService = StandaloneServices.get(IKeybindingService);
|
|
228
218
|
keybindingService.resolveKeybinding = keybinding => [new MonacoResolvedKeybinding(MonacoResolvedKeybinding.keySequence(keybinding), this.keybindingRegistry)];
|
|
229
219
|
keybindingService.resolveKeyboardEvent = keyboardEvent => {
|
|
230
|
-
const keybinding = new
|
|
220
|
+
const keybinding = new SimpleKeybinding(
|
|
231
221
|
keyboardEvent.ctrlKey,
|
|
232
222
|
keyboardEvent.shiftKey,
|
|
233
223
|
keyboardEvent.altKey,
|
|
@@ -238,7 +228,7 @@ export class MonacoEditorProvider {
|
|
|
238
228
|
};
|
|
239
229
|
}
|
|
240
230
|
|
|
241
|
-
protected createEditor(uri: URI, override:
|
|
231
|
+
protected createEditor(uri: URI, override: EditorServiceOverrides, toDispose: DisposableCollection): Promise<MonacoEditor> {
|
|
242
232
|
if (DiffUris.isDiffUri(uri)) {
|
|
243
233
|
return this.createMonacoDiffEditor(uri, override, toDispose);
|
|
244
234
|
}
|
|
@@ -248,7 +238,7 @@ export class MonacoEditorProvider {
|
|
|
248
238
|
protected get preferencePrefixes(): string[] {
|
|
249
239
|
return ['editor.'];
|
|
250
240
|
}
|
|
251
|
-
protected async createMonacoEditor(uri: URI, override:
|
|
241
|
+
protected async createMonacoEditor(uri: URI, override: EditorServiceOverrides, toDispose: DisposableCollection): Promise<MonacoEditor> {
|
|
252
242
|
const model = await this.getModel(uri, toDispose);
|
|
253
243
|
const options = this.createMonacoEditorOptions(model);
|
|
254
244
|
const factory = this.factories.getContributions().find(({ scheme }) => uri.scheme === scheme);
|
|
@@ -326,7 +316,7 @@ export class MonacoEditorProvider {
|
|
|
326
316
|
protected get diffPreferencePrefixes(): string[] {
|
|
327
317
|
return [...this.preferencePrefixes, 'diffEditor.'];
|
|
328
318
|
}
|
|
329
|
-
protected async createMonacoDiffEditor(uri: URI, override:
|
|
319
|
+
protected async createMonacoDiffEditor(uri: URI, override: EditorServiceOverrides, toDispose: DisposableCollection): Promise<MonacoDiffEditor> {
|
|
330
320
|
const [original, modified] = DiffUris.decode(uri);
|
|
331
321
|
|
|
332
322
|
const [originalModel, modifiedModel] = await Promise.all([this.getModel(original, toDispose), this.getModel(modified, toDispose)]);
|
|
@@ -391,7 +381,7 @@ export class MonacoEditorProvider {
|
|
|
391
381
|
protected toOptionName(preferenceName: string, prefixes: string[]): string {
|
|
392
382
|
for (const prefix of prefixes) {
|
|
393
383
|
if (preferenceName.startsWith(prefix)) {
|
|
394
|
-
return preferenceName.
|
|
384
|
+
return preferenceName.substring(prefix.length);
|
|
395
385
|
}
|
|
396
386
|
}
|
|
397
387
|
return preferenceName;
|
|
@@ -408,61 +398,6 @@ export class MonacoEditorProvider {
|
|
|
408
398
|
}
|
|
409
399
|
}
|
|
410
400
|
|
|
411
|
-
protected installReferencesController(editor: MonacoEditor): Disposable {
|
|
412
|
-
const control = editor.getControl();
|
|
413
|
-
const referencesController = control._contributions['editor.contrib.referencesController'];
|
|
414
|
-
const originalGotoReference = referencesController._gotoReference;
|
|
415
|
-
referencesController._gotoReference = async ref => {
|
|
416
|
-
if (referencesController._widget) {
|
|
417
|
-
referencesController._widget.hide();
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
referencesController._ignoreModelChangeEvent = true;
|
|
421
|
-
const range = monaco.Range.lift(ref.range).collapseToStart();
|
|
422
|
-
|
|
423
|
-
// preserve the model that it does not get disposed if an editor preview replaces an editor
|
|
424
|
-
const model = referencesController._model;
|
|
425
|
-
referencesController._model = undefined;
|
|
426
|
-
|
|
427
|
-
referencesController._editorService.openCodeEditor({
|
|
428
|
-
resource: ref.uri,
|
|
429
|
-
options: { selection: range }
|
|
430
|
-
}, control).then(openedEditor => {
|
|
431
|
-
referencesController._model = model;
|
|
432
|
-
referencesController._ignoreModelChangeEvent = false;
|
|
433
|
-
if (!openedEditor) {
|
|
434
|
-
referencesController.closeWidget();
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
if (openedEditor !== control) {
|
|
438
|
-
// preserve the model that it does not get disposed in `referencesController.closeWidget`
|
|
439
|
-
referencesController._model = undefined;
|
|
440
|
-
|
|
441
|
-
// to preserve the active editor
|
|
442
|
-
const focus = control.focus;
|
|
443
|
-
control.focus = () => { };
|
|
444
|
-
referencesController.closeWidget();
|
|
445
|
-
control.focus = focus;
|
|
446
|
-
|
|
447
|
-
const modelPromise = Promise.resolve(model) as any;
|
|
448
|
-
modelPromise.cancel = () => { };
|
|
449
|
-
openedEditor._contributions['editor.contrib.referencesController'].toggleWidget(range, modelPromise, true);
|
|
450
|
-
return;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
if (referencesController._widget) {
|
|
454
|
-
referencesController._widget.show(range);
|
|
455
|
-
referencesController._widget.focusOnReferenceTree();
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
}, (e: any) => {
|
|
459
|
-
referencesController._ignoreModelChangeEvent = false;
|
|
460
|
-
monaco.error.onUnexpectedError(e);
|
|
461
|
-
});
|
|
462
|
-
};
|
|
463
|
-
return Disposable.create(() => referencesController._gotoReference = originalGotoReference);
|
|
464
|
-
}
|
|
465
|
-
|
|
466
401
|
getDiffNavigator(editor: TextEditor): DiffNavigator {
|
|
467
402
|
if (editor instanceof MonacoDiffEditor) {
|
|
468
403
|
return editor.diffNavigator;
|
|
@@ -472,9 +407,8 @@ export class MonacoEditorProvider {
|
|
|
472
407
|
|
|
473
408
|
async createInline(uri: URI, node: HTMLElement, options?: MonacoEditor.IOptions): Promise<MonacoEditor> {
|
|
474
409
|
return this.doCreateEditor(uri, async (override, toDispose) => {
|
|
475
|
-
override.
|
|
476
|
-
|
|
477
|
-
};
|
|
410
|
+
const overrides = override ? Array.from(override) : [];
|
|
411
|
+
overrides.push([IContextMenuService, { showContextMenu: () => {/** no op! */ } }]);
|
|
478
412
|
const document = new MonacoEditorModel({
|
|
479
413
|
uri,
|
|
480
414
|
readContents: async () => '',
|
|
@@ -494,7 +428,7 @@ export class MonacoEditorProvider {
|
|
|
494
428
|
minHeight: 1,
|
|
495
429
|
maxHeight: 1
|
|
496
430
|
}, MonacoEditorProvider.inlineOptions, options),
|
|
497
|
-
|
|
431
|
+
overrides
|
|
498
432
|
);
|
|
499
433
|
});
|
|
500
434
|
}
|
|
@@ -21,15 +21,18 @@ import { EditorWidget, EditorOpenerOptions, EditorManager, CustomEditorWidget }
|
|
|
21
21
|
import { MonacoEditor } from './monaco-editor';
|
|
22
22
|
import { MonacoToProtocolConverter } from './monaco-to-protocol-converter';
|
|
23
23
|
import { MonacoEditorModel } from './monaco-editor-model';
|
|
24
|
+
import { IResourceEditorInput } from '@theia/monaco-editor-core/esm/vs/platform/editor/common/editor';
|
|
25
|
+
import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
|
|
26
|
+
import { IStandaloneThemeService } from '@theia/monaco-editor-core/esm/vs/editor/standalone/common/standaloneTheme';
|
|
27
|
+
import { StandaloneCodeEditorService } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditorService';
|
|
28
|
+
import { IContextKeyService } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey';
|
|
29
|
+
import { StandaloneCodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditor';
|
|
30
|
+
import { ICodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser';
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
import CommonCodeEditor = monaco.editor.CommonCodeEditor;
|
|
27
|
-
import IResourceEditorInput = monaco.editor.IResourceEditorInput;
|
|
28
|
-
|
|
29
|
-
decorate(injectable(), monaco.services.CodeEditorServiceImpl);
|
|
32
|
+
decorate(injectable(), StandaloneCodeEditorService);
|
|
30
33
|
|
|
31
34
|
@injectable()
|
|
32
|
-
export class MonacoEditorService extends
|
|
35
|
+
export class MonacoEditorService extends StandaloneCodeEditorService {
|
|
33
36
|
|
|
34
37
|
public static readonly ENABLE_PREVIEW_PREFERENCE: string = 'editor.enablePreview';
|
|
35
38
|
|
|
@@ -49,13 +52,13 @@ export class MonacoEditorService extends monaco.services.CodeEditorServiceImpl {
|
|
|
49
52
|
protected readonly preferencesService: PreferenceService;
|
|
50
53
|
|
|
51
54
|
constructor() {
|
|
52
|
-
super(
|
|
55
|
+
super(StandaloneServices.get(IContextKeyService), StandaloneServices.get(IStandaloneThemeService));
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
/**
|
|
56
59
|
* Monaco active editor is either focused or last focused editor.
|
|
57
60
|
*/
|
|
58
|
-
override getActiveCodeEditor():
|
|
61
|
+
override getActiveCodeEditor(): StandaloneCodeEditor | null {
|
|
59
62
|
let editor = MonacoEditor.getCurrent(this.editors);
|
|
60
63
|
if (!editor && CustomEditorWidget.is(this.shell.activeWidget)) {
|
|
61
64
|
const model = this.shell.activeWidget.modelRef.object;
|
|
@@ -63,18 +66,25 @@ export class MonacoEditorService extends monaco.services.CodeEditorServiceImpl {
|
|
|
63
66
|
editor = MonacoEditor.findByDocument(this.editors, model.editorTextModel)[0];
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
|
-
|
|
69
|
+
const candidate = editor?.getControl();
|
|
70
|
+
// Since we extend a private super class, we have to check that the thing that matches the public interface also matches the private expectations the superclass.
|
|
71
|
+
/* eslint-disable-next-line no-null/no-null */
|
|
72
|
+
return candidate instanceof StandaloneCodeEditor ? candidate : null;
|
|
67
73
|
}
|
|
68
74
|
|
|
69
|
-
override async openCodeEditor(input: IResourceEditorInput, source
|
|
75
|
+
override async openCodeEditor(input: IResourceEditorInput, source: ICodeEditor | null, sideBySide?: boolean): Promise<ICodeEditor | null> {
|
|
70
76
|
const uri = new URI(input.resource.toString());
|
|
71
77
|
const openerOptions = this.createEditorOpenerOptions(input, source, sideBySide);
|
|
72
78
|
const widget = await open(this.openerService, uri, openerOptions);
|
|
73
79
|
const editorWidget = await this.findEditorWidgetByUri(widget, uri.toString());
|
|
74
80
|
if (editorWidget && editorWidget.editor instanceof MonacoEditor) {
|
|
75
|
-
|
|
81
|
+
const candidate = editorWidget.editor.getControl();
|
|
82
|
+
// Since we extend a private super class, we have to check that the thing that matches the public interface also matches the private expectations the superclass.
|
|
83
|
+
// eslint-disable-next-line no-null/no-null
|
|
84
|
+
return candidate instanceof StandaloneCodeEditor ? candidate : null;
|
|
76
85
|
}
|
|
77
|
-
|
|
86
|
+
// eslint-disable-next-line no-null/no-null
|
|
87
|
+
return null;
|
|
78
88
|
}
|
|
79
89
|
|
|
80
90
|
protected async findEditorWidgetByUri(widget: object | undefined, uriAsString: string): Promise<EditorWidget | undefined> {
|
|
@@ -95,13 +105,13 @@ export class MonacoEditorService extends monaco.services.CodeEditorServiceImpl {
|
|
|
95
105
|
return undefined;
|
|
96
106
|
}
|
|
97
107
|
|
|
98
|
-
protected createEditorOpenerOptions(input: IResourceEditorInput, source
|
|
108
|
+
protected createEditorOpenerOptions(input: IResourceEditorInput, source: ICodeEditor | null, sideBySide?: boolean): EditorOpenerOptions {
|
|
99
109
|
const mode = this.getEditorOpenMode(input);
|
|
100
|
-
const selection = input.options && this.m2p.asRange(input.options.selection);
|
|
101
110
|
const widgetOptions = this.getWidgetOptions(source, sideBySide);
|
|
102
111
|
const preview = !!this.preferencesService.get<boolean>(MonacoEditorService.ENABLE_PREVIEW_PREFERENCE, false);
|
|
103
|
-
return { mode,
|
|
112
|
+
return { mode, widgetOptions, preview };
|
|
104
113
|
}
|
|
114
|
+
|
|
105
115
|
protected getEditorOpenMode(input: IResourceEditorInput): WidgetOpenMode {
|
|
106
116
|
const options = {
|
|
107
117
|
preserveFocus: false,
|
|
@@ -113,7 +123,8 @@ export class MonacoEditorService extends monaco.services.CodeEditorServiceImpl {
|
|
|
113
123
|
}
|
|
114
124
|
return options.revealIfVisible ? 'activate' : 'open';
|
|
115
125
|
}
|
|
116
|
-
|
|
126
|
+
|
|
127
|
+
protected getWidgetOptions(source: ICodeEditor | null, sideBySide?: boolean): ApplicationShell.WidgetOptions | undefined {
|
|
117
128
|
const ref = MonacoEditor.getWidgetFor(this.editors, source);
|
|
118
129
|
if (!ref) {
|
|
119
130
|
return undefined;
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
import { Disposable, DisposableCollection, Event, Emitter } from '@theia/core';
|
|
22
22
|
import { TrackedRangeStickiness } from '@theia/editor/lib/browser';
|
|
23
|
+
import * as monaco from '@theia/monaco-editor-core';
|
|
23
24
|
|
|
24
25
|
export interface MonacoEditorViewZone extends monaco.editor.IViewZone {
|
|
25
26
|
id: string;
|
|
@@ -44,9 +45,12 @@ export class MonacoEditorZoneWidget implements Disposable {
|
|
|
44
45
|
this.toHide
|
|
45
46
|
);
|
|
46
47
|
|
|
48
|
+
editor: monaco.editor.IStandaloneCodeEditor;
|
|
49
|
+
|
|
47
50
|
constructor(
|
|
48
|
-
|
|
51
|
+
editorInstance: monaco.editor.IStandaloneCodeEditor, readonly showArrow: boolean = true
|
|
49
52
|
) {
|
|
53
|
+
this.editor = editorInstance;
|
|
50
54
|
this.zoneNode.classList.add('zone-widget');
|
|
51
55
|
this.containerNode.classList.add('zone-widget-container');
|
|
52
56
|
this.zoneNode.appendChild(this.containerNode);
|
|
@@ -199,7 +203,7 @@ class Arrow implements Disposable {
|
|
|
199
203
|
|
|
200
204
|
constructor(
|
|
201
205
|
private readonly _editor: monaco.editor.ICodeEditor
|
|
202
|
-
) {}
|
|
206
|
+
) { }
|
|
203
207
|
|
|
204
208
|
dispose(): void {
|
|
205
209
|
this.hide();
|