@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,202 +1,202 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2018 Ericsson 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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.MonacoFrontendApplicationContribution = void 0;
|
|
28
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
29
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
30
|
-
const monaco_snippet_suggest_provider_1 = require("./monaco-snippet-suggest-provider");
|
|
31
|
-
const monaco = require("@theia/monaco-editor-core");
|
|
32
|
-
const suggest_1 = require("@theia/monaco-editor-core/esm/vs/editor/contrib/suggest/browser/suggest");
|
|
33
|
-
const monaco_editor_service_1 = require("./monaco-editor-service");
|
|
34
|
-
const monaco_text_model_service_1 = require("./monaco-text-model-service");
|
|
35
|
-
const contextKeyService_1 = require("@theia/monaco-editor-core/esm/vs/platform/contextkey/browser/contextKeyService");
|
|
36
|
-
const standaloneServices_1 = require("@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices");
|
|
37
|
-
const codeEditorService_1 = require("@theia/monaco-editor-core/esm/vs/editor/browser/services/codeEditorService");
|
|
38
|
-
const resolverService_1 = require("@theia/monaco-editor-core/esm/vs/editor/common/services/resolverService");
|
|
39
|
-
const contextkey_1 = require("@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey");
|
|
40
|
-
const contextView_1 = require("@theia/monaco-editor-core/esm/vs/platform/contextview/browser/contextView");
|
|
41
|
-
const monaco_context_menu_1 = require("./monaco-context-menu");
|
|
42
|
-
const monaco_theming_service_1 = require("./monaco-theming-service");
|
|
43
|
-
const theme_1 = require("@theia/core/lib/common/theme");
|
|
44
|
-
const editorOptions_1 = require("@theia/monaco-editor-core/esm/vs/editor/common/config/editorOptions");
|
|
45
|
-
const core_1 = require("@theia/core");
|
|
46
|
-
const editor_generated_preference_schema_1 = require("@theia/editor/lib/browser/editor-generated-preference-schema");
|
|
47
|
-
let theiaDidInitialize = false;
|
|
48
|
-
const originalInitialize = standaloneServices_1.StandaloneServices.initialize;
|
|
49
|
-
standaloneServices_1.StandaloneServices.initialize = overrides => {
|
|
50
|
-
if (!theiaDidInitialize) {
|
|
51
|
-
console.warn('Monaco was initialized before overrides were installed by Theia\'s initialization.'
|
|
52
|
-
+ ' Please check the lifecycle of services that use Monaco and ensure that Monaco entities are not instantiated before Theia is initialized.', new Error());
|
|
53
|
-
}
|
|
54
|
-
return originalInitialize(overrides);
|
|
55
|
-
};
|
|
56
|
-
let MonacoFrontendApplicationContribution = class MonacoFrontendApplicationContribution {
|
|
57
|
-
init() {
|
|
58
|
-
this.addAdditionalPreferenceValidations();
|
|
59
|
-
const { codeEditorService, textModelService, contextKeyService, contextMenuService } = this;
|
|
60
|
-
theiaDidInitialize = true;
|
|
61
|
-
standaloneServices_1.StandaloneServices.initialize({
|
|
62
|
-
[codeEditorService_1.ICodeEditorService.toString()]: codeEditorService,
|
|
63
|
-
[resolverService_1.ITextModelService.toString()]: textModelService,
|
|
64
|
-
[contextkey_1.IContextKeyService.toString()]: contextKeyService,
|
|
65
|
-
[contextView_1.IContextMenuService.toString()]: contextMenuService,
|
|
66
|
-
});
|
|
67
|
-
// Monaco registers certain quick access providers (e.g. QuickCommandAccess) at import time, but we want to use our own.
|
|
68
|
-
this.quickAccessRegistry.clear();
|
|
69
|
-
/**
|
|
70
|
-
* @monaco-uplift.Should be guaranteed to work.
|
|
71
|
-
* Incomparable enums prevent TypeScript from believing that public ITextModel satisfied private ITextModel
|
|
72
|
-
*/
|
|
73
|
-
(0, suggest_1.setSnippetSuggestSupport)(this.snippetSuggestProvider);
|
|
74
|
-
for (const language of monaco.languages.getLanguages()) {
|
|
75
|
-
this.preferenceSchema.registerOverrideIdentifier(language.id);
|
|
76
|
-
}
|
|
77
|
-
const registerLanguage = monaco.languages.register.bind(monaco.languages);
|
|
78
|
-
monaco.languages.register = language => {
|
|
79
|
-
// first register override identifier, because monaco will immediately update already opened documents and then initialize with bad preferences.
|
|
80
|
-
this.preferenceSchema.registerOverrideIdentifier(language.id);
|
|
81
|
-
registerLanguage(language);
|
|
82
|
-
};
|
|
83
|
-
this.monacoThemingService.initialize();
|
|
84
|
-
}
|
|
85
|
-
initialize() { }
|
|
86
|
-
registerThemeStyle(theme, collector) {
|
|
87
|
-
if ((0, theme_1.isHighContrast)(theme.type)) {
|
|
88
|
-
const focusBorder = theme.getColor('focusBorder');
|
|
89
|
-
const contrastBorder = theme.getColor('contrastBorder');
|
|
90
|
-
if (focusBorder) {
|
|
91
|
-
// Quick input
|
|
92
|
-
collector.addRule(`
|
|
93
|
-
.quick-input-list .monaco-list-row {
|
|
94
|
-
outline-offset: -1px;
|
|
95
|
-
}
|
|
96
|
-
.quick-input-list .monaco-list-row.focused {
|
|
97
|
-
outline: 1px dotted ${focusBorder};
|
|
98
|
-
}
|
|
99
|
-
.quick-input-list .monaco-list-row:hover {
|
|
100
|
-
outline: 1px dashed ${focusBorder};
|
|
101
|
-
}
|
|
102
|
-
`);
|
|
103
|
-
// Input box always displays an outline, even when unfocused
|
|
104
|
-
collector.addRule(`
|
|
105
|
-
.monaco-editor .find-widget .monaco-inputbox {
|
|
106
|
-
outline: var(--theia-border-width) solid;
|
|
107
|
-
outline-offset: calc(-1 * var(--theia-border-width));
|
|
108
|
-
outline-color: var(--theia-focusBorder);
|
|
109
|
-
}
|
|
110
|
-
`);
|
|
111
|
-
}
|
|
112
|
-
if (contrastBorder) {
|
|
113
|
-
collector.addRule(`
|
|
114
|
-
.quick-input-widget {
|
|
115
|
-
outline: 1px solid ${contrastBorder};
|
|
116
|
-
outline-offset: -1px;
|
|
117
|
-
}
|
|
118
|
-
`);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
collector.addRule(`
|
|
123
|
-
.quick-input-widget {
|
|
124
|
-
box-shadow: rgb(0 0 0 / 36%) 0px 0px 8px 2px;
|
|
125
|
-
}
|
|
126
|
-
`);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* For reasons that are unclear, while most preferences that apply in editors are validated, a few are not.
|
|
131
|
-
* There is a utility in `examples/api-samples/src/browser/monaco-editor-preferences/monaco-editor-preference-extractor.ts` to help determine which are not.
|
|
132
|
-
* Check `src/vs/editor/common/config/editorOptions.ts` for constructor arguments and to make sure that the preference names used to extract constructors are still accurate.
|
|
133
|
-
*/
|
|
134
|
-
addAdditionalPreferenceValidations() {
|
|
135
|
-
let editorIntConstructor;
|
|
136
|
-
let editorBoolConstructor;
|
|
137
|
-
let editorStringEnumConstructor;
|
|
138
|
-
for (const validator of editorOptions_1.editorOptionsRegistry) {
|
|
139
|
-
/* eslint-disable @typescript-eslint/no-explicit-any,max-len */
|
|
140
|
-
if (editorIntConstructor && editorBoolConstructor && editorStringEnumConstructor) {
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
if (validator.name === 'acceptSuggestionOnCommitCharacter') {
|
|
144
|
-
editorBoolConstructor = validator.constructor;
|
|
145
|
-
}
|
|
146
|
-
else if (validator.name === 'acceptSuggestionOnEnter') {
|
|
147
|
-
editorStringEnumConstructor = validator.constructor;
|
|
148
|
-
}
|
|
149
|
-
else if (validator.name === 'accessibilityPageSize') {
|
|
150
|
-
editorIntConstructor = validator.constructor;
|
|
151
|
-
}
|
|
152
|
-
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
153
|
-
}
|
|
154
|
-
if (editorIntConstructor && editorBoolConstructor && editorStringEnumConstructor) {
|
|
155
|
-
let id = 200; // Needs to be bigger than the biggest index in the EditorOption enum.
|
|
156
|
-
editorOptions_1.editorOptionsRegistry.push(new editorIntConstructor(id++, 'tabSize', 4, 1, core_1.MAX_SAFE_INTEGER, editor_generated_preference_schema_1.editorGeneratedPreferenceProperties['editor.tabSize']), new editorBoolConstructor(id++, 'insertSpaces', true, editor_generated_preference_schema_1.editorGeneratedPreferenceProperties['editor.insertSpaces']), new editorBoolConstructor(id++, 'detectIndentation', true, editor_generated_preference_schema_1.editorGeneratedPreferenceProperties['editor.detectIndentation']), new editorBoolConstructor(id++, 'trimAutoWhitespace', true, editor_generated_preference_schema_1.editorGeneratedPreferenceProperties['editor.trimAutoWhitespace']), new editorBoolConstructor(id++, 'largeFileOptimizations', true, editor_generated_preference_schema_1.editorGeneratedPreferenceProperties['editor.largeFileOptimizations']), new editorBoolConstructor(id++, 'wordBasedSuggestions', true, editor_generated_preference_schema_1.editorGeneratedPreferenceProperties['editor.wordBasedSuggestions']), new editorStringEnumConstructor(id++, 'wordBasedSuggestionsMode', 'matchingDocuments', editor_generated_preference_schema_1.editorGeneratedPreferenceProperties['editor.wordBasedSuggestionsMode'].enum, editor_generated_preference_schema_1.editorGeneratedPreferenceProperties['editor.wordBasedSuggestionsMode']), new editorBoolConstructor(id++, 'stablePeek', false, editor_generated_preference_schema_1.editorGeneratedPreferenceProperties['editor.stablePeek']), new editorIntConstructor(id++, 'maxTokenizationLineLength', 20000, 1, core_1.MAX_SAFE_INTEGER, editor_generated_preference_schema_1.editorGeneratedPreferenceProperties['editor.maxTokenizationLineLength']));
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
__decorate([
|
|
161
|
-
(0, inversify_1.inject)(monaco_editor_service_1.MonacoEditorService),
|
|
162
|
-
__metadata("design:type", monaco_editor_service_1.MonacoEditorService)
|
|
163
|
-
], MonacoFrontendApplicationContribution.prototype, "codeEditorService", void 0);
|
|
164
|
-
__decorate([
|
|
165
|
-
(0, inversify_1.inject)(monaco_text_model_service_1.MonacoTextModelService),
|
|
166
|
-
__metadata("design:type", monaco_text_model_service_1.MonacoTextModelService)
|
|
167
|
-
], MonacoFrontendApplicationContribution.prototype, "textModelService", void 0);
|
|
168
|
-
__decorate([
|
|
169
|
-
(0, inversify_1.inject)(contextKeyService_1.ContextKeyService),
|
|
170
|
-
__metadata("design:type", contextKeyService_1.ContextKeyService)
|
|
171
|
-
], MonacoFrontendApplicationContribution.prototype, "contextKeyService", void 0);
|
|
172
|
-
__decorate([
|
|
173
|
-
(0, inversify_1.inject)(monaco_snippet_suggest_provider_1.MonacoSnippetSuggestProvider),
|
|
174
|
-
__metadata("design:type", monaco_snippet_suggest_provider_1.MonacoSnippetSuggestProvider)
|
|
175
|
-
], MonacoFrontendApplicationContribution.prototype, "snippetSuggestProvider", void 0);
|
|
176
|
-
__decorate([
|
|
177
|
-
(0, inversify_1.inject)(browser_1.PreferenceSchemaProvider),
|
|
178
|
-
__metadata("design:type", browser_1.PreferenceSchemaProvider)
|
|
179
|
-
], MonacoFrontendApplicationContribution.prototype, "preferenceSchema", void 0);
|
|
180
|
-
__decorate([
|
|
181
|
-
(0, inversify_1.inject)(browser_1.QuickAccessRegistry),
|
|
182
|
-
__metadata("design:type", Object)
|
|
183
|
-
], MonacoFrontendApplicationContribution.prototype, "quickAccessRegistry", void 0);
|
|
184
|
-
__decorate([
|
|
185
|
-
(0, inversify_1.inject)(monaco_context_menu_1.MonacoContextMenuService),
|
|
186
|
-
__metadata("design:type", monaco_context_menu_1.MonacoContextMenuService)
|
|
187
|
-
], MonacoFrontendApplicationContribution.prototype, "contextMenuService", void 0);
|
|
188
|
-
__decorate([
|
|
189
|
-
(0, inversify_1.inject)(monaco_theming_service_1.MonacoThemingService),
|
|
190
|
-
__metadata("design:type", monaco_theming_service_1.MonacoThemingService)
|
|
191
|
-
], MonacoFrontendApplicationContribution.prototype, "monacoThemingService", void 0);
|
|
192
|
-
__decorate([
|
|
193
|
-
(0, inversify_1.postConstruct)(),
|
|
194
|
-
__metadata("design:type", Function),
|
|
195
|
-
__metadata("design:paramtypes", []),
|
|
196
|
-
__metadata("design:returntype", void 0)
|
|
197
|
-
], MonacoFrontendApplicationContribution.prototype, "init", null);
|
|
198
|
-
MonacoFrontendApplicationContribution = __decorate([
|
|
199
|
-
(0, inversify_1.injectable)()
|
|
200
|
-
], MonacoFrontendApplicationContribution);
|
|
201
|
-
exports.MonacoFrontendApplicationContribution = MonacoFrontendApplicationContribution;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2018 Ericsson 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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.MonacoFrontendApplicationContribution = void 0;
|
|
28
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
29
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
30
|
+
const monaco_snippet_suggest_provider_1 = require("./monaco-snippet-suggest-provider");
|
|
31
|
+
const monaco = require("@theia/monaco-editor-core");
|
|
32
|
+
const suggest_1 = require("@theia/monaco-editor-core/esm/vs/editor/contrib/suggest/browser/suggest");
|
|
33
|
+
const monaco_editor_service_1 = require("./monaco-editor-service");
|
|
34
|
+
const monaco_text_model_service_1 = require("./monaco-text-model-service");
|
|
35
|
+
const contextKeyService_1 = require("@theia/monaco-editor-core/esm/vs/platform/contextkey/browser/contextKeyService");
|
|
36
|
+
const standaloneServices_1 = require("@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices");
|
|
37
|
+
const codeEditorService_1 = require("@theia/monaco-editor-core/esm/vs/editor/browser/services/codeEditorService");
|
|
38
|
+
const resolverService_1 = require("@theia/monaco-editor-core/esm/vs/editor/common/services/resolverService");
|
|
39
|
+
const contextkey_1 = require("@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey");
|
|
40
|
+
const contextView_1 = require("@theia/monaco-editor-core/esm/vs/platform/contextview/browser/contextView");
|
|
41
|
+
const monaco_context_menu_1 = require("./monaco-context-menu");
|
|
42
|
+
const monaco_theming_service_1 = require("./monaco-theming-service");
|
|
43
|
+
const theme_1 = require("@theia/core/lib/common/theme");
|
|
44
|
+
const editorOptions_1 = require("@theia/monaco-editor-core/esm/vs/editor/common/config/editorOptions");
|
|
45
|
+
const core_1 = require("@theia/core");
|
|
46
|
+
const editor_generated_preference_schema_1 = require("@theia/editor/lib/browser/editor-generated-preference-schema");
|
|
47
|
+
let theiaDidInitialize = false;
|
|
48
|
+
const originalInitialize = standaloneServices_1.StandaloneServices.initialize;
|
|
49
|
+
standaloneServices_1.StandaloneServices.initialize = overrides => {
|
|
50
|
+
if (!theiaDidInitialize) {
|
|
51
|
+
console.warn('Monaco was initialized before overrides were installed by Theia\'s initialization.'
|
|
52
|
+
+ ' Please check the lifecycle of services that use Monaco and ensure that Monaco entities are not instantiated before Theia is initialized.', new Error());
|
|
53
|
+
}
|
|
54
|
+
return originalInitialize(overrides);
|
|
55
|
+
};
|
|
56
|
+
let MonacoFrontendApplicationContribution = class MonacoFrontendApplicationContribution {
|
|
57
|
+
init() {
|
|
58
|
+
this.addAdditionalPreferenceValidations();
|
|
59
|
+
const { codeEditorService, textModelService, contextKeyService, contextMenuService } = this;
|
|
60
|
+
theiaDidInitialize = true;
|
|
61
|
+
standaloneServices_1.StandaloneServices.initialize({
|
|
62
|
+
[codeEditorService_1.ICodeEditorService.toString()]: codeEditorService,
|
|
63
|
+
[resolverService_1.ITextModelService.toString()]: textModelService,
|
|
64
|
+
[contextkey_1.IContextKeyService.toString()]: contextKeyService,
|
|
65
|
+
[contextView_1.IContextMenuService.toString()]: contextMenuService,
|
|
66
|
+
});
|
|
67
|
+
// Monaco registers certain quick access providers (e.g. QuickCommandAccess) at import time, but we want to use our own.
|
|
68
|
+
this.quickAccessRegistry.clear();
|
|
69
|
+
/**
|
|
70
|
+
* @monaco-uplift.Should be guaranteed to work.
|
|
71
|
+
* Incomparable enums prevent TypeScript from believing that public ITextModel satisfied private ITextModel
|
|
72
|
+
*/
|
|
73
|
+
(0, suggest_1.setSnippetSuggestSupport)(this.snippetSuggestProvider);
|
|
74
|
+
for (const language of monaco.languages.getLanguages()) {
|
|
75
|
+
this.preferenceSchema.registerOverrideIdentifier(language.id);
|
|
76
|
+
}
|
|
77
|
+
const registerLanguage = monaco.languages.register.bind(monaco.languages);
|
|
78
|
+
monaco.languages.register = language => {
|
|
79
|
+
// first register override identifier, because monaco will immediately update already opened documents and then initialize with bad preferences.
|
|
80
|
+
this.preferenceSchema.registerOverrideIdentifier(language.id);
|
|
81
|
+
registerLanguage(language);
|
|
82
|
+
};
|
|
83
|
+
this.monacoThemingService.initialize();
|
|
84
|
+
}
|
|
85
|
+
initialize() { }
|
|
86
|
+
registerThemeStyle(theme, collector) {
|
|
87
|
+
if ((0, theme_1.isHighContrast)(theme.type)) {
|
|
88
|
+
const focusBorder = theme.getColor('focusBorder');
|
|
89
|
+
const contrastBorder = theme.getColor('contrastBorder');
|
|
90
|
+
if (focusBorder) {
|
|
91
|
+
// Quick input
|
|
92
|
+
collector.addRule(`
|
|
93
|
+
.quick-input-list .monaco-list-row {
|
|
94
|
+
outline-offset: -1px;
|
|
95
|
+
}
|
|
96
|
+
.quick-input-list .monaco-list-row.focused {
|
|
97
|
+
outline: 1px dotted ${focusBorder};
|
|
98
|
+
}
|
|
99
|
+
.quick-input-list .monaco-list-row:hover {
|
|
100
|
+
outline: 1px dashed ${focusBorder};
|
|
101
|
+
}
|
|
102
|
+
`);
|
|
103
|
+
// Input box always displays an outline, even when unfocused
|
|
104
|
+
collector.addRule(`
|
|
105
|
+
.monaco-editor .find-widget .monaco-inputbox {
|
|
106
|
+
outline: var(--theia-border-width) solid;
|
|
107
|
+
outline-offset: calc(-1 * var(--theia-border-width));
|
|
108
|
+
outline-color: var(--theia-focusBorder);
|
|
109
|
+
}
|
|
110
|
+
`);
|
|
111
|
+
}
|
|
112
|
+
if (contrastBorder) {
|
|
113
|
+
collector.addRule(`
|
|
114
|
+
.quick-input-widget {
|
|
115
|
+
outline: 1px solid ${contrastBorder};
|
|
116
|
+
outline-offset: -1px;
|
|
117
|
+
}
|
|
118
|
+
`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
collector.addRule(`
|
|
123
|
+
.quick-input-widget {
|
|
124
|
+
box-shadow: rgb(0 0 0 / 36%) 0px 0px 8px 2px;
|
|
125
|
+
}
|
|
126
|
+
`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* For reasons that are unclear, while most preferences that apply in editors are validated, a few are not.
|
|
131
|
+
* There is a utility in `examples/api-samples/src/browser/monaco-editor-preferences/monaco-editor-preference-extractor.ts` to help determine which are not.
|
|
132
|
+
* Check `src/vs/editor/common/config/editorOptions.ts` for constructor arguments and to make sure that the preference names used to extract constructors are still accurate.
|
|
133
|
+
*/
|
|
134
|
+
addAdditionalPreferenceValidations() {
|
|
135
|
+
let editorIntConstructor;
|
|
136
|
+
let editorBoolConstructor;
|
|
137
|
+
let editorStringEnumConstructor;
|
|
138
|
+
for (const validator of editorOptions_1.editorOptionsRegistry) {
|
|
139
|
+
/* eslint-disable @typescript-eslint/no-explicit-any,max-len */
|
|
140
|
+
if (editorIntConstructor && editorBoolConstructor && editorStringEnumConstructor) {
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
if (validator.name === 'acceptSuggestionOnCommitCharacter') {
|
|
144
|
+
editorBoolConstructor = validator.constructor;
|
|
145
|
+
}
|
|
146
|
+
else if (validator.name === 'acceptSuggestionOnEnter') {
|
|
147
|
+
editorStringEnumConstructor = validator.constructor;
|
|
148
|
+
}
|
|
149
|
+
else if (validator.name === 'accessibilityPageSize') {
|
|
150
|
+
editorIntConstructor = validator.constructor;
|
|
151
|
+
}
|
|
152
|
+
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
153
|
+
}
|
|
154
|
+
if (editorIntConstructor && editorBoolConstructor && editorStringEnumConstructor) {
|
|
155
|
+
let id = 200; // Needs to be bigger than the biggest index in the EditorOption enum.
|
|
156
|
+
editorOptions_1.editorOptionsRegistry.push(new editorIntConstructor(id++, 'tabSize', 4, 1, core_1.MAX_SAFE_INTEGER, editor_generated_preference_schema_1.editorGeneratedPreferenceProperties['editor.tabSize']), new editorBoolConstructor(id++, 'insertSpaces', true, editor_generated_preference_schema_1.editorGeneratedPreferenceProperties['editor.insertSpaces']), new editorBoolConstructor(id++, 'detectIndentation', true, editor_generated_preference_schema_1.editorGeneratedPreferenceProperties['editor.detectIndentation']), new editorBoolConstructor(id++, 'trimAutoWhitespace', true, editor_generated_preference_schema_1.editorGeneratedPreferenceProperties['editor.trimAutoWhitespace']), new editorBoolConstructor(id++, 'largeFileOptimizations', true, editor_generated_preference_schema_1.editorGeneratedPreferenceProperties['editor.largeFileOptimizations']), new editorBoolConstructor(id++, 'wordBasedSuggestions', true, editor_generated_preference_schema_1.editorGeneratedPreferenceProperties['editor.wordBasedSuggestions']), new editorStringEnumConstructor(id++, 'wordBasedSuggestionsMode', 'matchingDocuments', editor_generated_preference_schema_1.editorGeneratedPreferenceProperties['editor.wordBasedSuggestionsMode'].enum, editor_generated_preference_schema_1.editorGeneratedPreferenceProperties['editor.wordBasedSuggestionsMode']), new editorBoolConstructor(id++, 'stablePeek', false, editor_generated_preference_schema_1.editorGeneratedPreferenceProperties['editor.stablePeek']), new editorIntConstructor(id++, 'maxTokenizationLineLength', 20000, 1, core_1.MAX_SAFE_INTEGER, editor_generated_preference_schema_1.editorGeneratedPreferenceProperties['editor.maxTokenizationLineLength']));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
__decorate([
|
|
161
|
+
(0, inversify_1.inject)(monaco_editor_service_1.MonacoEditorService),
|
|
162
|
+
__metadata("design:type", monaco_editor_service_1.MonacoEditorService)
|
|
163
|
+
], MonacoFrontendApplicationContribution.prototype, "codeEditorService", void 0);
|
|
164
|
+
__decorate([
|
|
165
|
+
(0, inversify_1.inject)(monaco_text_model_service_1.MonacoTextModelService),
|
|
166
|
+
__metadata("design:type", monaco_text_model_service_1.MonacoTextModelService)
|
|
167
|
+
], MonacoFrontendApplicationContribution.prototype, "textModelService", void 0);
|
|
168
|
+
__decorate([
|
|
169
|
+
(0, inversify_1.inject)(contextKeyService_1.ContextKeyService),
|
|
170
|
+
__metadata("design:type", contextKeyService_1.ContextKeyService)
|
|
171
|
+
], MonacoFrontendApplicationContribution.prototype, "contextKeyService", void 0);
|
|
172
|
+
__decorate([
|
|
173
|
+
(0, inversify_1.inject)(monaco_snippet_suggest_provider_1.MonacoSnippetSuggestProvider),
|
|
174
|
+
__metadata("design:type", monaco_snippet_suggest_provider_1.MonacoSnippetSuggestProvider)
|
|
175
|
+
], MonacoFrontendApplicationContribution.prototype, "snippetSuggestProvider", void 0);
|
|
176
|
+
__decorate([
|
|
177
|
+
(0, inversify_1.inject)(browser_1.PreferenceSchemaProvider),
|
|
178
|
+
__metadata("design:type", browser_1.PreferenceSchemaProvider)
|
|
179
|
+
], MonacoFrontendApplicationContribution.prototype, "preferenceSchema", void 0);
|
|
180
|
+
__decorate([
|
|
181
|
+
(0, inversify_1.inject)(browser_1.QuickAccessRegistry),
|
|
182
|
+
__metadata("design:type", Object)
|
|
183
|
+
], MonacoFrontendApplicationContribution.prototype, "quickAccessRegistry", void 0);
|
|
184
|
+
__decorate([
|
|
185
|
+
(0, inversify_1.inject)(monaco_context_menu_1.MonacoContextMenuService),
|
|
186
|
+
__metadata("design:type", monaco_context_menu_1.MonacoContextMenuService)
|
|
187
|
+
], MonacoFrontendApplicationContribution.prototype, "contextMenuService", void 0);
|
|
188
|
+
__decorate([
|
|
189
|
+
(0, inversify_1.inject)(monaco_theming_service_1.MonacoThemingService),
|
|
190
|
+
__metadata("design:type", monaco_theming_service_1.MonacoThemingService)
|
|
191
|
+
], MonacoFrontendApplicationContribution.prototype, "monacoThemingService", void 0);
|
|
192
|
+
__decorate([
|
|
193
|
+
(0, inversify_1.postConstruct)(),
|
|
194
|
+
__metadata("design:type", Function),
|
|
195
|
+
__metadata("design:paramtypes", []),
|
|
196
|
+
__metadata("design:returntype", void 0)
|
|
197
|
+
], MonacoFrontendApplicationContribution.prototype, "init", null);
|
|
198
|
+
MonacoFrontendApplicationContribution = __decorate([
|
|
199
|
+
(0, inversify_1.injectable)()
|
|
200
|
+
], MonacoFrontendApplicationContribution);
|
|
201
|
+
exports.MonacoFrontendApplicationContribution = MonacoFrontendApplicationContribution;
|
|
202
202
|
//# sourceMappingURL=monaco-frontend-application-contribution.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import '../../src/browser/style/index.css';
|
|
2
|
-
import { ContainerModule, interfaces } from '@theia/core/shared/inversify';
|
|
3
|
-
import { IConfigurationService } from '@theia/monaco-editor-core/esm/vs/platform/configuration/common/configuration';
|
|
4
|
-
declare const _default: ContainerModule;
|
|
5
|
-
export default _default;
|
|
6
|
-
export declare const MonacoConfigurationService: unique symbol;
|
|
7
|
-
export declare function createMonacoConfigurationService(container: interfaces.Container): IConfigurationService;
|
|
1
|
+
import '../../src/browser/style/index.css';
|
|
2
|
+
import { ContainerModule, interfaces } from '@theia/core/shared/inversify';
|
|
3
|
+
import { IConfigurationService } from '@theia/monaco-editor-core/esm/vs/platform/configuration/common/configuration';
|
|
4
|
+
declare const _default: ContainerModule;
|
|
5
|
+
export default _default;
|
|
6
|
+
export declare const MonacoConfigurationService: unique symbol;
|
|
7
|
+
export declare function createMonacoConfigurationService(container: interfaces.Container): IConfigurationService;
|
|
8
8
|
//# sourceMappingURL=monaco-frontend-module.d.ts.map
|