@theia/monaco 1.53.0-next.55 → 1.53.0-next.64

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.
Files changed (77) hide show
  1. package/README.md +100 -100
  2. package/data/monaco-nls.json +1379 -1379
  3. package/data/monaco-themes/vscode/dark_plus.json +201 -201
  4. package/data/monaco-themes/vscode/dark_theia.json +5 -5
  5. package/data/monaco-themes/vscode/dark_vs.json +393 -393
  6. package/data/monaco-themes/vscode/hc_black.json +457 -457
  7. package/data/monaco-themes/vscode/hc_light.json +590 -590
  8. package/data/monaco-themes/vscode/hc_theia.json +5 -5
  9. package/data/monaco-themes/vscode/hc_theia_light.json +5 -5
  10. package/data/monaco-themes/vscode/light_plus.json +202 -202
  11. package/data/monaco-themes/vscode/light_theia.json +10 -10
  12. package/data/monaco-themes/vscode/light_vs.json +421 -421
  13. package/lib/browser/monaco-editor-zone-widget.js +1 -1
  14. package/lib/browser/monaco-frontend-application-contribution.js +25 -25
  15. package/lib/browser/simple-monaco-editor.d.ts +3 -1
  16. package/lib/browser/simple-monaco-editor.d.ts.map +1 -1
  17. package/lib/browser/simple-monaco-editor.js +9 -2
  18. package/lib/browser/simple-monaco-editor.js.map +1 -1
  19. package/package.json +8 -8
  20. package/src/browser/index.ts +17 -17
  21. package/src/browser/markdown-renderer/monaco-markdown-renderer.ts +109 -109
  22. package/src/browser/monaco-bulk-edit-service.ts +64 -64
  23. package/src/browser/monaco-color-registry.ts +73 -73
  24. package/src/browser/monaco-command-registry.ts +85 -85
  25. package/src/browser/monaco-command-service.ts +90 -90
  26. package/src/browser/monaco-command.ts +303 -303
  27. package/src/browser/monaco-context-key-service.ts +144 -144
  28. package/src/browser/monaco-context-menu.ts +112 -112
  29. package/src/browser/monaco-diff-editor.ts +141 -141
  30. package/src/browser/monaco-diff-navigator-factory.ts +39 -39
  31. package/src/browser/monaco-editor-model.ts +693 -693
  32. package/src/browser/monaco-editor-peek-view-widget.ts +233 -233
  33. package/src/browser/monaco-editor-provider.ts +455 -455
  34. package/src/browser/monaco-editor-service.ts +152 -152
  35. package/src/browser/monaco-editor-zone-widget.ts +250 -250
  36. package/src/browser/monaco-editor.ts +733 -733
  37. package/src/browser/monaco-formatting-conflicts.ts +116 -116
  38. package/src/browser/monaco-frontend-application-contribution.ts +182 -182
  39. package/src/browser/monaco-frontend-module.ts +319 -319
  40. package/src/browser/monaco-gotoline-quick-access.ts +47 -47
  41. package/src/browser/monaco-gotosymbol-quick-access.ts +53 -53
  42. package/src/browser/monaco-icon-registry.ts +49 -49
  43. package/src/browser/monaco-indexed-db.ts +130 -130
  44. package/src/browser/monaco-init.ts +134 -134
  45. package/src/browser/monaco-keybinding.ts +111 -111
  46. package/src/browser/monaco-keycode-map.ts +171 -171
  47. package/src/browser/monaco-languages.ts +177 -177
  48. package/src/browser/monaco-marker-collection.ts +83 -83
  49. package/src/browser/monaco-menu.ts +147 -147
  50. package/src/browser/monaco-mime-service.ts +71 -71
  51. package/src/browser/monaco-outline-contribution.ts +404 -404
  52. package/src/browser/monaco-outline-decorator.ts +66 -66
  53. package/src/browser/monaco-quick-access-registry.ts +112 -112
  54. package/src/browser/monaco-quick-input-service.ts +701 -701
  55. package/src/browser/monaco-resolved-keybinding.ts +162 -162
  56. package/src/browser/monaco-snippet-suggest-provider.ts +306 -306
  57. package/src/browser/monaco-standalone-theme-service.ts +51 -51
  58. package/src/browser/monaco-status-bar-contribution.ts +110 -110
  59. package/src/browser/monaco-text-model-service.ts +157 -157
  60. package/src/browser/monaco-theming-service.ts +204 -204
  61. package/src/browser/monaco-to-protocol-converter.ts +82 -82
  62. package/src/browser/monaco-undo-redo-handler.ts +64 -64
  63. package/src/browser/monaco-workspace.ts +416 -416
  64. package/src/browser/protocol-to-monaco-converter.ts +158 -158
  65. package/src/browser/simple-monaco-editor.ts +228 -216
  66. package/src/browser/style/index.css +266 -266
  67. package/src/browser/textmate/index.ts +20 -20
  68. package/src/browser/textmate/monaco-textmate-frontend-bindings.ts +90 -90
  69. package/src/browser/textmate/monaco-textmate-service.ts +187 -187
  70. package/src/browser/textmate/monaco-theme-registry.ts +176 -176
  71. package/src/browser/textmate/monaco-theme-types.ts +37 -37
  72. package/src/browser/textmate/textmate-contribution.ts +29 -29
  73. package/src/browser/textmate/textmate-registry.ts +129 -129
  74. package/src/browser/textmate/textmate-snippet-completion-provider.ts +73 -73
  75. package/src/browser/textmate/textmate-tokenizer.ts +84 -84
  76. package/src/browser/workspace-symbol-command.ts +196 -196
  77. package/src/package.spec.ts +28 -28
