@theia/monaco 1.34.1 → 1.34.3
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/LICENSE +641 -641
- package/README.md +100 -100
- package/data/monaco-nls.json +1379 -1379
- package/data/monaco-themes/vscode/dark_plus.json +201 -201
- package/data/monaco-themes/vscode/dark_theia.json +5 -5
- package/data/monaco-themes/vscode/dark_vs.json +392 -392
- package/data/monaco-themes/vscode/hc_black.json +457 -457
- package/data/monaco-themes/vscode/hc_light.json +590 -590
- package/data/monaco-themes/vscode/hc_theia.json +5 -5
- package/data/monaco-themes/vscode/hc_theia_light.json +5 -5
- package/data/monaco-themes/vscode/light_plus.json +202 -202
- package/data/monaco-themes/vscode/light_theia.json +10 -10
- package/data/monaco-themes/vscode/light_vs.json +421 -421
- package/lib/browser/index.d.ts +1 -1
- package/lib/browser/index.js +28 -28
- package/lib/browser/markdown-renderer/monaco-markdown-renderer.d.ts +24 -24
- package/lib/browser/markdown-renderer/monaco-markdown-renderer.js +137 -137
- package/lib/browser/monaco-bulk-edit-service.d.ts +14 -14
- package/lib/browser/monaco-bulk-edit-service.js +66 -66
- package/lib/browser/monaco-color-registry.d.ts +16 -16
- package/lib/browser/monaco-color-registry.js +82 -82
- package/lib/browser/monaco-command-registry.d.ts +19 -19
- package/lib/browser/monaco-command-registry.js +82 -82
- package/lib/browser/monaco-command-service.d.ts +26 -26
- package/lib/browser/monaco-command-service.js +92 -92
- package/lib/browser/monaco-command.d.ts +94 -94
- package/lib/browser/monaco-command.js +306 -306
- package/lib/browser/monaco-context-key-service.d.ts +22 -22
- package/lib/browser/monaco-context-key-service.js +147 -147
- package/lib/browser/monaco-context-menu.d.ts +16 -16
- package/lib/browser/monaco-context-menu.js +102 -102
- package/lib/browser/monaco-diagnostic-collection.d.ts +28 -28
- package/lib/browser/monaco-diagnostic-collection.js +86 -86
- package/lib/browser/monaco-diff-editor.d.ts +29 -29
- package/lib/browser/monaco-diff-editor.js +74 -74
- package/lib/browser/monaco-diff-navigator-factory.d.ts +7 -7
- package/lib/browser/monaco-diff-navigator-factory.js +66 -66
- package/lib/browser/monaco-editor-model.d.ts +156 -156
- package/lib/browser/monaco-editor-model.js +555 -555
- package/lib/browser/monaco-editor-provider.d.ts +89 -89
- package/lib/browser/monaco-editor-provider.js +440 -440
- package/lib/browser/monaco-editor-service.d.ts +27 -27
- package/lib/browser/monaco-editor-service.js +151 -151
- package/lib/browser/monaco-editor-zone-widget.d.ts +43 -43
- package/lib/browser/monaco-editor-zone-widget.js +194 -194
- package/lib/browser/monaco-editor.d.ts +151 -151
- package/lib/browser/monaco-editor.js +497 -497
- package/lib/browser/monaco-formatting-conflicts.d.ts +13 -13
- package/lib/browser/monaco-formatting-conflicts.js +110 -110
- package/lib/browser/monaco-frontend-application-contribution.d.ts +26 -26
- package/lib/browser/monaco-frontend-application-contribution.js +201 -201
- package/lib/browser/monaco-frontend-module.d.ts +7 -7
- package/lib/browser/monaco-frontend-module.js +266 -266
- package/lib/browser/monaco-gotoline-quick-access.d.ts +11 -11
- package/lib/browser/monaco-gotoline-quick-access.js +64 -64
- package/lib/browser/monaco-gotosymbol-quick-access.d.ts +16 -16
- package/lib/browser/monaco-gotosymbol-quick-access.js +70 -70
- package/lib/browser/monaco-indexed-db.d.ts +28 -28
- package/lib/browser/monaco-indexed-db.js +131 -131
- package/lib/browser/monaco-keybinding-contexts.d.ts +15 -15
- package/lib/browser/monaco-keybinding-contexts.js +50 -50
- package/lib/browser/monaco-keybinding.d.ts +16 -16
- package/lib/browser/monaco-keybinding.js +134 -134
- package/lib/browser/monaco-keycode-map.d.ts +2 -2
- package/lib/browser/monaco-keycode-map.js +163 -163
- package/lib/browser/monaco-languages.d.ts +27 -27
- package/lib/browser/monaco-languages.js +136 -136
- package/lib/browser/monaco-menu.d.ts +20 -20
- package/lib/browser/monaco-menu.js +145 -145
- package/lib/browser/monaco-mime-service.d.ts +10 -10
- package/lib/browser/monaco-mime-service.js +78 -78
- package/lib/browser/monaco-outline-contribution.d.ts +78 -78
- package/lib/browser/monaco-outline-contribution.js +384 -384
- package/lib/browser/monaco-outline-decorator.d.ts +12 -12
- package/lib/browser/monaco-outline-decorator.js +67 -67
- package/lib/browser/monaco-quick-access-registry.d.ts +11 -11
- package/lib/browser/monaco-quick-access-registry.js +99 -99
- package/lib/browser/monaco-quick-input-service.d.ts +99 -99
- package/lib/browser/monaco-quick-input-service.js +555 -555
- package/lib/browser/monaco-resolved-keybinding.d.ts +23 -23
- package/lib/browser/monaco-resolved-keybinding.js +131 -131
- package/lib/browser/monaco-snippet-suggest-provider.d.ts +64 -64
- package/lib/browser/monaco-snippet-suggest-provider.js +269 -269
- package/lib/browser/monaco-status-bar-contribution.d.ts +17 -17
- package/lib/browser/monaco-status-bar-contribution.js +120 -120
- package/lib/browser/monaco-text-model-service.d.ts +51 -51
- package/lib/browser/monaco-text-model-service.js +184 -184
- package/lib/browser/monaco-theming-service.d.ts +67 -67
- package/lib/browser/monaco-theming-service.js +171 -171
- package/lib/browser/monaco-to-protocol-converter.d.ts +26 -26
- package/lib/browser/monaco-to-protocol-converter.js +61 -61
- package/lib/browser/monaco-workspace.d.ts +83 -83
- package/lib/browser/monaco-workspace.js +369 -369
- package/lib/browser/protocol-to-monaco-converter.d.ts +31 -31
- package/lib/browser/protocol-to-monaco-converter.js +133 -133
- package/lib/browser/textmate/index.d.ts +4 -4
- package/lib/browser/textmate/index.js +31 -31
- package/lib/browser/textmate/monaco-textmate-frontend-bindings.d.ts +12 -12
- package/lib/browser/textmate/monaco-textmate-frontend-bindings.js +94 -94
- package/lib/browser/textmate/monaco-textmate-service.d.ts +30 -30
- package/lib/browser/textmate/monaco-textmate-service.js +185 -185
- package/lib/browser/textmate/monaco-theme-registry.d.ts +27 -27
- package/lib/browser/textmate/monaco-theme-registry.js +171 -171
- package/lib/browser/textmate/monaco-theme-types.d.ts +20 -20
- package/lib/browser/textmate/monaco-theme-types.js +21 -21
- package/lib/browser/textmate/textmate-contribution.d.ts +9 -9
- package/lib/browser/textmate/textmate-contribution.js +27 -27
- package/lib/browser/textmate/textmate-registry.d.ts +31 -31
- package/lib/browser/textmate/textmate-registry.js +109 -109
- package/lib/browser/textmate/textmate-snippet-completion-provider.d.ts +26 -26
- package/lib/browser/textmate/textmate-snippet-completion-provider.js +53 -53
- package/lib/browser/textmate/textmate-tokenizer.d.ts +22 -22
- package/lib/browser/textmate/textmate-tokenizer.js +65 -65
- package/lib/browser/workspace-symbol-command.d.ts +55 -55
- package/lib/browser/workspace-symbol-command.js +215 -215
- package/lib/package.spec.js +25 -25
- package/package.json +8 -8
- package/src/browser/index.ts +17 -17
- package/src/browser/markdown-renderer/monaco-markdown-renderer.ts +117 -117
- package/src/browser/monaco-bulk-edit-service.ts +64 -64
- package/src/browser/monaco-color-registry.ts +73 -73
- package/src/browser/monaco-command-registry.ts +82 -82
- package/src/browser/monaco-command-service.ts +99 -99
- package/src/browser/monaco-command.ts +311 -311
- package/src/browser/monaco-context-key-service.ts +143 -143
- package/src/browser/monaco-context-menu.ts +90 -90
- package/src/browser/monaco-diagnostic-collection.ts +101 -101
- package/src/browser/monaco-diff-editor.ts +101 -101
- package/src/browser/monaco-diff-navigator-factory.ts +61 -61
- package/src/browser/monaco-editor-model.ts +681 -681
- package/src/browser/monaco-editor-provider.ts +452 -452
- package/src/browser/monaco-editor-service.ts +144 -144
- package/src/browser/monaco-editor-zone-widget.ts +250 -250
- package/src/browser/monaco-editor.ts +644 -644
- package/src/browser/monaco-formatting-conflicts.ts +115 -115
- package/src/browser/monaco-frontend-application-contribution.ts +188 -188
- package/src/browser/monaco-frontend-module.ts +314 -314
- package/src/browser/monaco-gotoline-quick-access.ts +47 -47
- package/src/browser/monaco-gotosymbol-quick-access.ts +53 -53
- package/src/browser/monaco-indexed-db.ts +130 -130
- package/src/browser/monaco-keybinding-contexts.ts +43 -43
- package/src/browser/monaco-keybinding.ts +111 -111
- package/src/browser/monaco-keycode-map.ts +171 -171
- package/src/browser/monaco-languages.ts +129 -129
- package/src/browser/monaco-menu.ts +142 -142
- package/src/browser/monaco-mime-service.ts +71 -71
- package/src/browser/monaco-outline-contribution.ts +404 -404
- package/src/browser/monaco-outline-decorator.ts +66 -66
- package/src/browser/monaco-quick-access-registry.ts +112 -112
- package/src/browser/monaco-quick-input-service.ts +651 -651
- package/src/browser/monaco-resolved-keybinding.ts +162 -162
- package/src/browser/monaco-snippet-suggest-provider.ts +300 -300
- package/src/browser/monaco-status-bar-contribution.ts +109 -109
- package/src/browser/monaco-text-model-service.ts +194 -194
- package/src/browser/monaco-theming-service.ts +204 -204
- package/src/browser/monaco-to-protocol-converter.ts +71 -71
- package/src/browser/monaco-workspace.ts +393 -393
- package/src/browser/protocol-to-monaco-converter.ts +158 -158
- package/src/browser/style/index.css +267 -267
- package/src/browser/textmate/index.ts +20 -20
- package/src/browser/textmate/monaco-textmate-frontend-bindings.ts +94 -94
- package/src/browser/textmate/monaco-textmate-service.ts +187 -187
- package/src/browser/textmate/monaco-theme-registry.ts +176 -176
- package/src/browser/textmate/monaco-theme-types.ts +37 -37
- package/src/browser/textmate/textmate-contribution.ts +29 -29
- package/src/browser/textmate/textmate-registry.ts +129 -129
- package/src/browser/textmate/textmate-snippet-completion-provider.ts +73 -73
- package/src/browser/textmate/textmate-tokenizer.ts +84 -84
- package/src/browser/workspace-symbol-command.ts +196 -196
- package/src/package.spec.ts +28 -28
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { OpenerService, WidgetOpenMode, ApplicationShell, PreferenceService } from '@theia/core/lib/browser';
|
|
2
|
-
import { EditorWidget, EditorOpenerOptions, EditorManager } from '@theia/editor/lib/browser';
|
|
3
|
-
import { MonacoToProtocolConverter } from './monaco-to-protocol-converter';
|
|
4
|
-
import { IResourceEditorInput, ITextResourceEditorInput } from '@theia/monaco-editor-core/esm/vs/platform/editor/common/editor';
|
|
5
|
-
import { StandaloneCodeEditorService } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditorService';
|
|
6
|
-
import { StandaloneCodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditor';
|
|
7
|
-
import { ICodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser';
|
|
8
|
-
import { ContextKeyService as VSCodeContextKeyService } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/browser/contextKeyService';
|
|
9
|
-
export declare class MonacoEditorService extends StandaloneCodeEditorService {
|
|
10
|
-
static readonly ENABLE_PREVIEW_PREFERENCE: string;
|
|
11
|
-
protected readonly openerService: OpenerService;
|
|
12
|
-
protected readonly m2p: MonacoToProtocolConverter;
|
|
13
|
-
protected readonly shell: ApplicationShell;
|
|
14
|
-
protected readonly editors: EditorManager;
|
|
15
|
-
protected readonly preferencesService: PreferenceService;
|
|
16
|
-
constructor(contextKeyService: VSCodeContextKeyService);
|
|
17
|
-
/**
|
|
18
|
-
* Monaco active editor is either focused or last focused editor.
|
|
19
|
-
*/
|
|
20
|
-
getActiveCodeEditor(): StandaloneCodeEditor | null;
|
|
21
|
-
openCodeEditor(input: IResourceEditorInput, source: ICodeEditor | null, sideBySide?: boolean): Promise<ICodeEditor | null>;
|
|
22
|
-
protected findEditorWidgetByUri(widget: object | undefined, uriAsString: string): Promise<EditorWidget | undefined>;
|
|
23
|
-
protected createEditorOpenerOptions(input: IResourceEditorInput | ITextResourceEditorInput, source: ICodeEditor | null, sideBySide?: boolean): EditorOpenerOptions;
|
|
24
|
-
protected getSelection(input: IResourceEditorInput | ITextResourceEditorInput): EditorOpenerOptions['selection'];
|
|
25
|
-
protected getEditorOpenMode(input: IResourceEditorInput): WidgetOpenMode;
|
|
26
|
-
protected getWidgetOptions(source: ICodeEditor | null, sideBySide?: boolean): ApplicationShell.WidgetOptions | undefined;
|
|
27
|
-
}
|
|
1
|
+
import { OpenerService, WidgetOpenMode, ApplicationShell, PreferenceService } from '@theia/core/lib/browser';
|
|
2
|
+
import { EditorWidget, EditorOpenerOptions, EditorManager } from '@theia/editor/lib/browser';
|
|
3
|
+
import { MonacoToProtocolConverter } from './monaco-to-protocol-converter';
|
|
4
|
+
import { IResourceEditorInput, ITextResourceEditorInput } from '@theia/monaco-editor-core/esm/vs/platform/editor/common/editor';
|
|
5
|
+
import { StandaloneCodeEditorService } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditorService';
|
|
6
|
+
import { StandaloneCodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditor';
|
|
7
|
+
import { ICodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser';
|
|
8
|
+
import { ContextKeyService as VSCodeContextKeyService } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/browser/contextKeyService';
|
|
9
|
+
export declare class MonacoEditorService extends StandaloneCodeEditorService {
|
|
10
|
+
static readonly ENABLE_PREVIEW_PREFERENCE: string;
|
|
11
|
+
protected readonly openerService: OpenerService;
|
|
12
|
+
protected readonly m2p: MonacoToProtocolConverter;
|
|
13
|
+
protected readonly shell: ApplicationShell;
|
|
14
|
+
protected readonly editors: EditorManager;
|
|
15
|
+
protected readonly preferencesService: PreferenceService;
|
|
16
|
+
constructor(contextKeyService: VSCodeContextKeyService);
|
|
17
|
+
/**
|
|
18
|
+
* Monaco active editor is either focused or last focused editor.
|
|
19
|
+
*/
|
|
20
|
+
getActiveCodeEditor(): StandaloneCodeEditor | null;
|
|
21
|
+
openCodeEditor(input: IResourceEditorInput, source: ICodeEditor | null, sideBySide?: boolean): Promise<ICodeEditor | null>;
|
|
22
|
+
protected findEditorWidgetByUri(widget: object | undefined, uriAsString: string): Promise<EditorWidget | undefined>;
|
|
23
|
+
protected createEditorOpenerOptions(input: IResourceEditorInput | ITextResourceEditorInput, source: ICodeEditor | null, sideBySide?: boolean): EditorOpenerOptions;
|
|
24
|
+
protected getSelection(input: IResourceEditorInput | ITextResourceEditorInput): EditorOpenerOptions['selection'];
|
|
25
|
+
protected getEditorOpenMode(input: IResourceEditorInput): WidgetOpenMode;
|
|
26
|
+
protected getWidgetOptions(source: ICodeEditor | null, sideBySide?: boolean): ApplicationShell.WidgetOptions | undefined;
|
|
27
|
+
}
|
|
28
28
|
//# sourceMappingURL=monaco-editor-service.d.ts.map
|
|
@@ -1,152 +1,152 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2017 TypeFox and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
-
};
|
|
26
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
27
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
28
|
-
};
|
|
29
|
-
var MonacoEditorService_1;
|
|
30
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.MonacoEditorService = void 0;
|
|
32
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
33
|
-
const uri_1 = require("@theia/core/lib/common/uri");
|
|
34
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
35
|
-
const browser_2 = require("@theia/editor/lib/browser");
|
|
36
|
-
const monaco_editor_1 = require("./monaco-editor");
|
|
37
|
-
const monaco_to_protocol_converter_1 = require("./monaco-to-protocol-converter");
|
|
38
|
-
const monaco_editor_model_1 = require("./monaco-editor-model");
|
|
39
|
-
const standaloneServices_1 = require("@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices");
|
|
40
|
-
const standaloneTheme_1 = require("@theia/monaco-editor-core/esm/vs/editor/standalone/common/standaloneTheme");
|
|
41
|
-
const standaloneCodeEditorService_1 = require("@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditorService");
|
|
42
|
-
const standaloneCodeEditor_1 = require("@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditor");
|
|
43
|
-
const contextKeyService_1 = require("@theia/monaco-editor-core/esm/vs/platform/contextkey/browser/contextKeyService");
|
|
44
|
-
(0, inversify_1.decorate)((0, inversify_1.injectable)(), standaloneCodeEditorService_1.StandaloneCodeEditorService);
|
|
45
|
-
let MonacoEditorService = MonacoEditorService_1 = class MonacoEditorService extends standaloneCodeEditorService_1.StandaloneCodeEditorService {
|
|
46
|
-
constructor(contextKeyService) {
|
|
47
|
-
super(contextKeyService, standaloneServices_1.StandaloneServices.get(standaloneTheme_1.IStandaloneThemeService));
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Monaco active editor is either focused or last focused editor.
|
|
51
|
-
*/
|
|
52
|
-
getActiveCodeEditor() {
|
|
53
|
-
let editor = monaco_editor_1.MonacoEditor.getCurrent(this.editors);
|
|
54
|
-
if (!editor && browser_2.CustomEditorWidget.is(this.shell.activeWidget)) {
|
|
55
|
-
const model = this.shell.activeWidget.modelRef.object;
|
|
56
|
-
if (model.editorTextModel instanceof monaco_editor_model_1.MonacoEditorModel) {
|
|
57
|
-
editor = monaco_editor_1.MonacoEditor.findByDocument(this.editors, model.editorTextModel)[0];
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
const candidate = editor === null || editor === void 0 ? void 0 : editor.getControl();
|
|
61
|
-
// 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.
|
|
62
|
-
/* eslint-disable-next-line no-null/no-null */
|
|
63
|
-
return candidate instanceof standaloneCodeEditor_1.StandaloneCodeEditor ? candidate : null;
|
|
64
|
-
}
|
|
65
|
-
async openCodeEditor(input, source, sideBySide) {
|
|
66
|
-
const uri = new uri_1.default(input.resource.toString());
|
|
67
|
-
const openerOptions = this.createEditorOpenerOptions(input, source, sideBySide);
|
|
68
|
-
const widget = await (0, browser_1.open)(this.openerService, uri, openerOptions);
|
|
69
|
-
const editorWidget = await this.findEditorWidgetByUri(widget, uri.toString());
|
|
70
|
-
if (editorWidget && editorWidget.editor instanceof monaco_editor_1.MonacoEditor) {
|
|
71
|
-
const candidate = editorWidget.editor.getControl();
|
|
72
|
-
// 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.
|
|
73
|
-
// eslint-disable-next-line no-null/no-null
|
|
74
|
-
return candidate instanceof standaloneCodeEditor_1.StandaloneCodeEditor ? candidate : null;
|
|
75
|
-
}
|
|
76
|
-
// eslint-disable-next-line no-null/no-null
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
async findEditorWidgetByUri(widget, uriAsString) {
|
|
80
|
-
if (widget instanceof browser_2.EditorWidget) {
|
|
81
|
-
if (widget.editor.uri.toString() === uriAsString) {
|
|
82
|
-
return widget;
|
|
83
|
-
}
|
|
84
|
-
return undefined;
|
|
85
|
-
}
|
|
86
|
-
if (browser_1.ApplicationShell.TrackableWidgetProvider.is(widget)) {
|
|
87
|
-
for (const childWidget of widget.getTrackableWidgets()) {
|
|
88
|
-
const editorWidget = await this.findEditorWidgetByUri(childWidget, uriAsString);
|
|
89
|
-
if (editorWidget) {
|
|
90
|
-
return editorWidget;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return undefined;
|
|
95
|
-
}
|
|
96
|
-
createEditorOpenerOptions(input, source, sideBySide) {
|
|
97
|
-
const mode = this.getEditorOpenMode(input);
|
|
98
|
-
const widgetOptions = this.getWidgetOptions(source, sideBySide);
|
|
99
|
-
const selection = this.getSelection(input);
|
|
100
|
-
const preview = !!this.preferencesService.get(MonacoEditorService_1.ENABLE_PREVIEW_PREFERENCE, false);
|
|
101
|
-
return { mode, widgetOptions, preview, selection };
|
|
102
|
-
}
|
|
103
|
-
getSelection(input) {
|
|
104
|
-
if ('options' in input && input.options && 'selection' in input.options) {
|
|
105
|
-
return this.m2p.asRange(input.options.selection);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
getEditorOpenMode(input) {
|
|
109
|
-
const options = Object.assign({ preserveFocus: false, revealIfVisible: true }, input.options);
|
|
110
|
-
if (options.preserveFocus) {
|
|
111
|
-
return 'reveal';
|
|
112
|
-
}
|
|
113
|
-
return options.revealIfVisible ? 'activate' : 'open';
|
|
114
|
-
}
|
|
115
|
-
getWidgetOptions(source, sideBySide) {
|
|
116
|
-
const ref = monaco_editor_1.MonacoEditor.getWidgetFor(this.editors, source);
|
|
117
|
-
if (!ref) {
|
|
118
|
-
return undefined;
|
|
119
|
-
}
|
|
120
|
-
const area = (ref && this.shell.getAreaFor(ref)) || 'main';
|
|
121
|
-
const mode = ref && sideBySide ? 'split-right' : undefined;
|
|
122
|
-
return { area, mode, ref };
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
MonacoEditorService.ENABLE_PREVIEW_PREFERENCE = 'editor.enablePreview';
|
|
126
|
-
__decorate([
|
|
127
|
-
(0, inversify_1.inject)(browser_1.OpenerService),
|
|
128
|
-
__metadata("design:type", Object)
|
|
129
|
-
], MonacoEditorService.prototype, "openerService", void 0);
|
|
130
|
-
__decorate([
|
|
131
|
-
(0, inversify_1.inject)(monaco_to_protocol_converter_1.MonacoToProtocolConverter),
|
|
132
|
-
__metadata("design:type", monaco_to_protocol_converter_1.MonacoToProtocolConverter)
|
|
133
|
-
], MonacoEditorService.prototype, "m2p", void 0);
|
|
134
|
-
__decorate([
|
|
135
|
-
(0, inversify_1.inject)(browser_1.ApplicationShell),
|
|
136
|
-
__metadata("design:type", browser_1.ApplicationShell)
|
|
137
|
-
], MonacoEditorService.prototype, "shell", void 0);
|
|
138
|
-
__decorate([
|
|
139
|
-
(0, inversify_1.inject)(browser_2.EditorManager),
|
|
140
|
-
__metadata("design:type", browser_2.EditorManager)
|
|
141
|
-
], MonacoEditorService.prototype, "editors", void 0);
|
|
142
|
-
__decorate([
|
|
143
|
-
(0, inversify_1.inject)(browser_1.PreferenceService),
|
|
144
|
-
__metadata("design:type", Object)
|
|
145
|
-
], MonacoEditorService.prototype, "preferencesService", void 0);
|
|
146
|
-
MonacoEditorService = MonacoEditorService_1 = __decorate([
|
|
147
|
-
(0, inversify_1.injectable)(),
|
|
148
|
-
__param(0, (0, inversify_1.inject)(contextKeyService_1.ContextKeyService)),
|
|
149
|
-
__metadata("design:paramtypes", [contextKeyService_1.ContextKeyService])
|
|
150
|
-
], MonacoEditorService);
|
|
151
|
-
exports.MonacoEditorService = MonacoEditorService;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2017 TypeFox and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
27
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
28
|
+
};
|
|
29
|
+
var MonacoEditorService_1;
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.MonacoEditorService = void 0;
|
|
32
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
33
|
+
const uri_1 = require("@theia/core/lib/common/uri");
|
|
34
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
35
|
+
const browser_2 = require("@theia/editor/lib/browser");
|
|
36
|
+
const monaco_editor_1 = require("./monaco-editor");
|
|
37
|
+
const monaco_to_protocol_converter_1 = require("./monaco-to-protocol-converter");
|
|
38
|
+
const monaco_editor_model_1 = require("./monaco-editor-model");
|
|
39
|
+
const standaloneServices_1 = require("@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices");
|
|
40
|
+
const standaloneTheme_1 = require("@theia/monaco-editor-core/esm/vs/editor/standalone/common/standaloneTheme");
|
|
41
|
+
const standaloneCodeEditorService_1 = require("@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditorService");
|
|
42
|
+
const standaloneCodeEditor_1 = require("@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditor");
|
|
43
|
+
const contextKeyService_1 = require("@theia/monaco-editor-core/esm/vs/platform/contextkey/browser/contextKeyService");
|
|
44
|
+
(0, inversify_1.decorate)((0, inversify_1.injectable)(), standaloneCodeEditorService_1.StandaloneCodeEditorService);
|
|
45
|
+
let MonacoEditorService = MonacoEditorService_1 = class MonacoEditorService extends standaloneCodeEditorService_1.StandaloneCodeEditorService {
|
|
46
|
+
constructor(contextKeyService) {
|
|
47
|
+
super(contextKeyService, standaloneServices_1.StandaloneServices.get(standaloneTheme_1.IStandaloneThemeService));
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Monaco active editor is either focused or last focused editor.
|
|
51
|
+
*/
|
|
52
|
+
getActiveCodeEditor() {
|
|
53
|
+
let editor = monaco_editor_1.MonacoEditor.getCurrent(this.editors);
|
|
54
|
+
if (!editor && browser_2.CustomEditorWidget.is(this.shell.activeWidget)) {
|
|
55
|
+
const model = this.shell.activeWidget.modelRef.object;
|
|
56
|
+
if (model.editorTextModel instanceof monaco_editor_model_1.MonacoEditorModel) {
|
|
57
|
+
editor = monaco_editor_1.MonacoEditor.findByDocument(this.editors, model.editorTextModel)[0];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const candidate = editor === null || editor === void 0 ? void 0 : editor.getControl();
|
|
61
|
+
// 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.
|
|
62
|
+
/* eslint-disable-next-line no-null/no-null */
|
|
63
|
+
return candidate instanceof standaloneCodeEditor_1.StandaloneCodeEditor ? candidate : null;
|
|
64
|
+
}
|
|
65
|
+
async openCodeEditor(input, source, sideBySide) {
|
|
66
|
+
const uri = new uri_1.default(input.resource.toString());
|
|
67
|
+
const openerOptions = this.createEditorOpenerOptions(input, source, sideBySide);
|
|
68
|
+
const widget = await (0, browser_1.open)(this.openerService, uri, openerOptions);
|
|
69
|
+
const editorWidget = await this.findEditorWidgetByUri(widget, uri.toString());
|
|
70
|
+
if (editorWidget && editorWidget.editor instanceof monaco_editor_1.MonacoEditor) {
|
|
71
|
+
const candidate = editorWidget.editor.getControl();
|
|
72
|
+
// 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.
|
|
73
|
+
// eslint-disable-next-line no-null/no-null
|
|
74
|
+
return candidate instanceof standaloneCodeEditor_1.StandaloneCodeEditor ? candidate : null;
|
|
75
|
+
}
|
|
76
|
+
// eslint-disable-next-line no-null/no-null
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
async findEditorWidgetByUri(widget, uriAsString) {
|
|
80
|
+
if (widget instanceof browser_2.EditorWidget) {
|
|
81
|
+
if (widget.editor.uri.toString() === uriAsString) {
|
|
82
|
+
return widget;
|
|
83
|
+
}
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
if (browser_1.ApplicationShell.TrackableWidgetProvider.is(widget)) {
|
|
87
|
+
for (const childWidget of widget.getTrackableWidgets()) {
|
|
88
|
+
const editorWidget = await this.findEditorWidgetByUri(childWidget, uriAsString);
|
|
89
|
+
if (editorWidget) {
|
|
90
|
+
return editorWidget;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
createEditorOpenerOptions(input, source, sideBySide) {
|
|
97
|
+
const mode = this.getEditorOpenMode(input);
|
|
98
|
+
const widgetOptions = this.getWidgetOptions(source, sideBySide);
|
|
99
|
+
const selection = this.getSelection(input);
|
|
100
|
+
const preview = !!this.preferencesService.get(MonacoEditorService_1.ENABLE_PREVIEW_PREFERENCE, false);
|
|
101
|
+
return { mode, widgetOptions, preview, selection };
|
|
102
|
+
}
|
|
103
|
+
getSelection(input) {
|
|
104
|
+
if ('options' in input && input.options && 'selection' in input.options) {
|
|
105
|
+
return this.m2p.asRange(input.options.selection);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
getEditorOpenMode(input) {
|
|
109
|
+
const options = Object.assign({ preserveFocus: false, revealIfVisible: true }, input.options);
|
|
110
|
+
if (options.preserveFocus) {
|
|
111
|
+
return 'reveal';
|
|
112
|
+
}
|
|
113
|
+
return options.revealIfVisible ? 'activate' : 'open';
|
|
114
|
+
}
|
|
115
|
+
getWidgetOptions(source, sideBySide) {
|
|
116
|
+
const ref = monaco_editor_1.MonacoEditor.getWidgetFor(this.editors, source);
|
|
117
|
+
if (!ref) {
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
const area = (ref && this.shell.getAreaFor(ref)) || 'main';
|
|
121
|
+
const mode = ref && sideBySide ? 'split-right' : undefined;
|
|
122
|
+
return { area, mode, ref };
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
MonacoEditorService.ENABLE_PREVIEW_PREFERENCE = 'editor.enablePreview';
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, inversify_1.inject)(browser_1.OpenerService),
|
|
128
|
+
__metadata("design:type", Object)
|
|
129
|
+
], MonacoEditorService.prototype, "openerService", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
(0, inversify_1.inject)(monaco_to_protocol_converter_1.MonacoToProtocolConverter),
|
|
132
|
+
__metadata("design:type", monaco_to_protocol_converter_1.MonacoToProtocolConverter)
|
|
133
|
+
], MonacoEditorService.prototype, "m2p", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
(0, inversify_1.inject)(browser_1.ApplicationShell),
|
|
136
|
+
__metadata("design:type", browser_1.ApplicationShell)
|
|
137
|
+
], MonacoEditorService.prototype, "shell", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
(0, inversify_1.inject)(browser_2.EditorManager),
|
|
140
|
+
__metadata("design:type", browser_2.EditorManager)
|
|
141
|
+
], MonacoEditorService.prototype, "editors", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
(0, inversify_1.inject)(browser_1.PreferenceService),
|
|
144
|
+
__metadata("design:type", Object)
|
|
145
|
+
], MonacoEditorService.prototype, "preferencesService", void 0);
|
|
146
|
+
MonacoEditorService = MonacoEditorService_1 = __decorate([
|
|
147
|
+
(0, inversify_1.injectable)(),
|
|
148
|
+
__param(0, (0, inversify_1.inject)(contextKeyService_1.ContextKeyService)),
|
|
149
|
+
__metadata("design:paramtypes", [contextKeyService_1.ContextKeyService])
|
|
150
|
+
], MonacoEditorService);
|
|
151
|
+
exports.MonacoEditorService = MonacoEditorService;
|
|
152
152
|
//# sourceMappingURL=monaco-editor-service.js.map
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { Disposable, DisposableCollection, Event, Emitter } from '@theia/core';
|
|
2
|
-
import * as monaco from '@theia/monaco-editor-core';
|
|
3
|
-
export interface MonacoEditorViewZone extends monaco.editor.IViewZone {
|
|
4
|
-
id: string;
|
|
5
|
-
}
|
|
6
|
-
export declare class MonacoEditorZoneWidget implements Disposable {
|
|
7
|
-
readonly showArrow: boolean;
|
|
8
|
-
private arrow;
|
|
9
|
-
readonly zoneNode: HTMLDivElement;
|
|
10
|
-
readonly containerNode: HTMLDivElement;
|
|
11
|
-
protected readonly onDidLayoutChangeEmitter: Emitter<monaco.editor.IDimension>;
|
|
12
|
-
readonly onDidLayoutChange: Event<monaco.editor.IDimension>;
|
|
13
|
-
protected viewZone: MonacoEditorViewZone | undefined;
|
|
14
|
-
protected readonly toHide: DisposableCollection;
|
|
15
|
-
protected readonly toDispose: DisposableCollection;
|
|
16
|
-
editor: monaco.editor.IStandaloneCodeEditor;
|
|
17
|
-
constructor(editorInstance: monaco.editor.IStandaloneCodeEditor, showArrow?: boolean);
|
|
18
|
-
dispose(): void;
|
|
19
|
-
protected _options: MonacoEditorZoneWidget.Options | undefined;
|
|
20
|
-
get options(): MonacoEditorZoneWidget.Options | undefined;
|
|
21
|
-
hide(): void;
|
|
22
|
-
show(options: MonacoEditorZoneWidget.Options): void;
|
|
23
|
-
layout(heightInLines: number): void;
|
|
24
|
-
protected updateTop(top: number): void;
|
|
25
|
-
protected updateHeight(zoneHeight: number): void;
|
|
26
|
-
protected updateContainerHeight(zoneHeight: number): void;
|
|
27
|
-
protected computeContainerHeight(zoneHeight: number): {
|
|
28
|
-
height: number;
|
|
29
|
-
frameWidth: number;
|
|
30
|
-
};
|
|
31
|
-
protected updateWidth(info?: monaco.editor.EditorLayoutInfo): void;
|
|
32
|
-
protected computeWidth(info?: monaco.editor.EditorLayoutInfo): number;
|
|
33
|
-
protected computeLeft(info?: monaco.editor.EditorLayoutInfo): number;
|
|
34
|
-
}
|
|
35
|
-
export declare namespace MonacoEditorZoneWidget {
|
|
36
|
-
interface Options {
|
|
37
|
-
afterLineNumber: number;
|
|
38
|
-
afterColumn?: number;
|
|
39
|
-
heightInLines: number;
|
|
40
|
-
showFrame?: boolean;
|
|
41
|
-
frameWidth?: number;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
1
|
+
import { Disposable, DisposableCollection, Event, Emitter } from '@theia/core';
|
|
2
|
+
import * as monaco from '@theia/monaco-editor-core';
|
|
3
|
+
export interface MonacoEditorViewZone extends monaco.editor.IViewZone {
|
|
4
|
+
id: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class MonacoEditorZoneWidget implements Disposable {
|
|
7
|
+
readonly showArrow: boolean;
|
|
8
|
+
private arrow;
|
|
9
|
+
readonly zoneNode: HTMLDivElement;
|
|
10
|
+
readonly containerNode: HTMLDivElement;
|
|
11
|
+
protected readonly onDidLayoutChangeEmitter: Emitter<monaco.editor.IDimension>;
|
|
12
|
+
readonly onDidLayoutChange: Event<monaco.editor.IDimension>;
|
|
13
|
+
protected viewZone: MonacoEditorViewZone | undefined;
|
|
14
|
+
protected readonly toHide: DisposableCollection;
|
|
15
|
+
protected readonly toDispose: DisposableCollection;
|
|
16
|
+
editor: monaco.editor.IStandaloneCodeEditor;
|
|
17
|
+
constructor(editorInstance: monaco.editor.IStandaloneCodeEditor, showArrow?: boolean);
|
|
18
|
+
dispose(): void;
|
|
19
|
+
protected _options: MonacoEditorZoneWidget.Options | undefined;
|
|
20
|
+
get options(): MonacoEditorZoneWidget.Options | undefined;
|
|
21
|
+
hide(): void;
|
|
22
|
+
show(options: MonacoEditorZoneWidget.Options): void;
|
|
23
|
+
layout(heightInLines: number): void;
|
|
24
|
+
protected updateTop(top: number): void;
|
|
25
|
+
protected updateHeight(zoneHeight: number): void;
|
|
26
|
+
protected updateContainerHeight(zoneHeight: number): void;
|
|
27
|
+
protected computeContainerHeight(zoneHeight: number): {
|
|
28
|
+
height: number;
|
|
29
|
+
frameWidth: number;
|
|
30
|
+
};
|
|
31
|
+
protected updateWidth(info?: monaco.editor.EditorLayoutInfo): void;
|
|
32
|
+
protected computeWidth(info?: monaco.editor.EditorLayoutInfo): number;
|
|
33
|
+
protected computeLeft(info?: monaco.editor.EditorLayoutInfo): number;
|
|
34
|
+
}
|
|
35
|
+
export declare namespace MonacoEditorZoneWidget {
|
|
36
|
+
interface Options {
|
|
37
|
+
afterLineNumber: number;
|
|
38
|
+
afterColumn?: number;
|
|
39
|
+
heightInLines: number;
|
|
40
|
+
showFrame?: boolean;
|
|
41
|
+
frameWidth?: number;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
44
|
//# sourceMappingURL=monaco-editor-zone-widget.d.ts.map
|