@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
|
@@ -18,7 +18,7 @@ import { injectable, inject, unmanaged } from '@theia/core/shared/inversify';
|
|
|
18
18
|
import { ElementExt } from '@theia/core/shared/@phosphor/domutils';
|
|
19
19
|
import URI from '@theia/core/lib/common/uri';
|
|
20
20
|
import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
|
|
21
|
-
import { DisposableCollection, Disposable, Emitter, Event } from '@theia/core/lib/common';
|
|
21
|
+
import { DisposableCollection, Disposable, Emitter, Event, nullToUndefined, MaybeNull } from '@theia/core/lib/common';
|
|
22
22
|
import {
|
|
23
23
|
Dimension,
|
|
24
24
|
EditorManager,
|
|
@@ -34,20 +34,25 @@ import {
|
|
|
34
34
|
ReplaceTextParams,
|
|
35
35
|
EditorDecoration,
|
|
36
36
|
EditorMouseEvent,
|
|
37
|
-
EncodingMode
|
|
37
|
+
EncodingMode,
|
|
38
|
+
EditorDecorationOptions
|
|
38
39
|
} from '@theia/editor/lib/browser';
|
|
39
40
|
import { MonacoEditorModel } from './monaco-editor-model';
|
|
40
41
|
import { MonacoToProtocolConverter } from './monaco-to-protocol-converter';
|
|
41
42
|
import { ProtocolToMonacoConverter } from './protocol-to-monaco-converter';
|
|
42
43
|
import { TextEdit } from '@theia/core/shared/vscode-languageserver-protocol';
|
|
43
44
|
import { UTF8 } from '@theia/core/lib/common/encodings';
|
|
45
|
+
import * as monaco from '@theia/monaco-editor-core';
|
|
46
|
+
import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
|
|
47
|
+
import { ILanguageService } from '@theia/monaco-editor-core/esm/vs/editor/common/languages/language';
|
|
48
|
+
import { IInstantiationService, ServiceIdentifier } from '@theia/monaco-editor-core/esm/vs/platform/instantiation/common/instantiation';
|
|
49
|
+
import { ICodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser';
|
|
50
|
+
import { ServiceCollection } from '@theia/monaco-editor-core/esm/vs/platform/instantiation/common/serviceCollection';
|
|
51
|
+
import { IStandaloneEditorConstructionOptions, StandaloneEditor } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditor';
|
|
44
52
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
import IStandaloneCodeEditor = monaco.editor.IStandaloneCodeEditor;
|
|
49
|
-
import IIdentifiedSingleEditOperation = monaco.editor.IIdentifiedSingleEditOperation;
|
|
50
|
-
import IBoxSizing = ElementExt.IBoxSizing;
|
|
53
|
+
export type ServicePair<T> = [ServiceIdentifier<T>, T];
|
|
54
|
+
|
|
55
|
+
export interface EditorServiceOverrides extends Iterable<ServicePair<unknown>> { }
|
|
51
56
|
|
|
52
57
|
@injectable()
|
|
53
58
|
export class MonacoEditorServices {
|
|
@@ -73,7 +78,7 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
73
78
|
protected readonly autoSizing: boolean;
|
|
74
79
|
protected readonly minHeight: number;
|
|
75
80
|
protected readonly maxHeight: number;
|
|
76
|
-
protected editor: IStandaloneCodeEditor;
|
|
81
|
+
protected editor: monaco.editor.IStandaloneCodeEditor;
|
|
77
82
|
|
|
78
83
|
protected readonly onCursorPositionChangedEmitter = new Emitter<Position>();
|
|
79
84
|
protected readonly onSelectionChangedEmitter = new Emitter<Range>();
|
|
@@ -84,7 +89,6 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
84
89
|
readonly onLanguageChanged = this.onLanguageChangedEmitter.event;
|
|
85
90
|
protected readonly onScrollChangedEmitter = new Emitter<void>();
|
|
86
91
|
readonly onEncodingChanged = this.document.onDidChangeEncoding;
|
|
87
|
-
// eslint-disable-next-line no-null/no-null
|
|
88
92
|
protected readonly onResizeEmitter = new Emitter<Dimension | null>();
|
|
89
93
|
readonly onDidResize = this.onResizeEmitter.event;
|
|
90
94
|
|
|
@@ -96,7 +100,7 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
96
100
|
readonly node: HTMLElement,
|
|
97
101
|
services: MonacoEditorServices,
|
|
98
102
|
options?: MonacoEditor.IOptions,
|
|
99
|
-
override?:
|
|
103
|
+
override?: EditorServiceOverrides
|
|
100
104
|
) {
|
|
101
105
|
super(services);
|
|
102
106
|
this.toDispose.pushAll([
|
|
@@ -124,8 +128,8 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
124
128
|
return this.document.setEncoding(encoding, mode);
|
|
125
129
|
}
|
|
126
130
|
|
|
127
|
-
protected create(options?: IStandaloneEditorConstructionOptions, override?:
|
|
128
|
-
|
|
131
|
+
protected create(options?: monaco.editor.IStandaloneEditorConstructionOptions | IStandaloneEditorConstructionOptions, override?: EditorServiceOverrides): Disposable {
|
|
132
|
+
const combinedOptions = {
|
|
129
133
|
...options,
|
|
130
134
|
lightbulb: { enabled: true },
|
|
131
135
|
fixedOverflowWidgets: true,
|
|
@@ -136,10 +140,22 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
136
140
|
verticalScrollbarSize: 10,
|
|
137
141
|
horizontalScrollbarSize: 10
|
|
138
142
|
}
|
|
139
|
-
}
|
|
143
|
+
} as IStandaloneEditorConstructionOptions;
|
|
144
|
+
const instantiator = this.getInstantiatorWithOverrides(override);
|
|
145
|
+
// Incomparability of internal and external interfaces.
|
|
146
|
+
return this.editor = instantiator.createInstance(StandaloneEditor, this.node, combinedOptions) as unknown as monaco.editor.IStandaloneCodeEditor;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
protected getInstantiatorWithOverrides(override?: EditorServiceOverrides): IInstantiationService {
|
|
150
|
+
const instantiator = StandaloneServices.initialize({});
|
|
151
|
+
if (override) {
|
|
152
|
+
const overrideServices = new ServiceCollection(...override);
|
|
153
|
+
return instantiator.createChild(overrideServices);
|
|
154
|
+
}
|
|
155
|
+
return instantiator;
|
|
140
156
|
}
|
|
141
157
|
|
|
142
|
-
protected addHandlers(codeEditor: IStandaloneCodeEditor): void {
|
|
158
|
+
protected addHandlers(codeEditor: monaco.editor.IStandaloneCodeEditor): void {
|
|
143
159
|
this.toDispose.push(codeEditor.onDidChangeModelLanguage(e =>
|
|
144
160
|
this.fireLanguageChanged(e.newLanguage)
|
|
145
161
|
));
|
|
@@ -169,7 +185,8 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
169
185
|
element: element || undefined,
|
|
170
186
|
mouseColumn: this.m2p.asPosition(undefined, e.target.mouseColumn).character,
|
|
171
187
|
range: range && this.m2p.asRange(range) || undefined,
|
|
172
|
-
position: position && this.m2p.asPosition(position.lineNumber, position.column) || undefined
|
|
188
|
+
position: position && this.m2p.asPosition(position.lineNumber, position.column) || undefined,
|
|
189
|
+
detail: undefined,
|
|
173
190
|
},
|
|
174
191
|
event: e.event.browserEvent
|
|
175
192
|
});
|
|
@@ -333,7 +350,7 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
333
350
|
this.editor.trigger(source, handlerId, payload);
|
|
334
351
|
}
|
|
335
352
|
|
|
336
|
-
getControl(): IStandaloneCodeEditor {
|
|
353
|
+
getControl(): monaco.editor.IStandaloneCodeEditor {
|
|
337
354
|
return this.editor;
|
|
338
355
|
}
|
|
339
356
|
|
|
@@ -383,11 +400,11 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
383
400
|
return { width, height };
|
|
384
401
|
}
|
|
385
402
|
|
|
386
|
-
protected getWidth(hostNode: HTMLElement, boxSizing: IBoxSizing): number {
|
|
403
|
+
protected getWidth(hostNode: HTMLElement, boxSizing: ElementExt.IBoxSizing): number {
|
|
387
404
|
return hostNode.offsetWidth - boxSizing.horizontalSum;
|
|
388
405
|
}
|
|
389
406
|
|
|
390
|
-
protected getHeight(hostNode: HTMLElement, boxSizing: IBoxSizing): number {
|
|
407
|
+
protected getHeight(hostNode: HTMLElement, boxSizing: ElementExt.IBoxSizing): number {
|
|
391
408
|
if (!this.autoSizing) {
|
|
392
409
|
return hostNode.offsetHeight - boxSizing.verticalSum;
|
|
393
410
|
}
|
|
@@ -424,27 +441,46 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
424
441
|
}
|
|
425
442
|
}
|
|
426
443
|
|
|
427
|
-
get commandService(): monaco.commands.ICommandService {
|
|
428
|
-
return this.editor._commandService;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
get instantiationService(): monaco.instantiation.IInstantiationService {
|
|
432
|
-
return this.editor._instantiationService;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
444
|
deltaDecorations(params: DeltaDecorationParams): string[] {
|
|
436
445
|
const oldDecorations = params.oldDecorations;
|
|
437
446
|
const newDecorations = this.toDeltaDecorations(params);
|
|
438
447
|
return this.editor.deltaDecorations(oldDecorations, newDecorations);
|
|
439
448
|
}
|
|
440
449
|
|
|
441
|
-
protected toDeltaDecorations(params: DeltaDecorationParams): IModelDeltaDecoration[] {
|
|
442
|
-
return params.newDecorations.map(
|
|
443
|
-
|
|
444
|
-
|
|
450
|
+
protected toDeltaDecorations(params: DeltaDecorationParams): monaco.editor.IModelDeltaDecoration[] {
|
|
451
|
+
return params.newDecorations.map(({ options: theiaOptions, range }) => {
|
|
452
|
+
const options: monaco.editor.IModelDecorationOptions = {
|
|
453
|
+
...theiaOptions,
|
|
454
|
+
hoverMessage: this.fromStringToMarkdownString(theiaOptions.hoverMessage),
|
|
455
|
+
glyphMarginHoverMessage: this.fromStringToMarkdownString(theiaOptions.glyphMarginHoverMessage)
|
|
456
|
+
};
|
|
457
|
+
return {
|
|
458
|
+
options,
|
|
459
|
+
range: this.p2m.asRange(range),
|
|
460
|
+
};
|
|
445
461
|
});
|
|
446
462
|
}
|
|
447
463
|
|
|
464
|
+
protected fromStringToMarkdownString(hoverMessage?: string | monaco.IMarkdownString | monaco.IMarkdownString[]): monaco.IMarkdownString | monaco.IMarkdownString[] | undefined {
|
|
465
|
+
if (typeof hoverMessage === 'string') {
|
|
466
|
+
return { value: hoverMessage };
|
|
467
|
+
}
|
|
468
|
+
return hoverMessage;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
protected fromMarkdownToString(maybeMarkdown?: null | string | monaco.IMarkdownString | monaco.IMarkdownString[]): string | undefined {
|
|
472
|
+
if (!maybeMarkdown) {
|
|
473
|
+
return undefined;
|
|
474
|
+
}
|
|
475
|
+
if (typeof maybeMarkdown === 'string') {
|
|
476
|
+
return maybeMarkdown;
|
|
477
|
+
}
|
|
478
|
+
if (Array.isArray(maybeMarkdown)) {
|
|
479
|
+
return maybeMarkdown.map(({ value }) => value).join('\n');
|
|
480
|
+
}
|
|
481
|
+
return maybeMarkdown.value;
|
|
482
|
+
}
|
|
483
|
+
|
|
448
484
|
getLinesDecorations(startLineNumber: number, endLineNumber: number): (EditorDecoration & Readonly<{ id: string }>)[] {
|
|
449
485
|
const toPosition = (line: number): monaco.Position => this.p2m.asPosition({ line, character: 0 });
|
|
450
486
|
const start = toPosition(startLineNumber).lineNumber;
|
|
@@ -457,12 +493,17 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
457
493
|
|
|
458
494
|
protected toEditorDecoration(decoration: monaco.editor.IModelDecoration): EditorDecoration & Readonly<{ id: string }> {
|
|
459
495
|
const range = this.m2p.asRange(decoration.range);
|
|
460
|
-
const { id, options } = decoration;
|
|
496
|
+
const { id, options: monacoOptions } = decoration;
|
|
497
|
+
const options: MaybeNull<EditorDecorationOptions> = {
|
|
498
|
+
...monacoOptions,
|
|
499
|
+
hoverMessage: this.fromMarkdownToString(monacoOptions.hoverMessage),
|
|
500
|
+
glyphMarginHoverMessage: this.fromMarkdownToString(monacoOptions.hoverMessage),
|
|
501
|
+
};
|
|
461
502
|
return {
|
|
462
|
-
options,
|
|
503
|
+
options: nullToUndefined(options),
|
|
463
504
|
range,
|
|
464
505
|
id
|
|
465
|
-
}
|
|
506
|
+
};
|
|
466
507
|
}
|
|
467
508
|
|
|
468
509
|
getVisibleColumn(position: Position): number {
|
|
@@ -470,7 +511,7 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
470
511
|
}
|
|
471
512
|
|
|
472
513
|
async replaceText(params: ReplaceTextParams): Promise<boolean> {
|
|
473
|
-
const edits: IIdentifiedSingleEditOperation[] = params.replaceOperations.map(param => {
|
|
514
|
+
const edits: monaco.editor.IIdentifiedSingleEditOperation[] = params.replaceOperations.map(param => {
|
|
474
515
|
const range = monaco.Range.fromPositions(this.p2m.asPosition(param.range.start), this.p2m.asPosition(param.range.end));
|
|
475
516
|
return {
|
|
476
517
|
forceMoveMarkers: true,
|
|
@@ -486,7 +527,7 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
486
527
|
}
|
|
487
528
|
|
|
488
529
|
executeEdits(edits: TextEdit[]): boolean {
|
|
489
|
-
return this.editor.executeEdits('MonacoEditor', this.p2m.asTextEdits(edits) as IIdentifiedSingleEditOperation[]);
|
|
530
|
+
return this.editor.executeEdits('MonacoEditor', this.p2m.asTextEdits(edits) as monaco.editor.IIdentifiedSingleEditOperation[]);
|
|
490
531
|
}
|
|
491
532
|
|
|
492
533
|
storeViewState(): object {
|
|
@@ -505,11 +546,11 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
505
546
|
}
|
|
506
547
|
|
|
507
548
|
async detectLanguage(): Promise<void> {
|
|
508
|
-
const
|
|
549
|
+
const languageService = StandaloneServices.get(ILanguageService);
|
|
509
550
|
const firstLine = this.document.textEditorModel.getLineContent(1);
|
|
510
551
|
const model = this.getControl().getModel();
|
|
511
|
-
const language =
|
|
512
|
-
this.setLanguage(language.
|
|
552
|
+
const language = languageService.createByFilepathOrFirstLine(model && model.uri, firstLine);
|
|
553
|
+
this.setLanguage(language.languageId);
|
|
513
554
|
this._languageAutoDetected = true;
|
|
514
555
|
}
|
|
515
556
|
|
|
@@ -558,7 +599,7 @@ export namespace MonacoEditor {
|
|
|
558
599
|
maxHeight?: number;
|
|
559
600
|
}
|
|
560
601
|
|
|
561
|
-
export interface IOptions extends ICommonOptions, IStandaloneEditorConstructionOptions { }
|
|
602
|
+
export interface IOptions extends ICommonOptions, monaco.editor.IStandaloneEditorConstructionOptions { }
|
|
562
603
|
|
|
563
604
|
export function getAll(manager: EditorManager): MonacoEditor[] {
|
|
564
605
|
return manager.all.map(e => get(e)).filter(e => !!e) as MonacoEditor[];
|
|
@@ -580,16 +621,16 @@ export namespace MonacoEditor {
|
|
|
580
621
|
}
|
|
581
622
|
|
|
582
623
|
export function findByDocument(manager: EditorManager, document: MonacoEditorModel): MonacoEditor[] {
|
|
583
|
-
return getAll(manager).filter(
|
|
624
|
+
return getAll(manager).filter(candidate => candidate.documents.has(document));
|
|
584
625
|
}
|
|
585
626
|
|
|
586
|
-
export function getWidgetFor(manager: EditorManager, control: monaco.editor.ICodeEditor | undefined): EditorWidget | undefined {
|
|
627
|
+
export function getWidgetFor(manager: EditorManager, control: monaco.editor.ICodeEditor | ICodeEditor | undefined | null): EditorWidget | undefined {
|
|
587
628
|
if (!control) {
|
|
588
629
|
return undefined;
|
|
589
630
|
}
|
|
590
631
|
return manager.all.find(widget => {
|
|
591
|
-
const
|
|
592
|
-
return
|
|
632
|
+
const candidate = get(widget);
|
|
633
|
+
return candidate && candidate.getControl() === control;
|
|
593
634
|
});
|
|
594
635
|
}
|
|
595
636
|
}
|
|
@@ -18,8 +18,12 @@ import { injectable, inject } from '@theia/core/shared/inversify';
|
|
|
18
18
|
import { PreferenceService, FrontendApplicationContribution, PreferenceLanguageOverrideService } from '@theia/core/lib/browser';
|
|
19
19
|
import { EditorManager } from '@theia/editor/lib/browser';
|
|
20
20
|
import { MonacoQuickInputService } from './monaco-quick-input-service';
|
|
21
|
+
import * as monaco from '@theia/monaco-editor-core';
|
|
22
|
+
import { FormattingConflicts, FormattingMode } from '@theia/monaco-editor-core/esm/vs/editor/contrib/format/browser/format';
|
|
23
|
+
import { DocumentFormattingEditProvider, DocumentRangeFormattingEditProvider } from '@theia/monaco-editor-core/esm/vs/editor/common/languages';
|
|
24
|
+
import { ITextModel } from '@theia/monaco-editor-core/esm/vs/editor/common/model';
|
|
21
25
|
|
|
22
|
-
type FormattingEditProvider =
|
|
26
|
+
type FormattingEditProvider = DocumentFormattingEditProvider | DocumentRangeFormattingEditProvider;
|
|
23
27
|
|
|
24
28
|
const PREFERENCE_NAME = 'editor.defaultFormatter';
|
|
25
29
|
|
|
@@ -39,12 +43,13 @@ export class MonacoFormattingConflictsContribution implements FrontendApplicatio
|
|
|
39
43
|
protected readonly editorManager: EditorManager;
|
|
40
44
|
|
|
41
45
|
async initialize(): Promise<void> {
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
|
|
47
|
+
FormattingConflicts.setFormatterSelector(<T extends FormattingEditProvider>(
|
|
48
|
+
formatters: T[], document: ITextModel, mode: FormattingMode) =>
|
|
44
49
|
this.selectFormatter(formatters, document, mode));
|
|
45
50
|
}
|
|
46
51
|
|
|
47
|
-
|
|
52
|
+
protected async setDefaultFormatter(language: string, formatter: string): Promise<void> {
|
|
48
53
|
const name = this.preferenceSchema.overridePreferenceName({
|
|
49
54
|
preferenceName: PREFERENCE_NAME,
|
|
50
55
|
overrideIdentifier: language
|
|
@@ -63,7 +68,7 @@ export class MonacoFormattingConflictsContribution implements FrontendApplicatio
|
|
|
63
68
|
}
|
|
64
69
|
|
|
65
70
|
private async selectFormatter<T extends FormattingEditProvider>(
|
|
66
|
-
formatters: T[], document: monaco.editor.ITextModel, mode:
|
|
71
|
+
formatters: T[], document: monaco.editor.ITextModel | ITextModel, mode: FormattingMode): Promise<T | undefined> {
|
|
67
72
|
|
|
68
73
|
if (formatters.length === 0) {
|
|
69
74
|
return undefined;
|
|
@@ -15,20 +15,58 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
import { injectable, inject } from '@theia/core/shared/inversify';
|
|
18
|
-
import { FrontendApplicationContribution, PreferenceSchemaProvider } from '@theia/core/lib/browser';
|
|
18
|
+
import { FrontendApplicationContribution, PreferenceSchemaProvider, QuickAccessRegistry } from '@theia/core/lib/browser';
|
|
19
19
|
import { MonacoSnippetSuggestProvider } from './monaco-snippet-suggest-provider';
|
|
20
|
+
import * as monaco from '@theia/monaco-editor-core';
|
|
21
|
+
import { setSnippetSuggestSupport } from '@theia/monaco-editor-core/esm/vs/editor/contrib/suggest/browser/suggest';
|
|
22
|
+
import { CompletionItemProvider } from '@theia/monaco-editor-core/esm/vs/editor/common/languages';
|
|
23
|
+
import { MonacoEditorService } from './monaco-editor-service';
|
|
24
|
+
import { MonacoTextModelService } from './monaco-text-model-service';
|
|
25
|
+
import { ContextKeyService as VSCodeContextKeyService } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/browser/contextKeyService';
|
|
26
|
+
import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
|
|
27
|
+
import { ICodeEditorService } from '@theia/monaco-editor-core/esm/vs/editor/browser/services/codeEditorService';
|
|
28
|
+
import { ITextModelService } from '@theia/monaco-editor-core/esm/vs/editor/common/services/resolverService';
|
|
29
|
+
import { IContextKeyService } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey';
|
|
30
|
+
import { IContextMenuService } from '@theia/monaco-editor-core/esm/vs/platform/contextview/browser/contextView';
|
|
31
|
+
import { MonacoContextMenuService } from './monaco-context-menu';
|
|
20
32
|
|
|
21
33
|
@injectable()
|
|
22
34
|
export class MonacoFrontendApplicationContribution implements FrontendApplicationContribution {
|
|
23
35
|
|
|
36
|
+
@inject(MonacoEditorService)
|
|
37
|
+
protected readonly codeEditorService: MonacoEditorService;
|
|
38
|
+
|
|
39
|
+
@inject(MonacoTextModelService)
|
|
40
|
+
protected readonly textModelService: MonacoTextModelService;
|
|
41
|
+
|
|
42
|
+
@inject(VSCodeContextKeyService)
|
|
43
|
+
protected readonly contextKeyService: VSCodeContextKeyService;
|
|
44
|
+
|
|
24
45
|
@inject(MonacoSnippetSuggestProvider)
|
|
25
46
|
protected readonly snippetSuggestProvider: MonacoSnippetSuggestProvider;
|
|
26
47
|
|
|
27
48
|
@inject(PreferenceSchemaProvider)
|
|
28
49
|
protected readonly preferenceSchema: PreferenceSchemaProvider;
|
|
29
50
|
|
|
51
|
+
@inject(QuickAccessRegistry)
|
|
52
|
+
protected readonly quickAccessRegistry: QuickAccessRegistry;
|
|
53
|
+
|
|
54
|
+
@inject(MonacoContextMenuService)
|
|
55
|
+
protected readonly contextMenuService: MonacoContextMenuService;
|
|
56
|
+
|
|
30
57
|
async initialize(): Promise<void> {
|
|
31
|
-
|
|
58
|
+
const { codeEditorService, textModelService, contextKeyService, contextMenuService } = this;
|
|
59
|
+
StandaloneServices.initialize({
|
|
60
|
+
[ICodeEditorService.toString()]: codeEditorService,
|
|
61
|
+
[ITextModelService.toString()]: textModelService,
|
|
62
|
+
[IContextKeyService.toString()]: contextKeyService,
|
|
63
|
+
[IContextMenuService.toString()]: contextMenuService,
|
|
64
|
+
});
|
|
65
|
+
// Monaco registers certain quick access providers (e.g. QuickCommandAccess) at import time, but we want to use our own.
|
|
66
|
+
this.quickAccessRegistry.clear();
|
|
67
|
+
|
|
68
|
+
// Incomparability of enum types between public and private API's
|
|
69
|
+
setSnippetSuggestSupport(this.snippetSuggestProvider as unknown as CompletionItemProvider);
|
|
32
70
|
|
|
33
71
|
for (const language of monaco.languages.getLanguages()) {
|
|
34
72
|
this.preferenceSchema.registerOverrideIdentifier(language.id);
|
|
@@ -66,8 +66,12 @@ import { GotoLineQuickAccessContribution } from './monaco-gotoline-quick-access'
|
|
|
66
66
|
import { GotoSymbolQuickAccessContribution } from './monaco-gotosymbol-quick-access';
|
|
67
67
|
import { QuickAccessContribution, QuickAccessRegistry } from '@theia/core/lib/browser/quick-input/quick-access';
|
|
68
68
|
import { MonacoQuickAccessRegistry } from './monaco-quick-access-registry';
|
|
69
|
+
import { ContextKeyService as VSCodeContextKeyService } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/browser/contextKeyService';
|
|
70
|
+
import { ConfigurationTarget, IConfigurationChangeEvent, IConfigurationService } from '@theia/monaco-editor-core/esm/vs/platform/configuration/common/configuration';
|
|
71
|
+
import { StandaloneConfigurationService, StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
|
|
72
|
+
import { Configuration } from '@theia/monaco-editor-core/esm/vs/platform/configuration/common/configurationModels';
|
|
69
73
|
|
|
70
|
-
decorate(injectable(),
|
|
74
|
+
decorate(injectable(), VSCodeContextKeyService);
|
|
71
75
|
|
|
72
76
|
MonacoThemingService.init();
|
|
73
77
|
|
|
@@ -95,8 +99,8 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
|
95
99
|
bind(MonacoConfigurationService).toDynamicValue(({ container }) =>
|
|
96
100
|
createMonacoConfigurationService(container)
|
|
97
101
|
).inSingletonScope();
|
|
98
|
-
bind(
|
|
99
|
-
new
|
|
102
|
+
bind(VSCodeContextKeyService).toDynamicValue(({ container }) =>
|
|
103
|
+
new VSCodeContextKeyService(container.get(MonacoConfigurationService))
|
|
100
104
|
).inSingletonScope();
|
|
101
105
|
|
|
102
106
|
bind(MonacoBulkEditService).toSelf().inSingletonScope();
|
|
@@ -162,11 +166,11 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
|
162
166
|
});
|
|
163
167
|
|
|
164
168
|
export const MonacoConfigurationService = Symbol('MonacoConfigurationService');
|
|
165
|
-
export function createMonacoConfigurationService(container: interfaces.Container):
|
|
169
|
+
export function createMonacoConfigurationService(container: interfaces.Container): IConfigurationService {
|
|
166
170
|
const preferences = container.get<PreferenceService>(PreferenceService);
|
|
167
171
|
const preferenceSchemaProvider = container.get<PreferenceSchemaProvider>(PreferenceSchemaProvider);
|
|
168
|
-
const service =
|
|
169
|
-
const _configuration = service
|
|
172
|
+
const service = StandaloneServices.get(IConfigurationService) as StandaloneConfigurationService;
|
|
173
|
+
const _configuration: Configuration = service['_configuration'];
|
|
170
174
|
|
|
171
175
|
_configuration.getValue = (section, overrides) => {
|
|
172
176
|
const overrideIdentifier: string | undefined = (overrides && 'overrideIdentifier' in overrides && typeof overrides.overrideIdentifier === 'string')
|
|
@@ -183,12 +187,12 @@ export function createMonacoConfigurationService(container: interfaces.Container
|
|
|
183
187
|
return proxy;
|
|
184
188
|
};
|
|
185
189
|
|
|
186
|
-
const toTarget = (scope: PreferenceScope):
|
|
190
|
+
const toTarget = (scope: PreferenceScope): ConfigurationTarget => {
|
|
187
191
|
switch (scope) {
|
|
188
|
-
case PreferenceScope.Default: return
|
|
189
|
-
case PreferenceScope.User: return
|
|
190
|
-
case PreferenceScope.Workspace: return
|
|
191
|
-
case PreferenceScope.Folder: return
|
|
192
|
+
case PreferenceScope.Default: return ConfigurationTarget.DEFAULT;
|
|
193
|
+
case PreferenceScope.User: return ConfigurationTarget.USER;
|
|
194
|
+
case PreferenceScope.Workspace: return ConfigurationTarget.WORKSPACE;
|
|
195
|
+
case PreferenceScope.Folder: return ConfigurationTarget.WORKSPACE_FOLDER;
|
|
192
196
|
}
|
|
193
197
|
};
|
|
194
198
|
|
|
@@ -204,7 +208,7 @@ export function createMonacoConfigurationService(container: interfaces.Container
|
|
|
204
208
|
keys: new Set<string>(),
|
|
205
209
|
overrides: new Map<string, Set<string>>()
|
|
206
210
|
});
|
|
207
|
-
const fireDidChangeConfiguration = (source:
|
|
211
|
+
const fireDidChangeConfiguration = (source: ConfigurationTarget, context: FireDidChangeConfigurationContext): void => {
|
|
208
212
|
if (!context.affectedKeys.size) {
|
|
209
213
|
return;
|
|
210
214
|
}
|
|
@@ -212,7 +216,7 @@ export function createMonacoConfigurationService(container: interfaces.Container
|
|
|
212
216
|
for (const [override, values] of context.overrides) {
|
|
213
217
|
overrides.push([override, [...values]]);
|
|
214
218
|
}
|
|
215
|
-
service
|
|
219
|
+
service['_onDidChangeConfiguration'].fire(<IConfigurationChangeEvent>{
|
|
216
220
|
change: {
|
|
217
221
|
keys: [...context.keys],
|
|
218
222
|
overrides
|
|
@@ -243,7 +247,7 @@ export function createMonacoConfigurationService(container: interfaces.Container
|
|
|
243
247
|
};
|
|
244
248
|
|
|
245
249
|
preferences.onPreferencesChanged(event => {
|
|
246
|
-
let source:
|
|
250
|
+
let source: ConfigurationTarget | undefined;
|
|
247
251
|
let context = newFireDidChangeConfigurationContext();
|
|
248
252
|
for (let key of Object.keys(event)) {
|
|
249
253
|
const change = event[key];
|
|
@@ -16,23 +16,28 @@
|
|
|
16
16
|
|
|
17
17
|
import { QuickAccessContribution } from '@theia/core/lib/browser/quick-input';
|
|
18
18
|
import { injectable } from '@theia/core/shared/inversify';
|
|
19
|
+
import { ICodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser';
|
|
20
|
+
import { ICodeEditorService } from '@theia/monaco-editor-core/esm/vs/editor/browser/services/codeEditorService';
|
|
21
|
+
import { StandaloneGotoLineQuickAccessProvider } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/quickAccess/standaloneGotoLineQuickAccess';
|
|
22
|
+
import { IQuickAccessRegistry, Extensions } from '@theia/monaco-editor-core/esm/vs/platform/quickinput/common/quickAccess';
|
|
23
|
+
import { Registry } from '@theia/monaco-editor-core/esm/vs/platform/registry/common/platform';
|
|
19
24
|
|
|
20
|
-
export class GotoLineQuickAccess extends
|
|
25
|
+
export class GotoLineQuickAccess extends StandaloneGotoLineQuickAccessProvider {
|
|
21
26
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
27
|
constructor(...services: any[]);
|
|
23
|
-
constructor(@
|
|
28
|
+
constructor(@ICodeEditorService private readonly service: ICodeEditorService) {
|
|
24
29
|
super(service);
|
|
25
30
|
}
|
|
26
31
|
|
|
27
|
-
override get activeTextEditorControl():
|
|
28
|
-
return this.service.getFocusedCodeEditor() || this.service.getActiveCodeEditor();
|
|
32
|
+
override get activeTextEditorControl(): ICodeEditor | undefined {
|
|
33
|
+
return (this.service.getFocusedCodeEditor() || this.service.getActiveCodeEditor()) ?? undefined;
|
|
29
34
|
}
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
@injectable()
|
|
33
38
|
export class GotoLineQuickAccessContribution implements QuickAccessContribution {
|
|
34
39
|
registerQuickAccessProvider(): void {
|
|
35
|
-
|
|
40
|
+
Registry.as<IQuickAccessRegistry>(Extensions.Quickaccess).registerQuickAccessProvider({
|
|
36
41
|
ctor: GotoLineQuickAccess,
|
|
37
42
|
prefix: ':',
|
|
38
43
|
placeholder: '',
|
|
@@ -16,23 +16,34 @@
|
|
|
16
16
|
|
|
17
17
|
import { QuickAccessContribution } from '@theia/core/lib/browser/quick-input';
|
|
18
18
|
import { injectable } from '@theia/core/shared/inversify';
|
|
19
|
+
import { ICodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser';
|
|
20
|
+
import { ICodeEditorService } from '@theia/monaco-editor-core/esm/vs/editor/browser/services/codeEditorService';
|
|
21
|
+
import { ILanguageFeaturesService } from '@theia/monaco-editor-core/esm/vs/editor/common/services/languageFeatures';
|
|
22
|
+
import { IOutlineModelService } from '@theia/monaco-editor-core/esm/vs/editor/contrib/documentSymbols/browser/outlineModel';
|
|
23
|
+
import { StandaloneGotoSymbolQuickAccessProvider } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/quickAccess/standaloneGotoSymbolQuickAccess';
|
|
24
|
+
import { IQuickAccessRegistry, Extensions } from '@theia/monaco-editor-core/esm/vs/platform/quickinput/common/quickAccess';
|
|
25
|
+
import { Registry } from '@theia/monaco-editor-core/esm/vs/platform/registry/common/platform';
|
|
19
26
|
|
|
20
|
-
export class GotoSymbolQuickAccess extends
|
|
27
|
+
export class GotoSymbolQuickAccess extends StandaloneGotoSymbolQuickAccessProvider {
|
|
21
28
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
29
|
constructor(...services: any[]);
|
|
23
|
-
constructor(
|
|
24
|
-
|
|
30
|
+
constructor(
|
|
31
|
+
@ICodeEditorService protected readonly codeEditorService: ICodeEditorService,
|
|
32
|
+
@ILanguageFeaturesService protected readonly languageFeatures: ILanguageFeaturesService,
|
|
33
|
+
@IOutlineModelService protected readonly outlineService: IOutlineModelService,
|
|
34
|
+
) {
|
|
35
|
+
super(codeEditorService, languageFeatures, outlineService);
|
|
25
36
|
}
|
|
26
37
|
|
|
27
|
-
override get activeTextEditorControl():
|
|
28
|
-
return this.
|
|
38
|
+
override get activeTextEditorControl(): ICodeEditor | undefined {
|
|
39
|
+
return (this.codeEditorService.getFocusedCodeEditor() ?? this.codeEditorService.getActiveCodeEditor()) ?? undefined;
|
|
29
40
|
}
|
|
30
41
|
}
|
|
31
42
|
|
|
32
43
|
@injectable()
|
|
33
44
|
export class GotoSymbolQuickAccessContribution implements QuickAccessContribution {
|
|
34
45
|
registerQuickAccessProvider(): void {
|
|
35
|
-
|
|
46
|
+
Registry.as<IQuickAccessRegistry>(Extensions.Quickaccess).registerQuickAccessProvider({
|
|
36
47
|
ctor: GotoSymbolQuickAccess,
|
|
37
48
|
prefix: '@',
|
|
38
49
|
placeholder: '',
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
import * as idb from 'idb';
|
|
18
18
|
import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
19
19
|
import { BuiltinThemeProvider, Theme, ThemeService, ThemeServiceSymbol } from '@theia/core/lib/browser/theming';
|
|
20
|
+
import * as monaco from '@theia/monaco-editor-core';
|
|
20
21
|
type ThemeMix = import('./textmate/monaco-theme-registry').ThemeMix;
|
|
21
22
|
|
|
22
23
|
let _monacoDB: Promise<idb.IDBPDatabase> | undefined;
|
|
@@ -20,6 +20,7 @@ import { MonacoCommands } from './monaco-command';
|
|
|
20
20
|
import { MonacoCommandRegistry } from './monaco-command-registry';
|
|
21
21
|
import { environment } from '@theia/core';
|
|
22
22
|
import { MonacoResolvedKeybinding } from './monaco-resolved-keybinding';
|
|
23
|
+
import { KeybindingsRegistry } from '@theia/monaco-editor-core/esm/vs/platform/keybinding/common/keybindingsRegistry';
|
|
23
24
|
|
|
24
25
|
@injectable()
|
|
25
26
|
export class MonacoKeybindingContribution implements KeybindingContribution {
|
|
@@ -28,11 +29,11 @@ export class MonacoKeybindingContribution implements KeybindingContribution {
|
|
|
28
29
|
protected readonly commands: MonacoCommandRegistry;
|
|
29
30
|
|
|
30
31
|
registerKeybindings(registry: KeybindingRegistry): void {
|
|
31
|
-
const defaultKeybindings =
|
|
32
|
+
const defaultKeybindings = KeybindingsRegistry.getDefaultKeybindings();
|
|
32
33
|
for (const item of defaultKeybindings) {
|
|
33
34
|
const command = this.commands.validate(item.command);
|
|
34
35
|
if (command) {
|
|
35
|
-
const when = item.when && item.when.serialize();
|
|
36
|
+
const when = (item.when && item.when.serialize()) ?? undefined;
|
|
36
37
|
let keybinding;
|
|
37
38
|
if (item.command === MonacoCommands.GO_TO_DEFINITION && !environment.electron.is()) {
|
|
38
39
|
keybinding = 'ctrlcmd+f11';
|