@@ -1,152 +1,152 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2017 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { injectable, inject, decorate } from '@theia/core/shared/inversify';
18
- import URI from '@theia/core/lib/common/uri';
19
- import { OpenerService, open, WidgetOpenMode, ApplicationShell, PreferenceService } from '@theia/core/lib/browser';
20
- import { EditorWidget, EditorOpenerOptions, EditorManager, CustomEditorWidget } from '@theia/editor/lib/browser';
21
- import { MonacoEditor } from './monaco-editor';
22
- import { MonacoToProtocolConverter } from './monaco-to-protocol-converter';
23
- import { MonacoEditorModel } from './monaco-editor-model';
24
- import { IResourceEditorInput, ITextResourceEditorInput } from '@theia/monaco-editor-core/esm/vs/platform/editor/common/editor';
25
- import { StandaloneCodeEditorService } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditorService';
26
- import { StandaloneCodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditor';
27
- import { ICodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser';
28
- import { IContextKeyService } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey';
29
- import { IThemeService } from '@theia/monaco-editor-core/esm/vs/platform/theme/common/themeService';
30
-
31
- decorate(injectable(), StandaloneCodeEditorService);
32
-
33
- export const VSCodeContextKeyService = Symbol('VSCodeContextKeyService');
34
- export const VSCodeThemeService = Symbol('VSCodeThemeService');
35
-
36
- export const MonacoEditorServiceFactory = Symbol('MonacoEditorServiceFactory');
37
- export type MonacoEditorServiceFactoryType = (contextKeyService: IContextKeyService, themeService: IThemeService) => MonacoEditorService;
38
-
39
- @injectable()
40
- export class MonacoEditorService extends StandaloneCodeEditorService {
41
-
42
- public static readonly ENABLE_PREVIEW_PREFERENCE: string = 'editor.enablePreview';
43
-
44
- @inject(OpenerService)
45
- protected readonly openerService: OpenerService;
46
-
47
- @inject(MonacoToProtocolConverter)
48
- protected readonly m2p: MonacoToProtocolConverter;
49
-
50
- @inject(ApplicationShell)
51
- protected readonly shell: ApplicationShell;
52
-
53
- @inject(EditorManager)
54
- protected readonly editors: EditorManager;
55
-
56
- @inject(PreferenceService)
57
- protected readonly preferencesService: PreferenceService;
58
-
59
- constructor(@inject(VSCodeContextKeyService) contextKeyService: IContextKeyService, @inject(VSCodeThemeService) themeService: IThemeService) {
60
- super(contextKeyService, themeService);
61
- }
62
-
63
- /**
64
- * Monaco active editor is either focused or last focused editor.
65
- */
66
- override getActiveCodeEditor(): StandaloneCodeEditor | null {
67
- let editor = MonacoEditor.getCurrent(this.editors);
68
- if (!editor && CustomEditorWidget.is(this.shell.activeWidget)) {
69
- const model = this.shell.activeWidget.modelRef.object;
70
- if (model?.editorTextModel instanceof MonacoEditorModel) {
71
- editor = MonacoEditor.findByDocument(this.editors, model.editorTextModel)[0];
72
- }
73
- }
74
- const candidate = editor?.getControl();
75
- // 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.
76
- /* eslint-disable-next-line no-null/no-null */
77
- return candidate instanceof StandaloneCodeEditor ? candidate : null;
78
- }
79
-
80
- override async openCodeEditor(input: IResourceEditorInput, source: ICodeEditor | null, sideBySide?: boolean): Promise<ICodeEditor | null> {
81
- const uri = new URI(input.resource.toString());
82
- const openerOptions = this.createEditorOpenerOptions(input, source, sideBySide);
83
- const widget = await open(this.openerService, uri, openerOptions);
84
- const editorWidget = await this.findEditorWidgetByUri(widget, uri.toString());
85
- if (editorWidget && editorWidget.editor instanceof MonacoEditor) {
86
- const candidate = editorWidget.editor.getControl();
87
- // 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.
88
- // eslint-disable-next-line no-null/no-null
89
- return candidate instanceof StandaloneCodeEditor ? candidate : null;
90
- }
91
- // eslint-disable-next-line no-null/no-null
92
- return null;
93
- }
94
-
95
- protected async findEditorWidgetByUri(widget: object | undefined, uriAsString: string): Promise<EditorWidget | undefined> {
96
- if (widget instanceof EditorWidget) {
97
- if (widget.editor.uri.toString() === uriAsString) {
98
- return widget;
99
- }
100
- return undefined;
101
- }
102
- if (ApplicationShell.TrackableWidgetProvider.is(widget)) {
103
- for (const childWidget of widget.getTrackableWidgets()) {
104
- const editorWidget = await this.findEditorWidgetByUri(childWidget, uriAsString);
105
- if (editorWidget) {
106
- return editorWidget;
107
- }
108
- }
109
- }
110
- return undefined;
111
- }
112
-
113
- protected createEditorOpenerOptions(input: IResourceEditorInput | ITextResourceEditorInput, source: ICodeEditor | null, sideBySide?: boolean): EditorOpenerOptions {
114
- const mode = this.getEditorOpenMode(input);
115
- const widgetOptions = this.getWidgetOptions(source, sideBySide);
116
- const selection = this.getSelection(input);
117
- const preview = !!this.preferencesService.get<boolean>(MonacoEditorService.ENABLE_PREVIEW_PREFERENCE, false);
118
- return { mode, widgetOptions, preview, selection };
119
- }
120
-
121
- protected getSelection(input: IResourceEditorInput | ITextResourceEditorInput): EditorOpenerOptions['selection'] {
122
- if ('options' in input && input.options && 'selection' in input.options) {
123
- return this.m2p.asRange(input.options.selection);
124
- }
125
- }
126
-
127
- protected getEditorOpenMode(input: IResourceEditorInput): WidgetOpenMode {
128
- const options = {
129
- preserveFocus: false,
130
- revealIfVisible: true,
131
- ...input.options
132
- };
133
- if (options.preserveFocus) {
134
- return 'reveal';
135
- }
136
- return options.revealIfVisible ? 'activate' : 'open';
137
- }
138
-
139
- protected getWidgetOptions(source: ICodeEditor | null, sideBySide?: boolean): ApplicationShell.WidgetOptions | undefined {
140
- const ref = MonacoEditor.getWidgetFor(this.editors, source);
141
- if (!ref) {
142
- return undefined;
143
- }
144
- const area = (ref && this.shell.getAreaFor(ref)) || 'main';
145
- const mode = ref && sideBySide ? 'split-right' : undefined;
146
- if (area === 'secondaryWindow') {
147
- return { area: 'main', mode };
148
- }
149
- return { area, mode, ref };
150
- }
151
-
152
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2017 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { injectable, inject, decorate } from '@theia/core/shared/inversify';
18
+ import URI from '@theia/core/lib/common/uri';
19
+ import { OpenerService, open, WidgetOpenMode, ApplicationShell, PreferenceService } from '@theia/core/lib/browser';
20
+ import { EditorWidget, EditorOpenerOptions, EditorManager, CustomEditorWidget } from '@theia/editor/lib/browser';
21
+ import { MonacoEditor } from './monaco-editor';
22
+ import { MonacoToProtocolConverter } from './monaco-to-protocol-converter';
23
+ import { MonacoEditorModel } from './monaco-editor-model';
24
+ import { IResourceEditorInput, ITextResourceEditorInput } from '@theia/monaco-editor-core/esm/vs/platform/editor/common/editor';
25
+ import { StandaloneCodeEditorService } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditorService';
26
+ import { StandaloneCodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditor';
27
+ import { ICodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser';
28
+ import { IContextKeyService } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey';
29
+ import { IThemeService } from '@theia/monaco-editor-core/esm/vs/platform/theme/common/themeService';
30
+
31
+ decorate(injectable(), StandaloneCodeEditorService);
32
+
33
+ export const VSCodeContextKeyService = Symbol('VSCodeContextKeyService');
34
+ export const VSCodeThemeService = Symbol('VSCodeThemeService');
35
+
36
+ export const MonacoEditorServiceFactory = Symbol('MonacoEditorServiceFactory');
37
+ export type MonacoEditorServiceFactoryType = (contextKeyService: IContextKeyService, themeService: IThemeService) => MonacoEditorService;
38
+
39
+ @injectable()
40
+ export class MonacoEditorService extends StandaloneCodeEditorService {
41
+
42
+ public static readonly ENABLE_PREVIEW_PREFERENCE: string = 'editor.enablePreview';
43
+
44
+ @inject(OpenerService)
45
+ protected readonly openerService: OpenerService;
46
+
47
+ @inject(MonacoToProtocolConverter)
48
+ protected readonly m2p: MonacoToProtocolConverter;
49
+
50
+ @inject(ApplicationShell)
51
+ protected readonly shell: ApplicationShell;
52
+
53
+ @inject(EditorManager)
54
+ protected readonly editors: EditorManager;
55
+
56
+ @inject(PreferenceService)
57
+ protected readonly preferencesService: PreferenceService;
58
+
59
+ constructor(@inject(VSCodeContextKeyService) contextKeyService: IContextKeyService, @inject(VSCodeThemeService) themeService: IThemeService) {
60
+ super(contextKeyService, themeService);
61
+ }
62
+
63
+ /**
64
+ * Monaco active editor is either focused or last focused editor.
65
+ */
66
+ override getActiveCodeEditor(): StandaloneCodeEditor | null {
67
+ let editor = MonacoEditor.getCurrent(this.editors);
68
+ if (!editor && CustomEditorWidget.is(this.shell.activeWidget)) {
69
+ const model = this.shell.activeWidget.modelRef.object;
70
+ if (model?.editorTextModel instanceof MonacoEditorModel) {
71
+ editor = MonacoEditor.findByDocument(this.editors, model.editorTextModel)[0];
72
+ }
73
+ }
74
+ const candidate = editor?.getControl();
75
+ // 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.
76
+ /* eslint-disable-next-line no-null/no-null */
77
+ return candidate instanceof StandaloneCodeEditor ? candidate : null;
78
+ }
79
+
80
+ override async openCodeEditor(input: IResourceEditorInput, source: ICodeEditor | null, sideBySide?: boolean): Promise<ICodeEditor | null> {
81
+ const uri = new URI(input.resource.toString());
82
+ const openerOptions = this.createEditorOpenerOptions(input, source, sideBySide);
83
+ const widget = await open(this.openerService, uri, openerOptions);
84
+ const editorWidget = await this.findEditorWidgetByUri(widget, uri.toString());
85
+ if (editorWidget && editorWidget.editor instanceof MonacoEditor) {
86
+ const candidate = editorWidget.editor.getControl();
87
+ // 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.
88
+ // eslint-disable-next-line no-null/no-null
89
+ return candidate instanceof StandaloneCodeEditor ? candidate : null;
90
+ }
91
+ // eslint-disable-next-line no-null/no-null
92
+ return null;
93
+ }
94
+
95
+ protected async findEditorWidgetByUri(widget: object | undefined, uriAsString: string): Promise<EditorWidget | undefined> {
96
+ if (widget instanceof EditorWidget) {
97
+ if (widget.editor.uri.toString() === uriAsString) {
98
+ return widget;
99
+ }
100
+ return undefined;
101
+ }
102
+ if (ApplicationShell.TrackableWidgetProvider.is(widget)) {
103
+ for (const childWidget of widget.getTrackableWidgets()) {
104
+ const editorWidget = await this.findEditorWidgetByUri(childWidget, uriAsString);
105
+ if (editorWidget) {
106
+ return editorWidget;
107
+ }
108
+ }
109
+ }
110
+ return undefined;
111
+ }
112
+
113
+ protected createEditorOpenerOptions(input: IResourceEditorInput | ITextResourceEditorInput, source: ICodeEditor | null, sideBySide?: boolean): EditorOpenerOptions {
114
+ const mode = this.getEditorOpenMode(input);
115
+ const widgetOptions = this.getWidgetOptions(source, sideBySide);
116
+ const selection = this.getSelection(input);
117
+ const preview = !!this.preferencesService.get<boolean>(MonacoEditorService.ENABLE_PREVIEW_PREFERENCE, false);
118
+ return { mode, widgetOptions, preview, selection };
119
+ }
120
+
121
+ protected getSelection(input: IResourceEditorInput | ITextResourceEditorInput): EditorOpenerOptions['selection'] {
122
+ if ('options' in input && input.options && 'selection' in input.options) {
123
+ return this.m2p.asRange(input.options.selection);
124
+ }
125
+ }
126
+
127
+ protected getEditorOpenMode(input: IResourceEditorInput): WidgetOpenMode {
128
+ const options = {
129
+ preserveFocus: false,
130
+ revealIfVisible: true,
131
+ ...input.options
132
+ };
133
+ if (options.preserveFocus) {
134
+ return 'reveal';
135
+ }
136
+ return options.revealIfVisible ? 'activate' : 'open';
137
+ }
138
+
139
+ protected getWidgetOptions(source: ICodeEditor | null, sideBySide?: boolean): ApplicationShell.WidgetOptions | undefined {
140
+ const ref = MonacoEditor.getWidgetFor(this.editors, source);
141
+ if (!ref) {
142
+ return undefined;
143
+ }
144
+ const area = (ref && this.shell.getAreaFor(ref)) || 'main';
145
+ const mode = ref && sideBySide ? 'split-right' : undefined;
146
+ if (area === 'secondaryWindow') {
147
+ return { area: 'main', mode };
148
+ }
149
+ return { area, mode, ref };
150
+ }
151
+
152
+ }