@theia/monaco 1.67.0-next.3 → 1.67.0-next.56
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/README.md +1 -1
- package/package.json +8 -8
- package/lib/browser/content-hover-widget-patcher.d.ts +0 -9
- package/lib/browser/content-hover-widget-patcher.d.ts.map +0 -1
- package/lib/browser/content-hover-widget-patcher.js +0 -63
- package/lib/browser/content-hover-widget-patcher.js.map +0 -1
- package/lib/browser/default-content-hover-widget-patcher.d.ts +0 -9
- package/lib/browser/default-content-hover-widget-patcher.d.ts.map +0 -1
- package/lib/browser/default-content-hover-widget-patcher.js +0 -49
- package/lib/browser/default-content-hover-widget-patcher.js.map +0 -1
- package/lib/browser/index.d.ts +0 -3
- package/lib/browser/index.d.ts.map +0 -1
- package/lib/browser/index.js +0 -21
- package/lib/browser/index.js.map +0 -1
- package/lib/browser/markdown-renderer/monaco-markdown-renderer.d.ts +0 -21
- package/lib/browser/markdown-renderer/monaco-markdown-renderer.d.ts.map +0 -1
- package/lib/browser/markdown-renderer/monaco-markdown-renderer.js +0 -115
- package/lib/browser/markdown-renderer/monaco-markdown-renderer.js.map +0 -1
- package/lib/browser/monaco-bulk-edit-service.d.ts +0 -13
- package/lib/browser/monaco-bulk-edit-service.d.ts.map +0 -1
- package/lib/browser/monaco-bulk-edit-service.js +0 -59
- package/lib/browser/monaco-bulk-edit-service.js.map +0 -1
- package/lib/browser/monaco-code-action-save-participant.d.ts +0 -11
- package/lib/browser/monaco-code-action-save-participant.d.ts.map +0 -1
- package/lib/browser/monaco-code-action-save-participant.js +0 -48
- package/lib/browser/monaco-code-action-save-participant.js.map +0 -1
- package/lib/browser/monaco-code-action-service.d.ts +0 -41
- package/lib/browser/monaco-code-action-service.d.ts.map +0 -1
- package/lib/browser/monaco-code-action-service.js +0 -132
- package/lib/browser/monaco-code-action-service.js.map +0 -1
- package/lib/browser/monaco-color-registry.d.ts +0 -17
- package/lib/browser/monaco-color-registry.d.ts.map +0 -1
- package/lib/browser/monaco-color-registry.js +0 -78
- package/lib/browser/monaco-color-registry.js.map +0 -1
- package/lib/browser/monaco-command-registry.d.ts +0 -20
- package/lib/browser/monaco-command-registry.d.ts.map +0 -1
- package/lib/browser/monaco-command-registry.js +0 -81
- package/lib/browser/monaco-command-registry.js.map +0 -1
- package/lib/browser/monaco-command-service.d.ts +0 -22
- package/lib/browser/monaco-command-service.d.ts.map +0 -1
- package/lib/browser/monaco-command-service.js +0 -83
- package/lib/browser/monaco-command-service.js.map +0 -1
- package/lib/browser/monaco-command.d.ts +0 -89
- package/lib/browser/monaco-command.d.ts.map +0 -1
- package/lib/browser/monaco-command.js +0 -303
- package/lib/browser/monaco-command.js.map +0 -1
- package/lib/browser/monaco-context-key-service.d.ts +0 -24
- package/lib/browser/monaco-context-key-service.d.ts.map +0 -1
- package/lib/browser/monaco-context-key-service.js +0 -151
- package/lib/browser/monaco-context-key-service.js.map +0 -1
- package/lib/browser/monaco-context-menu.d.ts +0 -22
- package/lib/browser/monaco-context-menu.d.ts.map +0 -1
- package/lib/browser/monaco-context-menu.js +0 -140
- package/lib/browser/monaco-context-menu.js.map +0 -1
- package/lib/browser/monaco-diff-computer.d.ts +0 -6
- package/lib/browser/monaco-diff-computer.d.ts.map +0 -1
- package/lib/browser/monaco-diff-computer.js +0 -57
- package/lib/browser/monaco-diff-computer.js.map +0 -1
- package/lib/browser/monaco-diff-editor.d.ts +0 -42
- package/lib/browser/monaco-diff-editor.d.ts.map +0 -1
- package/lib/browser/monaco-diff-editor.js +0 -142
- package/lib/browser/monaco-diff-editor.js.map +0 -1
- package/lib/browser/monaco-diff-navigator-factory.d.ts +0 -7
- package/lib/browser/monaco-diff-navigator-factory.d.ts.map +0 -1
- package/lib/browser/monaco-diff-navigator-factory.js +0 -41
- package/lib/browser/monaco-diff-navigator-factory.js.map +0 -1
- package/lib/browser/monaco-editor-content-menu.d.ts +0 -20
- package/lib/browser/monaco-editor-content-menu.d.ts.map +0 -1
- package/lib/browser/monaco-editor-content-menu.js +0 -118
- package/lib/browser/monaco-editor-content-menu.js.map +0 -1
- package/lib/browser/monaco-editor-model.d.ts +0 -172
- package/lib/browser/monaco-editor-model.d.ts.map +0 -1
- package/lib/browser/monaco-editor-model.js +0 -536
- package/lib/browser/monaco-editor-model.js.map +0 -1
- package/lib/browser/monaco-editor-overlay-button.d.ts +0 -14
- package/lib/browser/monaco-editor-overlay-button.d.ts.map +0 -1
- package/lib/browser/monaco-editor-overlay-button.js +0 -58
- package/lib/browser/monaco-editor-overlay-button.js.map +0 -1
- package/lib/browser/monaco-editor-peek-view-widget.d.ts +0 -74
- package/lib/browser/monaco-editor-peek-view-widget.d.ts.map +0 -1
- package/lib/browser/monaco-editor-peek-view-widget.js +0 -194
- package/lib/browser/monaco-editor-peek-view-widget.js.map +0 -1
- package/lib/browser/monaco-editor-provider.d.ts +0 -100
- package/lib/browser/monaco-editor-provider.d.ts.map +0 -1
- package/lib/browser/monaco-editor-provider.js +0 -493
- package/lib/browser/monaco-editor-provider.js.map +0 -1
- package/lib/browser/monaco-editor-service.d.ts +0 -41
- package/lib/browser/monaco-editor-service.d.ts.map +0 -1
- package/lib/browser/monaco-editor-service.js +0 -167
- package/lib/browser/monaco-editor-service.js.map +0 -1
- package/lib/browser/monaco-editor-zone-widget.d.ts +0 -44
- package/lib/browser/monaco-editor-zone-widget.d.ts.map +0 -1
- package/lib/browser/monaco-editor-zone-widget.js +0 -195
- package/lib/browser/monaco-editor-zone-widget.js.map +0 -1
- package/lib/browser/monaco-editor.d.ts +0 -169
- package/lib/browser/monaco-editor.d.ts.map +0 -1
- package/lib/browser/monaco-editor.js +0 -638
- package/lib/browser/monaco-editor.js.map +0 -1
- package/lib/browser/monaco-formatting-conflicts.d.ts +0 -15
- package/lib/browser/monaco-formatting-conflicts.d.ts.map +0 -1
- package/lib/browser/monaco-formatting-conflicts.js +0 -104
- package/lib/browser/monaco-formatting-conflicts.js.map +0 -1
- package/lib/browser/monaco-frontend-application-contribution.d.ts +0 -32
- package/lib/browser/monaco-frontend-application-contribution.d.ts.map +0 -1
- package/lib/browser/monaco-frontend-application-contribution.js +0 -208
- package/lib/browser/monaco-frontend-application-contribution.js.map +0 -1
- package/lib/browser/monaco-frontend-module.d.ts +0 -8
- package/lib/browser/monaco-frontend-module.d.ts.map +0 -1
- package/lib/browser/monaco-frontend-module.js +0 -299
- package/lib/browser/monaco-frontend-module.js.map +0 -1
- package/lib/browser/monaco-gotoline-quick-access.d.ts +0 -12
- package/lib/browser/monaco-gotoline-quick-access.d.ts.map +0 -1
- package/lib/browser/monaco-gotoline-quick-access.js +0 -54
- package/lib/browser/monaco-gotoline-quick-access.js.map +0 -1
- package/lib/browser/monaco-gotosymbol-quick-access.d.ts +0 -17
- package/lib/browser/monaco-gotosymbol-quick-access.d.ts.map +0 -1
- package/lib/browser/monaco-gotosymbol-quick-access.js +0 -60
- package/lib/browser/monaco-gotosymbol-quick-access.js.map +0 -1
- package/lib/browser/monaco-icon-registry.d.ts +0 -11
- package/lib/browser/monaco-icon-registry.d.ts.map +0 -1
- package/lib/browser/monaco-icon-registry.js +0 -48
- package/lib/browser/monaco-icon-registry.js.map +0 -1
- package/lib/browser/monaco-indexed-db.d.ts +0 -29
- package/lib/browser/monaco-indexed-db.d.ts.map +0 -1
- package/lib/browser/monaco-indexed-db.js +0 -127
- package/lib/browser/monaco-indexed-db.js.map +0 -1
- package/lib/browser/monaco-init.d.ts +0 -6
- package/lib/browser/monaco-init.d.ts.map +0 -1
- package/lib/browser/monaco-init.js +0 -165
- package/lib/browser/monaco-init.js.map +0 -1
- package/lib/browser/monaco-keybinding.d.ts +0 -17
- package/lib/browser/monaco-keybinding.d.ts.map +0 -1
- package/lib/browser/monaco-keybinding.js +0 -127
- package/lib/browser/monaco-keybinding.js.map +0 -1
- package/lib/browser/monaco-keycode-map.d.ts +0 -3
- package/lib/browser/monaco-keycode-map.d.ts.map +0 -1
- package/lib/browser/monaco-keycode-map.js +0 -164
- package/lib/browser/monaco-keycode-map.js.map +0 -1
- package/lib/browser/monaco-languages.d.ts +0 -36
- package/lib/browser/monaco-languages.d.ts.map +0 -1
- package/lib/browser/monaco-languages.js +0 -173
- package/lib/browser/monaco-languages.js.map +0 -1
- package/lib/browser/monaco-marker-collection.d.ts +0 -19
- package/lib/browser/monaco-marker-collection.d.ts.map +0 -1
- package/lib/browser/monaco-marker-collection.js +0 -71
- package/lib/browser/monaco-marker-collection.js.map +0 -1
- package/lib/browser/monaco-menu.d.ts +0 -21
- package/lib/browser/monaco-menu.d.ts.map +0 -1
- package/lib/browser/monaco-menu.js +0 -141
- package/lib/browser/monaco-menu.js.map +0 -1
- package/lib/browser/monaco-mime-service.d.ts +0 -11
- package/lib/browser/monaco-mime-service.d.ts.map +0 -1
- package/lib/browser/monaco-mime-service.js +0 -71
- package/lib/browser/monaco-mime-service.js.map +0 -1
- package/lib/browser/monaco-outline-contribution.d.ts +0 -79
- package/lib/browser/monaco-outline-contribution.d.ts.map +0 -1
- package/lib/browser/monaco-outline-contribution.js +0 -377
- package/lib/browser/monaco-outline-contribution.js.map +0 -1
- package/lib/browser/monaco-outline-decorator.d.ts +0 -13
- package/lib/browser/monaco-outline-decorator.d.ts.map +0 -1
- package/lib/browser/monaco-outline-decorator.js +0 -63
- package/lib/browser/monaco-outline-decorator.js.map +0 -1
- package/lib/browser/monaco-quick-access-registry.d.ts +0 -12
- package/lib/browser/monaco-quick-access-registry.d.ts.map +0 -1
- package/lib/browser/monaco-quick-access-registry.js +0 -92
- package/lib/browser/monaco-quick-access-registry.js.map +0 -1
- package/lib/browser/monaco-quick-input-service.d.ts +0 -110
- package/lib/browser/monaco-quick-input-service.d.ts.map +0 -1
- package/lib/browser/monaco-quick-input-service.js +0 -591
- package/lib/browser/monaco-quick-input-service.js.map +0 -1
- package/lib/browser/monaco-resolved-keybinding.d.ts +0 -24
- package/lib/browser/monaco-resolved-keybinding.d.ts.map +0 -1
- package/lib/browser/monaco-resolved-keybinding.js +0 -132
- package/lib/browser/monaco-resolved-keybinding.js.map +0 -1
- package/lib/browser/monaco-snippet-suggest-provider.d.ts +0 -67
- package/lib/browser/monaco-snippet-suggest-provider.d.ts.map +0 -1
- package/lib/browser/monaco-snippet-suggest-provider.js +0 -266
- package/lib/browser/monaco-snippet-suggest-provider.js.map +0 -1
- package/lib/browser/monaco-standalone-theme-service.d.ts +0 -8
- package/lib/browser/monaco-standalone-theme-service.d.ts.map +0 -1
- package/lib/browser/monaco-standalone-theme-service.js +0 -51
- package/lib/browser/monaco-standalone-theme-service.js.map +0 -1
- package/lib/browser/monaco-status-bar-contribution.d.ts +0 -18
- package/lib/browser/monaco-status-bar-contribution.d.ts.map +0 -1
- package/lib/browser/monaco-status-bar-contribution.js +0 -105
- package/lib/browser/monaco-status-bar-contribution.js.map +0 -1
- package/lib/browser/monaco-text-model-service.d.ts +0 -59
- package/lib/browser/monaco-text-model-service.d.ts.map +0 -1
- package/lib/browser/monaco-text-model-service.js +0 -157
- package/lib/browser/monaco-text-model-service.js.map +0 -1
- package/lib/browser/monaco-theming-service.d.ts +0 -68
- package/lib/browser/monaco-theming-service.d.ts.map +0 -1
- package/lib/browser/monaco-theming-service.js +0 -164
- package/lib/browser/monaco-theming-service.js.map +0 -1
- package/lib/browser/monaco-to-protocol-converter.d.ts +0 -29
- package/lib/browser/monaco-to-protocol-converter.d.ts.map +0 -1
- package/lib/browser/monaco-to-protocol-converter.js +0 -74
- package/lib/browser/monaco-to-protocol-converter.js.map +0 -1
- package/lib/browser/monaco-undo-redo-handler.d.ts +0 -20
- package/lib/browser/monaco-undo-redo-handler.d.ts.map +0 -1
- package/lib/browser/monaco-undo-redo-handler.js +0 -72
- package/lib/browser/monaco-undo-redo-handler.js.map +0 -1
- package/lib/browser/monaco-utilities.d.ts +0 -3
- package/lib/browser/monaco-utilities.d.ts.map +0 -1
- package/lib/browser/monaco-utilities.js +0 -45
- package/lib/browser/monaco-utilities.js.map +0 -1
- package/lib/browser/monaco-workspace-context-service.d.ts +0 -26
- package/lib/browser/monaco-workspace-context-service.d.ts.map +0 -1
- package/lib/browser/monaco-workspace-context-service.js +0 -63
- package/lib/browser/monaco-workspace-context-service.js.map +0 -1
- package/lib/browser/monaco-workspace.d.ts +0 -85
- package/lib/browser/monaco-workspace.d.ts.map +0 -1
- package/lib/browser/monaco-workspace.js +0 -378
- package/lib/browser/monaco-workspace.js.map +0 -1
- package/lib/browser/protocol-to-monaco-converter.d.ts +0 -32
- package/lib/browser/protocol-to-monaco-converter.d.ts.map +0 -1
- package/lib/browser/protocol-to-monaco-converter.js +0 -129
- package/lib/browser/protocol-to-monaco-converter.js.map +0 -1
- package/lib/browser/simple-monaco-editor.d.ts +0 -49
- package/lib/browser/simple-monaco-editor.d.ts.map +0 -1
- package/lib/browser/simple-monaco-editor.js +0 -199
- package/lib/browser/simple-monaco-editor.js.map +0 -1
- package/lib/browser/textmate/index.d.ts +0 -5
- package/lib/browser/textmate/index.d.ts.map +0 -1
- package/lib/browser/textmate/index.js +0 -23
- package/lib/browser/textmate/index.js.map +0 -1
- package/lib/browser/textmate/monaco-textmate-frontend-bindings.d.ts +0 -12
- package/lib/browser/textmate/monaco-textmate-frontend-bindings.d.ts.map +0 -1
- package/lib/browser/textmate/monaco-textmate-frontend-bindings.js +0 -92
- package/lib/browser/textmate/monaco-textmate-frontend-bindings.js.map +0 -1
- package/lib/browser/textmate/monaco-textmate-service.d.ts +0 -31
- package/lib/browser/textmate/monaco-textmate-service.d.ts.map +0 -1
- package/lib/browser/textmate/monaco-textmate-service.js +0 -178
- package/lib/browser/textmate/monaco-textmate-service.js.map +0 -1
- package/lib/browser/textmate/monaco-theme-registry.d.ts +0 -28
- package/lib/browser/textmate/monaco-theme-registry.d.ts.map +0 -1
- package/lib/browser/textmate/monaco-theme-registry.js +0 -165
- package/lib/browser/textmate/monaco-theme-registry.js.map +0 -1
- package/lib/browser/textmate/monaco-theme-types.d.ts +0 -20
- package/lib/browser/textmate/monaco-theme-types.d.ts.map +0 -1
- package/lib/browser/textmate/monaco-theme-types.js +0 -22
- package/lib/browser/textmate/monaco-theme-types.js.map +0 -1
- package/lib/browser/textmate/textmate-contribution.d.ts +0 -10
- package/lib/browser/textmate/textmate-contribution.d.ts.map +0 -1
- package/lib/browser/textmate/textmate-contribution.js +0 -28
- package/lib/browser/textmate/textmate-contribution.js.map +0 -1
- package/lib/browser/textmate/textmate-registry.d.ts +0 -32
- package/lib/browser/textmate/textmate-registry.d.ts.map +0 -1
- package/lib/browser/textmate/textmate-registry.js +0 -105
- package/lib/browser/textmate/textmate-registry.js.map +0 -1
- package/lib/browser/textmate/textmate-snippet-completion-provider.d.ts +0 -27
- package/lib/browser/textmate/textmate-snippet-completion-provider.d.ts.map +0 -1
- package/lib/browser/textmate/textmate-snippet-completion-provider.js +0 -54
- package/lib/browser/textmate/textmate-snippet-completion-provider.js.map +0 -1
- package/lib/browser/textmate/textmate-tokenizer.d.ts +0 -23
- package/lib/browser/textmate/textmate-tokenizer.d.ts.map +0 -1
- package/lib/browser/textmate/textmate-tokenizer.js +0 -66
- package/lib/browser/textmate/textmate-tokenizer.js.map +0 -1
- package/lib/browser/workspace-symbol-command.d.ts +0 -56
- package/lib/browser/workspace-symbol-command.d.ts.map +0 -1
- package/lib/browser/workspace-symbol-command.js +0 -208
- package/lib/browser/workspace-symbol-command.js.map +0 -1
- package/lib/package.spec.d.ts +0 -1
- package/lib/package.spec.d.ts.map +0 -1
- package/lib/package.spec.js +0 -26
- package/lib/package.spec.js.map +0 -1
|
@@ -1,638 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2018 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-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.MonacoEditor = exports.MonacoEditorServices = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
-
const domutils_1 = require("@theia/core/shared/@lumino/domutils");
|
|
22
|
-
const context_key_service_1 = require("@theia/core/lib/browser/context-key-service");
|
|
23
|
-
const common_1 = require("@theia/core/lib/common");
|
|
24
|
-
const monaco_to_protocol_converter_1 = require("./monaco-to-protocol-converter");
|
|
25
|
-
const protocol_to_monaco_converter_1 = require("./protocol-to-monaco-converter");
|
|
26
|
-
const encodings_1 = require("@theia/core/lib/common/encodings");
|
|
27
|
-
const monaco = require("@theia/monaco-editor-core");
|
|
28
|
-
const standaloneServices_1 = require("@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices");
|
|
29
|
-
const language_1 = require("@theia/monaco-editor-core/esm/vs/editor/common/languages/language");
|
|
30
|
-
const instantiation_1 = require("@theia/monaco-editor-core/esm/vs/platform/instantiation/common/instantiation");
|
|
31
|
-
const standaloneCodeEditor_1 = require("@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditor");
|
|
32
|
-
const serviceCollection_1 = require("@theia/monaco-editor-core/esm/vs/platform/instantiation/common/serviceCollection");
|
|
33
|
-
const editorOptions_1 = require("@theia/monaco-editor-core/esm/vs/editor/common/config/editorOptions");
|
|
34
|
-
const codeEditorService_1 = require("@theia/monaco-editor-core/esm/vs/editor/browser/services/codeEditorService");
|
|
35
|
-
const commands_1 = require("@theia/monaco-editor-core/esm/vs/platform/commands/common/commands");
|
|
36
|
-
const contextkey_1 = require("@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey");
|
|
37
|
-
const keybinding_1 = require("@theia/monaco-editor-core/esm/vs/platform/keybinding/common/keybinding");
|
|
38
|
-
const themeService_1 = require("@theia/monaco-editor-core/esm/vs/platform/theme/common/themeService");
|
|
39
|
-
const notification_1 = require("@theia/monaco-editor-core/esm/vs/platform/notification/common/notification");
|
|
40
|
-
const accessibility_1 = require("@theia/monaco-editor-core/esm/vs/platform/accessibility/common/accessibility");
|
|
41
|
-
const languageConfigurationRegistry_1 = require("@theia/monaco-editor-core/esm/vs/editor/common/languages/languageConfigurationRegistry");
|
|
42
|
-
const languageFeatures_1 = require("@theia/monaco-editor-core/esm/vs/editor/common/services/languageFeatures");
|
|
43
|
-
const objects = require("@theia/monaco-editor-core/esm/vs/base/common/objects");
|
|
44
|
-
const hover_1 = require("@theia/monaco-editor-core/esm/vs/platform/hover/browser/hover");
|
|
45
|
-
const hoverDelegateFactory_1 = require("@theia/monaco-editor-core/esm/vs/base/browser/ui/hover/hoverDelegateFactory");
|
|
46
|
-
const monaco_text_model_service_1 = require("./monaco-text-model-service");
|
|
47
|
-
let MonacoEditorServices = class MonacoEditorServices {
|
|
48
|
-
constructor(services) {
|
|
49
|
-
Object.assign(this, services);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
exports.MonacoEditorServices = MonacoEditorServices;
|
|
53
|
-
tslib_1.__decorate([
|
|
54
|
-
(0, inversify_1.inject)(monaco_to_protocol_converter_1.MonacoToProtocolConverter),
|
|
55
|
-
tslib_1.__metadata("design:type", monaco_to_protocol_converter_1.MonacoToProtocolConverter)
|
|
56
|
-
], MonacoEditorServices.prototype, "m2p", void 0);
|
|
57
|
-
tslib_1.__decorate([
|
|
58
|
-
(0, inversify_1.inject)(protocol_to_monaco_converter_1.ProtocolToMonacoConverter),
|
|
59
|
-
tslib_1.__metadata("design:type", protocol_to_monaco_converter_1.ProtocolToMonacoConverter)
|
|
60
|
-
], MonacoEditorServices.prototype, "p2m", void 0);
|
|
61
|
-
tslib_1.__decorate([
|
|
62
|
-
(0, inversify_1.inject)(context_key_service_1.ContextKeyService),
|
|
63
|
-
tslib_1.__metadata("design:type", Object)
|
|
64
|
-
], MonacoEditorServices.prototype, "contextKeyService", void 0);
|
|
65
|
-
tslib_1.__decorate([
|
|
66
|
-
(0, inversify_1.inject)(monaco_text_model_service_1.MonacoTextModelService),
|
|
67
|
-
tslib_1.__metadata("design:type", monaco_text_model_service_1.MonacoTextModelService)
|
|
68
|
-
], MonacoEditorServices.prototype, "monacoModelService", void 0);
|
|
69
|
-
exports.MonacoEditorServices = MonacoEditorServices = tslib_1.__decorate([
|
|
70
|
-
(0, inversify_1.injectable)(),
|
|
71
|
-
tslib_1.__param(0, (0, inversify_1.unmanaged)()),
|
|
72
|
-
tslib_1.__metadata("design:paramtypes", [MonacoEditorServices])
|
|
73
|
-
], MonacoEditorServices);
|
|
74
|
-
class MonacoEditor extends MonacoEditorServices {
|
|
75
|
-
static async create(uri, document, node, services, options, override, parentEditor) {
|
|
76
|
-
const instance = new MonacoEditor(uri, document, node, services, options, override, parentEditor);
|
|
77
|
-
await instance.init();
|
|
78
|
-
return instance;
|
|
79
|
-
}
|
|
80
|
-
constructor(uri, document, node, services, options, override, parentEditor) {
|
|
81
|
-
super(services);
|
|
82
|
-
this.uri = uri;
|
|
83
|
-
this.document = document;
|
|
84
|
-
this.node = node;
|
|
85
|
-
this.parentEditor = parentEditor;
|
|
86
|
-
this.toDispose = new common_1.DisposableCollection();
|
|
87
|
-
this.onCursorPositionChangedEmitter = new common_1.Emitter();
|
|
88
|
-
this.onSelectionChangedEmitter = new common_1.Emitter();
|
|
89
|
-
this.onFocusChangedEmitter = new common_1.Emitter();
|
|
90
|
-
this.onDocumentContentChangedEmitter = new common_1.Emitter();
|
|
91
|
-
this.onMouseDownEmitter = new common_1.Emitter();
|
|
92
|
-
this.onDidChangeReadOnly = this.document.onDidChangeReadOnly;
|
|
93
|
-
this.onLanguageChangedEmitter = new common_1.Emitter();
|
|
94
|
-
this.onLanguageChanged = this.onLanguageChangedEmitter.event;
|
|
95
|
-
this.onScrollChangedEmitter = new common_1.Emitter();
|
|
96
|
-
this.onEncodingChanged = this.document.onDidChangeEncoding;
|
|
97
|
-
this.onResizeEmitter = new common_1.Emitter();
|
|
98
|
-
this.onDidResize = this.onResizeEmitter.event;
|
|
99
|
-
this.onShouldDisplayDirtyDiffChangedEmitter = new common_1.Emitter;
|
|
100
|
-
this.onShouldDisplayDirtyDiffChanged = this.onShouldDisplayDirtyDiffChangedEmitter.event;
|
|
101
|
-
this.documents = new Set();
|
|
102
|
-
/* `true` because it is derived from an URI during the instantiation */
|
|
103
|
-
this._languageAutoDetected = true;
|
|
104
|
-
this._shouldDisplayDirtyDiff = true;
|
|
105
|
-
this.toDispose.pushAll([
|
|
106
|
-
this.onCursorPositionChangedEmitter,
|
|
107
|
-
this.onSelectionChangedEmitter,
|
|
108
|
-
this.onFocusChangedEmitter,
|
|
109
|
-
this.onDocumentContentChangedEmitter,
|
|
110
|
-
this.onMouseDownEmitter,
|
|
111
|
-
this.onLanguageChangedEmitter,
|
|
112
|
-
this.onScrollChangedEmitter,
|
|
113
|
-
this.onShouldDisplayDirtyDiffChangedEmitter
|
|
114
|
-
]);
|
|
115
|
-
this.documents.add(document);
|
|
116
|
-
this.autoSizing = options && options.autoSizing !== undefined ? options.autoSizing : false;
|
|
117
|
-
this.minHeight = options && options.minHeight !== undefined ? options.minHeight : -1;
|
|
118
|
-
this.maxHeight = options && options.maxHeight !== undefined ? options.maxHeight : -1;
|
|
119
|
-
this.toDispose.push(this.create({
|
|
120
|
-
...MonacoEditor.createReadOnlyOptions(document.readOnly),
|
|
121
|
-
...options
|
|
122
|
-
}, override));
|
|
123
|
-
// Ensure that a valid InstantiationService is responsible for creating hover delegates when the InstantiationService for this widget is disposed.
|
|
124
|
-
// Cf. https://github.com/eclipse-theia/theia/issues/15102
|
|
125
|
-
this.toDispose.push(common_1.Disposable.create(() => (0, hoverDelegateFactory_1.setHoverDelegateFactory)((placement, enableInstantHover) => standaloneServices_1.StandaloneServices.get(instantiation_1.IInstantiationService).createInstance(hover_1.WorkbenchHoverDelegate, placement, enableInstantHover, {}))));
|
|
126
|
-
this.addHandlers(this.editor);
|
|
127
|
-
this.editor.createContextKey('resource', document.uri);
|
|
128
|
-
}
|
|
129
|
-
async init() {
|
|
130
|
-
this.toDispose.push(await this.monacoModelService.createModelReference(this.uri));
|
|
131
|
-
}
|
|
132
|
-
getEncoding() {
|
|
133
|
-
return this.document.getEncoding() || encodings_1.UTF8;
|
|
134
|
-
}
|
|
135
|
-
setEncoding(encoding, mode) {
|
|
136
|
-
return this.document.setEncoding(encoding, mode);
|
|
137
|
-
}
|
|
138
|
-
create(options, override) {
|
|
139
|
-
const combinedOptions = {
|
|
140
|
-
...options,
|
|
141
|
-
lightbulb: { enabled: editorOptions_1.ShowLightbulbIconMode.On },
|
|
142
|
-
fixedOverflowWidgets: true,
|
|
143
|
-
scrollbar: {
|
|
144
|
-
useShadows: false,
|
|
145
|
-
verticalHasArrows: false,
|
|
146
|
-
horizontalHasArrows: false,
|
|
147
|
-
verticalScrollbarSize: 10,
|
|
148
|
-
horizontalScrollbarSize: 10,
|
|
149
|
-
...options === null || options === void 0 ? void 0 : options.scrollbar,
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
const instantiator = this.getInstantiatorWithOverrides(override);
|
|
153
|
-
/**
|
|
154
|
-
* @monaco-uplift. Should be guaranteed to work.
|
|
155
|
-
* Incomparable enums prevent TypeScript from believing that public IStandaloneCodeEditor is satisfied by private StandaloneCodeEditor
|
|
156
|
-
*/
|
|
157
|
-
return this.editor = (this.parentEditor ?
|
|
158
|
-
instantiator.createInstance(EmbeddedCodeEditor, this.node, combinedOptions, this.parentEditor.getControl()) :
|
|
159
|
-
instantiator.createInstance(standaloneCodeEditor_1.StandaloneEditor, this.node, combinedOptions));
|
|
160
|
-
}
|
|
161
|
-
getInstantiatorWithOverrides(override) {
|
|
162
|
-
const instantiator = standaloneServices_1.StandaloneServices.get(instantiation_1.IInstantiationService);
|
|
163
|
-
if (override) {
|
|
164
|
-
const overrideServices = new serviceCollection_1.ServiceCollection(...override);
|
|
165
|
-
const child = instantiator.createChild(overrideServices);
|
|
166
|
-
this.toDispose.push(child);
|
|
167
|
-
return child;
|
|
168
|
-
}
|
|
169
|
-
return instantiator;
|
|
170
|
-
}
|
|
171
|
-
addHandlers(codeEditor) {
|
|
172
|
-
this.toDispose.push(codeEditor.onDidChangeModelLanguage(e => this.fireLanguageChanged(e.newLanguage)));
|
|
173
|
-
this.toDispose.push(codeEditor.onDidChangeConfiguration(() => this.refresh()));
|
|
174
|
-
this.toDispose.push(codeEditor.onDidChangeModel(() => this.refresh()));
|
|
175
|
-
this.toDispose.push(codeEditor.onDidChangeModelContent(e => {
|
|
176
|
-
this.refresh();
|
|
177
|
-
this.onDocumentContentChangedEmitter.fire({ document: this.document, contentChanges: e.changes.map(this.mapModelContentChange.bind(this)) });
|
|
178
|
-
}));
|
|
179
|
-
this.toDispose.push(codeEditor.onDidChangeCursorPosition(() => this.onCursorPositionChangedEmitter.fire(this.cursor)));
|
|
180
|
-
this.toDispose.push(codeEditor.onDidChangeCursorSelection(event => this.onSelectionChangedEmitter.fire({
|
|
181
|
-
...this.m2p.asRange(event.selection),
|
|
182
|
-
direction: event.selection.getDirection() === monaco.SelectionDirection.LTR ? 'ltr' : 'rtl'
|
|
183
|
-
})));
|
|
184
|
-
this.toDispose.push(codeEditor.onDidFocusEditorText(() => this.onFocusChangedEmitter.fire(this.isFocused())));
|
|
185
|
-
this.toDispose.push(codeEditor.onDidBlurEditorText(() => this.onFocusChangedEmitter.fire(this.isFocused())));
|
|
186
|
-
this.toDispose.push(codeEditor.onMouseDown(e => {
|
|
187
|
-
const { element, position, range } = e.target;
|
|
188
|
-
this.onMouseDownEmitter.fire({
|
|
189
|
-
target: {
|
|
190
|
-
type: e.target.type,
|
|
191
|
-
element: element || undefined,
|
|
192
|
-
mouseColumn: this.m2p.asPosition(undefined, e.target.mouseColumn).character,
|
|
193
|
-
range: range && this.m2p.asRange(range) || undefined,
|
|
194
|
-
position: position && this.m2p.asPosition(position.lineNumber, position.column) || undefined,
|
|
195
|
-
detail: e.target.detail || {},
|
|
196
|
-
},
|
|
197
|
-
event: e.event.browserEvent
|
|
198
|
-
});
|
|
199
|
-
}));
|
|
200
|
-
this.toDispose.push(codeEditor.onDidScrollChange(e => {
|
|
201
|
-
this.onScrollChangedEmitter.fire(undefined);
|
|
202
|
-
}));
|
|
203
|
-
this.toDispose.push(this.onDidChangeReadOnly(readOnly => {
|
|
204
|
-
codeEditor.updateOptions(MonacoEditor.createReadOnlyOptions(readOnly));
|
|
205
|
-
}));
|
|
206
|
-
}
|
|
207
|
-
handleVisibilityChanged(nowVisible) {
|
|
208
|
-
if (nowVisible) {
|
|
209
|
-
if (this.model) {
|
|
210
|
-
this.editor.setModel(this.model);
|
|
211
|
-
this.editor.restoreViewState(this.savedViewState);
|
|
212
|
-
this.editor.focus();
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
this.model = this.editor.getModel();
|
|
217
|
-
this.savedViewState = this.editor.saveViewState();
|
|
218
|
-
// eslint-disable-next-line no-null/no-null
|
|
219
|
-
this.editor.setModel(null); // workaround for https://github.com/eclipse-theia/theia/issues/14880
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
getVisibleRanges() {
|
|
223
|
-
return this.editor.getVisibleRanges().map(range => this.m2p.asRange(range));
|
|
224
|
-
}
|
|
225
|
-
mapModelContentChange(change) {
|
|
226
|
-
return {
|
|
227
|
-
range: this.m2p.asRange(change.range),
|
|
228
|
-
rangeLength: change.rangeLength,
|
|
229
|
-
text: change.text
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
get onDispose() {
|
|
233
|
-
return this.toDispose.onDispose;
|
|
234
|
-
}
|
|
235
|
-
get onDocumentContentChanged() {
|
|
236
|
-
return this.onDocumentContentChangedEmitter.event;
|
|
237
|
-
}
|
|
238
|
-
get isReadonly() {
|
|
239
|
-
return this.document.readOnly;
|
|
240
|
-
}
|
|
241
|
-
get cursor() {
|
|
242
|
-
const { lineNumber, column } = this.editor.getPosition();
|
|
243
|
-
return this.m2p.asPosition(lineNumber, column);
|
|
244
|
-
}
|
|
245
|
-
set cursor(cursor) {
|
|
246
|
-
const position = this.p2m.asPosition(cursor);
|
|
247
|
-
this.editor.setPosition(position);
|
|
248
|
-
}
|
|
249
|
-
get onCursorPositionChanged() {
|
|
250
|
-
return this.onCursorPositionChangedEmitter.event;
|
|
251
|
-
}
|
|
252
|
-
get selection() {
|
|
253
|
-
return this.m2p.asSelection(this.editor.getSelection());
|
|
254
|
-
}
|
|
255
|
-
set selection(selection) {
|
|
256
|
-
const range = this.p2m.asRange(selection);
|
|
257
|
-
this.editor.setSelection(range);
|
|
258
|
-
}
|
|
259
|
-
get onSelectionChanged() {
|
|
260
|
-
return this.onSelectionChangedEmitter.event;
|
|
261
|
-
}
|
|
262
|
-
get onScrollChanged() {
|
|
263
|
-
return this.onScrollChangedEmitter.event;
|
|
264
|
-
}
|
|
265
|
-
revealPosition(raw, options = { vertical: 'center' }) {
|
|
266
|
-
const position = this.p2m.asPosition(raw);
|
|
267
|
-
switch (options.vertical) {
|
|
268
|
-
case 'auto':
|
|
269
|
-
this.editor.revealPosition(position);
|
|
270
|
-
break;
|
|
271
|
-
case 'center':
|
|
272
|
-
this.editor.revealPositionInCenter(position);
|
|
273
|
-
break;
|
|
274
|
-
case 'centerIfOutsideViewport':
|
|
275
|
-
this.editor.revealPositionInCenterIfOutsideViewport(position);
|
|
276
|
-
break;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
revealRange(raw, options = { at: 'center' }) {
|
|
280
|
-
const range = this.p2m.asRange(raw);
|
|
281
|
-
switch (options.at) {
|
|
282
|
-
case 'top':
|
|
283
|
-
this.editor.revealRangeAtTop(range);
|
|
284
|
-
break;
|
|
285
|
-
case 'center':
|
|
286
|
-
this.editor.revealRangeInCenter(range);
|
|
287
|
-
break;
|
|
288
|
-
case 'centerIfOutsideViewport':
|
|
289
|
-
this.editor.revealRangeInCenterIfOutsideViewport(range);
|
|
290
|
-
break;
|
|
291
|
-
case 'auto':
|
|
292
|
-
this.editor.revealRange(range);
|
|
293
|
-
break;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
focus() {
|
|
297
|
-
/**
|
|
298
|
-
* `this.editor.focus` forcefully changes the focus editor state,
|
|
299
|
-
* regardless whether the textarea actually received the focus.
|
|
300
|
-
* It could lead to issues like https://github.com/eclipse-theia/theia/issues/7902
|
|
301
|
-
* Instead we focus the underlying textarea.
|
|
302
|
-
*/
|
|
303
|
-
const node = this.editor.getDomNode();
|
|
304
|
-
if (node) {
|
|
305
|
-
const textarea = node.querySelector('textarea');
|
|
306
|
-
textarea.focus();
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
blur() {
|
|
310
|
-
const node = this.editor.getDomNode();
|
|
311
|
-
if (node) {
|
|
312
|
-
const textarea = node.querySelector('textarea');
|
|
313
|
-
textarea.blur();
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
isFocused({ strict } = { strict: false }) {
|
|
317
|
-
if (!this.editor.hasTextFocus()) {
|
|
318
|
-
return false;
|
|
319
|
-
}
|
|
320
|
-
if (strict) {
|
|
321
|
-
return !this.isSuggestWidgetVisible() && !this.isFindWidgetVisible() && !this.isRenameInputVisible();
|
|
322
|
-
}
|
|
323
|
-
return true;
|
|
324
|
-
}
|
|
325
|
-
get onFocusChanged() {
|
|
326
|
-
return this.onFocusChangedEmitter.event;
|
|
327
|
-
}
|
|
328
|
-
get onMouseDown() {
|
|
329
|
-
return this.onMouseDownEmitter.event;
|
|
330
|
-
}
|
|
331
|
-
/**
|
|
332
|
-
* `true` if the suggest widget is visible in the editor. Otherwise, `false`.
|
|
333
|
-
*/
|
|
334
|
-
isSuggestWidgetVisible() {
|
|
335
|
-
return this.contextKeyService.match('suggestWidgetVisible', this.editor.getDomNode() || this.node);
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* `true` if the find (and replace) widget is visible in the editor. Otherwise, `false`.
|
|
339
|
-
*/
|
|
340
|
-
isFindWidgetVisible() {
|
|
341
|
-
return this.contextKeyService.match('findWidgetVisible', this.editor.getDomNode() || this.node);
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* `true` if the name rename refactoring input HTML element is visible. Otherwise, `false`.
|
|
345
|
-
*/
|
|
346
|
-
isRenameInputVisible() {
|
|
347
|
-
return this.contextKeyService.match('renameInputVisible', this.editor.getDomNode() || this.node);
|
|
348
|
-
}
|
|
349
|
-
dispose() {
|
|
350
|
-
this.toDispose.dispose();
|
|
351
|
-
}
|
|
352
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
353
|
-
trigger(source, handlerId, payload) {
|
|
354
|
-
this.editor.trigger(source, handlerId, payload);
|
|
355
|
-
}
|
|
356
|
-
getControl() {
|
|
357
|
-
return this.editor;
|
|
358
|
-
}
|
|
359
|
-
refresh() {
|
|
360
|
-
this.autoresize();
|
|
361
|
-
}
|
|
362
|
-
resizeToFit() {
|
|
363
|
-
this.autoresize();
|
|
364
|
-
// eslint-disable-next-line no-null/no-null
|
|
365
|
-
this.onResizeEmitter.fire(null);
|
|
366
|
-
}
|
|
367
|
-
setSize(dimension) {
|
|
368
|
-
this.resize(dimension);
|
|
369
|
-
this.onResizeEmitter.fire(dimension);
|
|
370
|
-
}
|
|
371
|
-
autoresize() {
|
|
372
|
-
if (this.autoSizing) {
|
|
373
|
-
// eslint-disable-next-line no-null/no-null
|
|
374
|
-
this.resize(null);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
resize(dimension) {
|
|
378
|
-
if (this.node) {
|
|
379
|
-
const layoutSize = this.computeLayoutSize(this.node, dimension);
|
|
380
|
-
this.editor.layout(layoutSize);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
computeLayoutSize(hostNode, dimension) {
|
|
384
|
-
if (dimension && dimension.width >= 0 && dimension.height >= 0) {
|
|
385
|
-
return dimension;
|
|
386
|
-
}
|
|
387
|
-
const boxSizing = domutils_1.ElementExt.boxSizing(hostNode);
|
|
388
|
-
const width = (!dimension || dimension.width < 0) ?
|
|
389
|
-
this.getWidth(hostNode, boxSizing) :
|
|
390
|
-
dimension.width;
|
|
391
|
-
const height = (!dimension || dimension.height < 0) ?
|
|
392
|
-
this.getHeight(hostNode, boxSizing) :
|
|
393
|
-
dimension.height;
|
|
394
|
-
return { width, height };
|
|
395
|
-
}
|
|
396
|
-
getWidth(hostNode, boxSizing) {
|
|
397
|
-
return hostNode.offsetWidth - boxSizing.horizontalSum;
|
|
398
|
-
}
|
|
399
|
-
getHeight(hostNode, boxSizing) {
|
|
400
|
-
if (!this.autoSizing) {
|
|
401
|
-
return hostNode.offsetHeight - boxSizing.verticalSum;
|
|
402
|
-
}
|
|
403
|
-
const lineHeight = this.editor.getOption(monaco.editor.EditorOption.lineHeight);
|
|
404
|
-
const lineCount = this.editor.getModel().getLineCount();
|
|
405
|
-
const contentHeight = lineHeight * lineCount;
|
|
406
|
-
const horizontalScrollbarHeight = this.editor.getLayoutInfo().horizontalScrollbarHeight;
|
|
407
|
-
const editorHeight = contentHeight + horizontalScrollbarHeight;
|
|
408
|
-
if (this.minHeight >= 0) {
|
|
409
|
-
const minHeight = lineHeight * this.minHeight + horizontalScrollbarHeight;
|
|
410
|
-
if (editorHeight < minHeight) {
|
|
411
|
-
return minHeight;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
if (this.maxHeight >= 0) {
|
|
415
|
-
const maxHeight = lineHeight * this.maxHeight + horizontalScrollbarHeight;
|
|
416
|
-
return Math.min(maxHeight, editorHeight);
|
|
417
|
-
}
|
|
418
|
-
return editorHeight;
|
|
419
|
-
}
|
|
420
|
-
isActionSupported(id) {
|
|
421
|
-
const action = this.editor.getAction(id);
|
|
422
|
-
return !!action && action.isSupported();
|
|
423
|
-
}
|
|
424
|
-
async runAction(id) {
|
|
425
|
-
const action = this.editor.getAction(id);
|
|
426
|
-
if (action && action.isSupported()) {
|
|
427
|
-
await action.run();
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
deltaDecorations(params) {
|
|
431
|
-
const oldDecorations = params.oldDecorations;
|
|
432
|
-
const newDecorations = this.toDeltaDecorations(params);
|
|
433
|
-
return this.editor.deltaDecorations(oldDecorations, newDecorations);
|
|
434
|
-
}
|
|
435
|
-
toDeltaDecorations(params) {
|
|
436
|
-
return params.newDecorations.map(({ options: theiaOptions, range }) => {
|
|
437
|
-
const options = {
|
|
438
|
-
...theiaOptions,
|
|
439
|
-
hoverMessage: this.fromStringToMarkdownString(theiaOptions.hoverMessage),
|
|
440
|
-
glyphMarginHoverMessage: this.fromStringToMarkdownString(theiaOptions.glyphMarginHoverMessage)
|
|
441
|
-
};
|
|
442
|
-
return {
|
|
443
|
-
options,
|
|
444
|
-
range: this.p2m.asRange(range),
|
|
445
|
-
};
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
fromStringToMarkdownString(hoverMessage) {
|
|
449
|
-
if (typeof hoverMessage === 'string') {
|
|
450
|
-
return { value: hoverMessage };
|
|
451
|
-
}
|
|
452
|
-
return hoverMessage;
|
|
453
|
-
}
|
|
454
|
-
fromMarkdownToString(maybeMarkdown) {
|
|
455
|
-
if (!maybeMarkdown) {
|
|
456
|
-
return undefined;
|
|
457
|
-
}
|
|
458
|
-
if (typeof maybeMarkdown === 'string') {
|
|
459
|
-
return maybeMarkdown;
|
|
460
|
-
}
|
|
461
|
-
if (Array.isArray(maybeMarkdown)) {
|
|
462
|
-
return maybeMarkdown.map(({ value }) => value).join('\n');
|
|
463
|
-
}
|
|
464
|
-
return maybeMarkdown.value;
|
|
465
|
-
}
|
|
466
|
-
getLinesDecorations(startLineNumber, endLineNumber) {
|
|
467
|
-
var _a;
|
|
468
|
-
const toPosition = (line) => this.p2m.asPosition({ line, character: 0 });
|
|
469
|
-
const start = toPosition(startLineNumber).lineNumber;
|
|
470
|
-
const end = toPosition(endLineNumber).lineNumber;
|
|
471
|
-
return ((_a = this.editor.getModel()) === null || _a === void 0 ? void 0 : _a.getLinesDecorations(start, end).map(this.toEditorDecoration.bind(this))) || [];
|
|
472
|
-
}
|
|
473
|
-
toEditorDecoration(decoration) {
|
|
474
|
-
const range = this.m2p.asRange(decoration.range);
|
|
475
|
-
const { id, options: monacoOptions } = decoration;
|
|
476
|
-
const options = {
|
|
477
|
-
...monacoOptions,
|
|
478
|
-
hoverMessage: this.fromMarkdownToString(monacoOptions.hoverMessage),
|
|
479
|
-
glyphMarginHoverMessage: this.fromMarkdownToString(monacoOptions.hoverMessage),
|
|
480
|
-
};
|
|
481
|
-
return {
|
|
482
|
-
options: (0, common_1.nullToUndefined)(options),
|
|
483
|
-
range,
|
|
484
|
-
id
|
|
485
|
-
};
|
|
486
|
-
}
|
|
487
|
-
getVisibleColumn(position) {
|
|
488
|
-
return this.editor.getVisibleColumnFromPosition(this.p2m.asPosition(position));
|
|
489
|
-
}
|
|
490
|
-
async replaceText(params) {
|
|
491
|
-
const edits = params.replaceOperations.map(param => {
|
|
492
|
-
const range = monaco.Range.fromPositions(this.p2m.asPosition(param.range.start), this.p2m.asPosition(param.range.end));
|
|
493
|
-
return {
|
|
494
|
-
forceMoveMarkers: true,
|
|
495
|
-
identifier: {
|
|
496
|
-
major: range.startLineNumber,
|
|
497
|
-
minor: range.startColumn
|
|
498
|
-
},
|
|
499
|
-
range,
|
|
500
|
-
text: param.text
|
|
501
|
-
};
|
|
502
|
-
});
|
|
503
|
-
return this.editor.executeEdits(params.source, edits);
|
|
504
|
-
}
|
|
505
|
-
executeEdits(edits) {
|
|
506
|
-
return this.editor.executeEdits('MonacoEditor', this.p2m.asTextEdits(edits));
|
|
507
|
-
}
|
|
508
|
-
storeViewState() {
|
|
509
|
-
const state = this.editor.saveViewState();
|
|
510
|
-
if (state) {
|
|
511
|
-
this.savedViewState = state;
|
|
512
|
-
}
|
|
513
|
-
return this.savedViewState;
|
|
514
|
-
}
|
|
515
|
-
restoreViewState(state) {
|
|
516
|
-
this.editor.restoreViewState(state);
|
|
517
|
-
this.savedViewState = state;
|
|
518
|
-
}
|
|
519
|
-
get languageAutoDetected() {
|
|
520
|
-
return this._languageAutoDetected;
|
|
521
|
-
}
|
|
522
|
-
async detectLanguage() {
|
|
523
|
-
const languageService = standaloneServices_1.StandaloneServices.get(language_1.ILanguageService);
|
|
524
|
-
const firstLine = this.document.textEditorModel.getLineContent(1);
|
|
525
|
-
const model = this.getControl().getModel();
|
|
526
|
-
const language = languageService.createByFilepathOrFirstLine(model && model.uri, firstLine);
|
|
527
|
-
this.setLanguage(language.languageId);
|
|
528
|
-
this._languageAutoDetected = true;
|
|
529
|
-
}
|
|
530
|
-
setLanguage(languageId) {
|
|
531
|
-
for (const document of this.documents) {
|
|
532
|
-
monaco.editor.setModelLanguage(document.textEditorModel, languageId);
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
fireLanguageChanged(languageId) {
|
|
536
|
-
this._languageAutoDetected = false;
|
|
537
|
-
this.onLanguageChangedEmitter.fire(languageId);
|
|
538
|
-
}
|
|
539
|
-
getResourceUri() {
|
|
540
|
-
return this.uri;
|
|
541
|
-
}
|
|
542
|
-
createMoveToUri(resourceUri) {
|
|
543
|
-
return this.uri.withPath(resourceUri.path);
|
|
544
|
-
}
|
|
545
|
-
shouldDisplayDirtyDiff() {
|
|
546
|
-
return this._shouldDisplayDirtyDiff;
|
|
547
|
-
}
|
|
548
|
-
setShouldDisplayDirtyDiff(value) {
|
|
549
|
-
if (value !== this._shouldDisplayDirtyDiff) {
|
|
550
|
-
this._shouldDisplayDirtyDiff = value;
|
|
551
|
-
this.onShouldDisplayDirtyDiffChangedEmitter.fire(value);
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
exports.MonacoEditor = MonacoEditor;
|
|
556
|
-
(function (MonacoEditor) {
|
|
557
|
-
function getAll(manager) {
|
|
558
|
-
return manager.all.map(e => get(e)).filter(e => !!e);
|
|
559
|
-
}
|
|
560
|
-
MonacoEditor.getAll = getAll;
|
|
561
|
-
function getCurrent(manager) {
|
|
562
|
-
return get(manager.currentEditor);
|
|
563
|
-
}
|
|
564
|
-
MonacoEditor.getCurrent = getCurrent;
|
|
565
|
-
function getActive(manager) {
|
|
566
|
-
return get(manager.activeEditor);
|
|
567
|
-
}
|
|
568
|
-
MonacoEditor.getActive = getActive;
|
|
569
|
-
function get(editorWidget) {
|
|
570
|
-
if (editorWidget && editorWidget.editor instanceof MonacoEditor) {
|
|
571
|
-
return editorWidget.editor;
|
|
572
|
-
}
|
|
573
|
-
return undefined;
|
|
574
|
-
}
|
|
575
|
-
MonacoEditor.get = get;
|
|
576
|
-
function findByDocument(manager, document) {
|
|
577
|
-
return getAll(manager).filter(candidate => candidate.documents.has(document));
|
|
578
|
-
}
|
|
579
|
-
MonacoEditor.findByDocument = findByDocument;
|
|
580
|
-
function getWidgetFor(manager, control) {
|
|
581
|
-
if (!control) {
|
|
582
|
-
return undefined;
|
|
583
|
-
}
|
|
584
|
-
return manager.all.find(widget => {
|
|
585
|
-
const candidate = get(widget);
|
|
586
|
-
return candidate && candidate.getControl() === control;
|
|
587
|
-
});
|
|
588
|
-
}
|
|
589
|
-
MonacoEditor.getWidgetFor = getWidgetFor;
|
|
590
|
-
function createReadOnlyOptions(readOnly) {
|
|
591
|
-
if (typeof readOnly === 'boolean') {
|
|
592
|
-
return { readOnly, readOnlyMessage: undefined };
|
|
593
|
-
}
|
|
594
|
-
if (readOnly) {
|
|
595
|
-
return { readOnly: true, readOnlyMessage: readOnly };
|
|
596
|
-
}
|
|
597
|
-
return {};
|
|
598
|
-
}
|
|
599
|
-
MonacoEditor.createReadOnlyOptions = createReadOnlyOptions;
|
|
600
|
-
})(MonacoEditor || (exports.MonacoEditor = MonacoEditor = {}));
|
|
601
|
-
// adapted from https://github.com/microsoft/vscode/blob/0bd70d48ad8b3e2fb1922aa54f87c786ff2b4bd8/src/vs/editor/browser/widget/codeEditor/embeddedCodeEditorWidget.ts
|
|
602
|
-
// This class reproduces the logic in EmbeddedCodeEditorWidget but extends StandaloneCodeEditor rather than CodeEditorWidget.
|
|
603
|
-
let EmbeddedCodeEditor = class EmbeddedCodeEditor extends standaloneCodeEditor_1.StandaloneCodeEditor {
|
|
604
|
-
constructor(domElement, options, parentEditor, instantiationService, codeEditorService, commandService, contextKeyService, keybindingService, themeService, notificationService, accessibilityService, languageConfigurationService, languageFeaturesService, hoverService) {
|
|
605
|
-
super(domElement, { ...parentEditor.getRawOptions(), overflowWidgetsDomNode: parentEditor.getOverflowWidgetsDomNode() }, instantiationService, codeEditorService, commandService, contextKeyService, hoverService, keybindingService, themeService, notificationService, accessibilityService, languageConfigurationService, languageFeaturesService);
|
|
606
|
-
this._parentEditor = parentEditor;
|
|
607
|
-
this._overwriteOptions = options;
|
|
608
|
-
// Overwrite parent's options
|
|
609
|
-
super.updateOptions(this._overwriteOptions);
|
|
610
|
-
this._register(parentEditor.onDidChangeConfiguration((e) => this._onParentConfigurationChanged(e)));
|
|
611
|
-
}
|
|
612
|
-
getParentEditor() {
|
|
613
|
-
return this._parentEditor;
|
|
614
|
-
}
|
|
615
|
-
_onParentConfigurationChanged(e) {
|
|
616
|
-
super.updateOptions(this._parentEditor.getRawOptions());
|
|
617
|
-
super.updateOptions(this._overwriteOptions);
|
|
618
|
-
}
|
|
619
|
-
updateOptions(newOptions) {
|
|
620
|
-
objects.mixin(this._overwriteOptions, newOptions, true);
|
|
621
|
-
super.updateOptions(this._overwriteOptions);
|
|
622
|
-
}
|
|
623
|
-
};
|
|
624
|
-
EmbeddedCodeEditor = tslib_1.__decorate([
|
|
625
|
-
tslib_1.__param(3, instantiation_1.IInstantiationService),
|
|
626
|
-
tslib_1.__param(4, codeEditorService_1.ICodeEditorService),
|
|
627
|
-
tslib_1.__param(5, commands_1.ICommandService),
|
|
628
|
-
tslib_1.__param(6, contextkey_1.IContextKeyService),
|
|
629
|
-
tslib_1.__param(7, keybinding_1.IKeybindingService),
|
|
630
|
-
tslib_1.__param(8, themeService_1.IThemeService),
|
|
631
|
-
tslib_1.__param(9, notification_1.INotificationService),
|
|
632
|
-
tslib_1.__param(10, accessibility_1.IAccessibilityService),
|
|
633
|
-
tslib_1.__param(11, languageConfigurationRegistry_1.ILanguageConfigurationService),
|
|
634
|
-
tslib_1.__param(12, languageFeatures_1.ILanguageFeaturesService),
|
|
635
|
-
tslib_1.__param(13, hover_1.IHoverService),
|
|
636
|
-
tslib_1.__metadata("design:paramtypes", [HTMLElement, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object])
|
|
637
|
-
], EmbeddedCodeEditor);
|
|
638
|
-
//# sourceMappingURL=monaco-editor.js.map
|