@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,32 +1,32 @@
|
|
|
1
|
-
import { Position, Range, Location, TextEdit, Diagnostic, DiagnosticRelatedInformation } from '@theia/core/shared/vscode-languageserver-protocol';
|
|
2
|
-
import { RecursivePartial } from '@theia/core/lib/common/types';
|
|
3
|
-
import * as monaco from '@theia/monaco-editor-core';
|
|
4
|
-
export declare class ProtocolToMonacoConverter {
|
|
5
|
-
asRange(range: undefined): undefined;
|
|
6
|
-
asRange(range: Range): monaco.Range;
|
|
7
|
-
asRange(range: Range | undefined): monaco.Range | undefined;
|
|
8
|
-
asRange(range: RecursivePartial<Range>): Partial<monaco.IRange>;
|
|
9
|
-
asRange(range: RecursivePartial<Range> | undefined): monaco.Range | Partial<monaco.IRange> | undefined;
|
|
10
|
-
asPosition(position: undefined): undefined;
|
|
11
|
-
asPosition(position: Position): monaco.Position;
|
|
12
|
-
asPosition(position: Position | undefined): monaco.Position | undefined;
|
|
13
|
-
asPosition(position: Partial<Position>): Partial<monaco.IPosition>;
|
|
14
|
-
asPosition(position: Partial<Position> | undefined): monaco.Position | Partial<monaco.IPosition> | undefined;
|
|
15
|
-
asLocation(item: Location): monaco.languages.Location;
|
|
16
|
-
asLocation(item: undefined): undefined;
|
|
17
|
-
asLocation(item: Location | undefined): monaco.languages.Location | undefined;
|
|
18
|
-
asTextEdit(edit: TextEdit): monaco.languages.TextEdit;
|
|
19
|
-
asTextEdit(edit: undefined): undefined;
|
|
20
|
-
asTextEdit(edit: TextEdit | undefined): undefined;
|
|
21
|
-
asTextEdits(items: TextEdit[]): monaco.languages.TextEdit[];
|
|
22
|
-
asTextEdits(items: undefined): undefined;
|
|
23
|
-
asTextEdits(items: TextEdit[] | undefined): monaco.languages.TextEdit[] | undefined;
|
|
24
|
-
asSeverity(severity?: number): monaco.MarkerSeverity;
|
|
25
|
-
asDiagnostics(diagnostics: undefined): undefined;
|
|
26
|
-
asDiagnostics(diagnostics: Diagnostic[]): monaco.editor.IMarkerData[];
|
|
27
|
-
asDiagnostics(diagnostics: Diagnostic[] | undefined): monaco.editor.IMarkerData[] | undefined;
|
|
28
|
-
asDiagnostic(diagnostic: Diagnostic): monaco.editor.IMarkerData;
|
|
29
|
-
asRelatedInformations(relatedInformation?: DiagnosticRelatedInformation[]): monaco.editor.IRelatedInformation[] | undefined;
|
|
30
|
-
asRelatedInformation(relatedInformation: DiagnosticRelatedInformation): monaco.editor.IRelatedInformation;
|
|
31
|
-
}
|
|
1
|
+
import { Position, Range, Location, TextEdit, Diagnostic, DiagnosticRelatedInformation } from '@theia/core/shared/vscode-languageserver-protocol';
|
|
2
|
+
import { RecursivePartial } from '@theia/core/lib/common/types';
|
|
3
|
+
import * as monaco from '@theia/monaco-editor-core';
|
|
4
|
+
export declare class ProtocolToMonacoConverter {
|
|
5
|
+
asRange(range: undefined): undefined;
|
|
6
|
+
asRange(range: Range): monaco.Range;
|
|
7
|
+
asRange(range: Range | undefined): monaco.Range | undefined;
|
|
8
|
+
asRange(range: RecursivePartial<Range>): Partial<monaco.IRange>;
|
|
9
|
+
asRange(range: RecursivePartial<Range> | undefined): monaco.Range | Partial<monaco.IRange> | undefined;
|
|
10
|
+
asPosition(position: undefined): undefined;
|
|
11
|
+
asPosition(position: Position): monaco.Position;
|
|
12
|
+
asPosition(position: Position | undefined): monaco.Position | undefined;
|
|
13
|
+
asPosition(position: Partial<Position>): Partial<monaco.IPosition>;
|
|
14
|
+
asPosition(position: Partial<Position> | undefined): monaco.Position | Partial<monaco.IPosition> | undefined;
|
|
15
|
+
asLocation(item: Location): monaco.languages.Location;
|
|
16
|
+
asLocation(item: undefined): undefined;
|
|
17
|
+
asLocation(item: Location | undefined): monaco.languages.Location | undefined;
|
|
18
|
+
asTextEdit(edit: TextEdit): monaco.languages.TextEdit;
|
|
19
|
+
asTextEdit(edit: undefined): undefined;
|
|
20
|
+
asTextEdit(edit: TextEdit | undefined): undefined;
|
|
21
|
+
asTextEdits(items: TextEdit[]): monaco.languages.TextEdit[];
|
|
22
|
+
asTextEdits(items: undefined): undefined;
|
|
23
|
+
asTextEdits(items: TextEdit[] | undefined): monaco.languages.TextEdit[] | undefined;
|
|
24
|
+
asSeverity(severity?: number): monaco.MarkerSeverity;
|
|
25
|
+
asDiagnostics(diagnostics: undefined): undefined;
|
|
26
|
+
asDiagnostics(diagnostics: Diagnostic[]): monaco.editor.IMarkerData[];
|
|
27
|
+
asDiagnostics(diagnostics: Diagnostic[] | undefined): monaco.editor.IMarkerData[] | undefined;
|
|
28
|
+
asDiagnostic(diagnostic: Diagnostic): monaco.editor.IMarkerData;
|
|
29
|
+
asRelatedInformations(relatedInformation?: DiagnosticRelatedInformation[]): monaco.editor.IRelatedInformation[] | undefined;
|
|
30
|
+
asRelatedInformation(relatedInformation: DiagnosticRelatedInformation): monaco.editor.IRelatedInformation;
|
|
31
|
+
}
|
|
32
32
|
//# sourceMappingURL=protocol-to-monaco-converter.d.ts.map
|
|
@@ -1,134 +1,134 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2020 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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.ProtocolToMonacoConverter = void 0;
|
|
25
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
26
|
-
const monaco = require("@theia/monaco-editor-core");
|
|
27
|
-
let ProtocolToMonacoConverter = class ProtocolToMonacoConverter {
|
|
28
|
-
asRange(range) {
|
|
29
|
-
if (range === undefined) {
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
const start = this.asPosition(range.start);
|
|
33
|
-
const end = this.asPosition(range.end);
|
|
34
|
-
if (start instanceof monaco.Position && end instanceof monaco.Position) {
|
|
35
|
-
return new monaco.Range(start.lineNumber, start.column, end.lineNumber, end.column);
|
|
36
|
-
}
|
|
37
|
-
const startLineNumber = !start || start.lineNumber === undefined ? undefined : start.lineNumber;
|
|
38
|
-
const startColumn = !start || start.column === undefined ? undefined : start.column;
|
|
39
|
-
const endLineNumber = !end || end.lineNumber === undefined ? undefined : end.lineNumber;
|
|
40
|
-
const endColumn = !end || end.column === undefined ? undefined : end.column;
|
|
41
|
-
return { startLineNumber, startColumn, endLineNumber, endColumn };
|
|
42
|
-
}
|
|
43
|
-
asPosition(position) {
|
|
44
|
-
if (position === undefined) {
|
|
45
|
-
return undefined;
|
|
46
|
-
}
|
|
47
|
-
const { line, character } = position;
|
|
48
|
-
const lineNumber = line === undefined ? undefined : line + 1;
|
|
49
|
-
const column = character === undefined ? undefined : character + 1;
|
|
50
|
-
if (lineNumber !== undefined && column !== undefined) {
|
|
51
|
-
return new monaco.Position(lineNumber, column);
|
|
52
|
-
}
|
|
53
|
-
return { lineNumber, column };
|
|
54
|
-
}
|
|
55
|
-
asLocation(item) {
|
|
56
|
-
if (!item) {
|
|
57
|
-
return undefined;
|
|
58
|
-
}
|
|
59
|
-
const uri = monaco.Uri.parse(item.uri);
|
|
60
|
-
const range = this.asRange(item.range);
|
|
61
|
-
return {
|
|
62
|
-
uri, range
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
asTextEdit(edit) {
|
|
66
|
-
if (!edit) {
|
|
67
|
-
return undefined;
|
|
68
|
-
}
|
|
69
|
-
const range = this.asRange(edit.range);
|
|
70
|
-
return {
|
|
71
|
-
range,
|
|
72
|
-
text: edit.newText
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
asTextEdits(items) {
|
|
76
|
-
if (!items) {
|
|
77
|
-
return undefined;
|
|
78
|
-
}
|
|
79
|
-
return items.map(item => this.asTextEdit(item));
|
|
80
|
-
}
|
|
81
|
-
asSeverity(severity) {
|
|
82
|
-
if (severity === 1) {
|
|
83
|
-
return monaco.MarkerSeverity.Error;
|
|
84
|
-
}
|
|
85
|
-
if (severity === 2) {
|
|
86
|
-
return monaco.MarkerSeverity.Warning;
|
|
87
|
-
}
|
|
88
|
-
if (severity === 3) {
|
|
89
|
-
return monaco.MarkerSeverity.Info;
|
|
90
|
-
}
|
|
91
|
-
return monaco.MarkerSeverity.Hint;
|
|
92
|
-
}
|
|
93
|
-
asDiagnostics(diagnostics) {
|
|
94
|
-
if (!diagnostics) {
|
|
95
|
-
return undefined;
|
|
96
|
-
}
|
|
97
|
-
return diagnostics.map(diagnostic => this.asDiagnostic(diagnostic));
|
|
98
|
-
}
|
|
99
|
-
asDiagnostic(diagnostic) {
|
|
100
|
-
return {
|
|
101
|
-
code: typeof diagnostic.code === 'number' ? diagnostic.code.toString() : diagnostic.code,
|
|
102
|
-
severity: this.asSeverity(diagnostic.severity),
|
|
103
|
-
message: diagnostic.message,
|
|
104
|
-
source: diagnostic.source,
|
|
105
|
-
startLineNumber: diagnostic.range.start.line + 1,
|
|
106
|
-
startColumn: diagnostic.range.start.character + 1,
|
|
107
|
-
endLineNumber: diagnostic.range.end.line + 1,
|
|
108
|
-
endColumn: diagnostic.range.end.character + 1,
|
|
109
|
-
relatedInformation: this.asRelatedInformations(diagnostic.relatedInformation),
|
|
110
|
-
tags: diagnostic.tags
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
asRelatedInformations(relatedInformation) {
|
|
114
|
-
if (!relatedInformation) {
|
|
115
|
-
return undefined;
|
|
116
|
-
}
|
|
117
|
-
return relatedInformation.map(item => this.asRelatedInformation(item));
|
|
118
|
-
}
|
|
119
|
-
asRelatedInformation(relatedInformation) {
|
|
120
|
-
return {
|
|
121
|
-
resource: monaco.Uri.parse(relatedInformation.location.uri),
|
|
122
|
-
startLineNumber: relatedInformation.location.range.start.line + 1,
|
|
123
|
-
startColumn: relatedInformation.location.range.start.character + 1,
|
|
124
|
-
endLineNumber: relatedInformation.location.range.end.line + 1,
|
|
125
|
-
endColumn: relatedInformation.location.range.end.character + 1,
|
|
126
|
-
message: relatedInformation.message
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
ProtocolToMonacoConverter = __decorate([
|
|
131
|
-
(0, inversify_1.injectable)()
|
|
132
|
-
], ProtocolToMonacoConverter);
|
|
133
|
-
exports.ProtocolToMonacoConverter = ProtocolToMonacoConverter;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2020 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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.ProtocolToMonacoConverter = void 0;
|
|
25
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
26
|
+
const monaco = require("@theia/monaco-editor-core");
|
|
27
|
+
let ProtocolToMonacoConverter = class ProtocolToMonacoConverter {
|
|
28
|
+
asRange(range) {
|
|
29
|
+
if (range === undefined) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
const start = this.asPosition(range.start);
|
|
33
|
+
const end = this.asPosition(range.end);
|
|
34
|
+
if (start instanceof monaco.Position && end instanceof monaco.Position) {
|
|
35
|
+
return new monaco.Range(start.lineNumber, start.column, end.lineNumber, end.column);
|
|
36
|
+
}
|
|
37
|
+
const startLineNumber = !start || start.lineNumber === undefined ? undefined : start.lineNumber;
|
|
38
|
+
const startColumn = !start || start.column === undefined ? undefined : start.column;
|
|
39
|
+
const endLineNumber = !end || end.lineNumber === undefined ? undefined : end.lineNumber;
|
|
40
|
+
const endColumn = !end || end.column === undefined ? undefined : end.column;
|
|
41
|
+
return { startLineNumber, startColumn, endLineNumber, endColumn };
|
|
42
|
+
}
|
|
43
|
+
asPosition(position) {
|
|
44
|
+
if (position === undefined) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
const { line, character } = position;
|
|
48
|
+
const lineNumber = line === undefined ? undefined : line + 1;
|
|
49
|
+
const column = character === undefined ? undefined : character + 1;
|
|
50
|
+
if (lineNumber !== undefined && column !== undefined) {
|
|
51
|
+
return new monaco.Position(lineNumber, column);
|
|
52
|
+
}
|
|
53
|
+
return { lineNumber, column };
|
|
54
|
+
}
|
|
55
|
+
asLocation(item) {
|
|
56
|
+
if (!item) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
const uri = monaco.Uri.parse(item.uri);
|
|
60
|
+
const range = this.asRange(item.range);
|
|
61
|
+
return {
|
|
62
|
+
uri, range
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
asTextEdit(edit) {
|
|
66
|
+
if (!edit) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
const range = this.asRange(edit.range);
|
|
70
|
+
return {
|
|
71
|
+
range,
|
|
72
|
+
text: edit.newText
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
asTextEdits(items) {
|
|
76
|
+
if (!items) {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
return items.map(item => this.asTextEdit(item));
|
|
80
|
+
}
|
|
81
|
+
asSeverity(severity) {
|
|
82
|
+
if (severity === 1) {
|
|
83
|
+
return monaco.MarkerSeverity.Error;
|
|
84
|
+
}
|
|
85
|
+
if (severity === 2) {
|
|
86
|
+
return monaco.MarkerSeverity.Warning;
|
|
87
|
+
}
|
|
88
|
+
if (severity === 3) {
|
|
89
|
+
return monaco.MarkerSeverity.Info;
|
|
90
|
+
}
|
|
91
|
+
return monaco.MarkerSeverity.Hint;
|
|
92
|
+
}
|
|
93
|
+
asDiagnostics(diagnostics) {
|
|
94
|
+
if (!diagnostics) {
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
return diagnostics.map(diagnostic => this.asDiagnostic(diagnostic));
|
|
98
|
+
}
|
|
99
|
+
asDiagnostic(diagnostic) {
|
|
100
|
+
return {
|
|
101
|
+
code: typeof diagnostic.code === 'number' ? diagnostic.code.toString() : diagnostic.code,
|
|
102
|
+
severity: this.asSeverity(diagnostic.severity),
|
|
103
|
+
message: diagnostic.message,
|
|
104
|
+
source: diagnostic.source,
|
|
105
|
+
startLineNumber: diagnostic.range.start.line + 1,
|
|
106
|
+
startColumn: diagnostic.range.start.character + 1,
|
|
107
|
+
endLineNumber: diagnostic.range.end.line + 1,
|
|
108
|
+
endColumn: diagnostic.range.end.character + 1,
|
|
109
|
+
relatedInformation: this.asRelatedInformations(diagnostic.relatedInformation),
|
|
110
|
+
tags: diagnostic.tags
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
asRelatedInformations(relatedInformation) {
|
|
114
|
+
if (!relatedInformation) {
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
return relatedInformation.map(item => this.asRelatedInformation(item));
|
|
118
|
+
}
|
|
119
|
+
asRelatedInformation(relatedInformation) {
|
|
120
|
+
return {
|
|
121
|
+
resource: monaco.Uri.parse(relatedInformation.location.uri),
|
|
122
|
+
startLineNumber: relatedInformation.location.range.start.line + 1,
|
|
123
|
+
startColumn: relatedInformation.location.range.start.character + 1,
|
|
124
|
+
endLineNumber: relatedInformation.location.range.end.line + 1,
|
|
125
|
+
endColumn: relatedInformation.location.range.end.character + 1,
|
|
126
|
+
message: relatedInformation.message
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
ProtocolToMonacoConverter = __decorate([
|
|
131
|
+
(0, inversify_1.injectable)()
|
|
132
|
+
], ProtocolToMonacoConverter);
|
|
133
|
+
exports.ProtocolToMonacoConverter = ProtocolToMonacoConverter;
|
|
134
134
|
//# sourceMappingURL=protocol-to-monaco-converter.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './textmate-registry';
|
|
2
|
-
export * from './textmate-contribution';
|
|
3
|
-
export * from './monaco-textmate-service';
|
|
4
|
-
export * from './monaco-textmate-frontend-bindings';
|
|
1
|
+
export * from './textmate-registry';
|
|
2
|
+
export * from './textmate-contribution';
|
|
3
|
+
export * from './monaco-textmate-service';
|
|
4
|
+
export * from './monaco-textmate-frontend-bindings';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,32 +1,32 @@
|
|
|
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
25
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26
|
-
};
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
__exportStar(require("./textmate-registry"), exports);
|
|
29
|
-
__exportStar(require("./textmate-contribution"), exports);
|
|
30
|
-
__exportStar(require("./monaco-textmate-service"), exports);
|
|
31
|
-
__exportStar(require("./monaco-textmate-frontend-bindings"), exports);
|
|
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
25
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
__exportStar(require("./textmate-registry"), exports);
|
|
29
|
+
__exportStar(require("./textmate-contribution"), exports);
|
|
30
|
+
__exportStar(require("./monaco-textmate-service"), exports);
|
|
31
|
+
__exportStar(require("./monaco-textmate-frontend-bindings"), exports);
|
|
32
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { interfaces } from '@theia/core/shared/inversify';
|
|
2
|
-
import { OnigScanner, OnigString } from 'vscode-oniguruma';
|
|
3
|
-
import { IOnigLib } from 'vscode-textmate';
|
|
4
|
-
export declare class OnigasmLib implements IOnigLib {
|
|
5
|
-
createOnigScanner(sources: string[]): OnigScanner;
|
|
6
|
-
createOnigString(sources: string): OnigString;
|
|
7
|
-
}
|
|
8
|
-
declare const _default: (bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: interfaces.IsBound, rebind: interfaces.Rebind) => void;
|
|
9
|
-
export default _default;
|
|
10
|
-
export declare function dynamicOnigasmLib(ctx: interfaces.Context): Promise<IOnigLib>;
|
|
11
|
-
export declare function createOnigasmLib(): Promise<IOnigLib>;
|
|
12
|
-
export declare function fetchOnigasm(): Promise<ArrayBuffer>;
|
|
1
|
+
import { interfaces } from '@theia/core/shared/inversify';
|
|
2
|
+
import { OnigScanner, OnigString } from 'vscode-oniguruma';
|
|
3
|
+
import { IOnigLib } from 'vscode-textmate';
|
|
4
|
+
export declare class OnigasmLib implements IOnigLib {
|
|
5
|
+
createOnigScanner(sources: string[]): OnigScanner;
|
|
6
|
+
createOnigString(sources: string): OnigString;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: (bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: interfaces.IsBound, rebind: interfaces.Rebind) => void;
|
|
9
|
+
export default _default;
|
|
10
|
+
export declare function dynamicOnigasmLib(ctx: interfaces.Context): Promise<IOnigLib>;
|
|
11
|
+
export declare function createOnigasmLib(): Promise<IOnigLib>;
|
|
12
|
+
export declare function fetchOnigasm(): Promise<ArrayBuffer>;
|
|
13
13
|
//# sourceMappingURL=monaco-textmate-frontend-bindings.d.ts.map
|
|
@@ -1,95 +1,95 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.fetchOnigasm = exports.createOnigasmLib = exports.dynamicOnigasmLib = exports.OnigasmLib = void 0;
|
|
19
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
20
|
-
const core_1 = require("@theia/core");
|
|
21
|
-
const textmate_registry_1 = require("./textmate-registry");
|
|
22
|
-
const textmate_contribution_1 = require("./textmate-contribution");
|
|
23
|
-
const monaco_textmate_service_1 = require("./monaco-textmate-service");
|
|
24
|
-
const monaco_theme_registry_1 = require("./monaco-theme-registry");
|
|
25
|
-
const vscode_oniguruma_1 = require("vscode-oniguruma");
|
|
26
|
-
const vscode_textmate_1 = require("vscode-textmate");
|
|
27
|
-
const monaco_theme_types_1 = require("./monaco-theme-types");
|
|
28
|
-
class OnigasmLib {
|
|
29
|
-
createOnigScanner(sources) {
|
|
30
|
-
return (0, vscode_oniguruma_1.createOnigScanner)(sources);
|
|
31
|
-
}
|
|
32
|
-
createOnigString(sources) {
|
|
33
|
-
return (0, vscode_oniguruma_1.createOnigString)(sources);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.OnigasmLib = OnigasmLib;
|
|
37
|
-
exports.default = (bind, unbind, isBound, rebind) => {
|
|
38
|
-
bind(monaco_theme_types_1.OnigasmPromise).toDynamicValue(dynamicOnigasmLib).inSingletonScope();
|
|
39
|
-
bind(monaco_textmate_service_1.MonacoTextmateService).toSelf().inSingletonScope();
|
|
40
|
-
bind(browser_1.FrontendApplicationContribution).toService(monaco_textmate_service_1.MonacoTextmateService);
|
|
41
|
-
(0, core_1.bindContributionProvider)(bind, textmate_contribution_1.LanguageGrammarDefinitionContribution);
|
|
42
|
-
bind(textmate_registry_1.TextmateRegistry).toSelf().inSingletonScope();
|
|
43
|
-
bind(monaco_theme_registry_1.MonacoThemeRegistry).toSelf().inSingletonScope();
|
|
44
|
-
bind(monaco_theme_types_1.TextmateRegistryFactory).toFactory(({ container }) => (theme) => {
|
|
45
|
-
const onigLib = container.get(monaco_theme_types_1.OnigasmPromise);
|
|
46
|
-
const textmateRegistry = container.get(textmate_registry_1.TextmateRegistry);
|
|
47
|
-
return new vscode_textmate_1.Registry({
|
|
48
|
-
onigLib,
|
|
49
|
-
theme,
|
|
50
|
-
loadGrammar: async (scopeName) => {
|
|
51
|
-
const provider = textmateRegistry.getProvider(scopeName);
|
|
52
|
-
if (provider) {
|
|
53
|
-
const definition = await provider.getGrammarDefinition();
|
|
54
|
-
let rawGrammar;
|
|
55
|
-
if (typeof definition.content === 'string') {
|
|
56
|
-
rawGrammar = (0, vscode_textmate_1.parseRawGrammar)(definition.content, definition.format === 'json' ? 'grammar.json' : 'grammar.plist');
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
rawGrammar = definition.content;
|
|
60
|
-
}
|
|
61
|
-
return rawGrammar;
|
|
62
|
-
}
|
|
63
|
-
return undefined;
|
|
64
|
-
},
|
|
65
|
-
getInjections: (scopeName) => {
|
|
66
|
-
const provider = textmateRegistry.getProvider(scopeName);
|
|
67
|
-
if (provider && provider.getInjections) {
|
|
68
|
-
return provider.getInjections(scopeName);
|
|
69
|
-
}
|
|
70
|
-
return [];
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
async function dynamicOnigasmLib(ctx) {
|
|
76
|
-
return createOnigasmLib();
|
|
77
|
-
}
|
|
78
|
-
exports.dynamicOnigasmLib = dynamicOnigasmLib;
|
|
79
|
-
async function createOnigasmLib() {
|
|
80
|
-
if (!browser_1.isBasicWasmSupported) {
|
|
81
|
-
throw new Error('wasm not supported');
|
|
82
|
-
}
|
|
83
|
-
const wasm = await fetchOnigasm();
|
|
84
|
-
await (0, vscode_oniguruma_1.loadWASM)(wasm);
|
|
85
|
-
return new OnigasmLib();
|
|
86
|
-
}
|
|
87
|
-
exports.createOnigasmLib = createOnigasmLib;
|
|
88
|
-
async function fetchOnigasm() {
|
|
89
|
-
// Using Webpack's wasm loader should give us a URL to fetch the resource from:
|
|
90
|
-
const onigasmPath = require('vscode-oniguruma/release/onig.wasm');
|
|
91
|
-
const response = await fetch(onigasmPath, { method: 'GET' });
|
|
92
|
-
return response.arrayBuffer();
|
|
93
|
-
}
|
|
94
|
-
exports.fetchOnigasm = fetchOnigasm;
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.fetchOnigasm = exports.createOnigasmLib = exports.dynamicOnigasmLib = exports.OnigasmLib = void 0;
|
|
19
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
20
|
+
const core_1 = require("@theia/core");
|
|
21
|
+
const textmate_registry_1 = require("./textmate-registry");
|
|
22
|
+
const textmate_contribution_1 = require("./textmate-contribution");
|
|
23
|
+
const monaco_textmate_service_1 = require("./monaco-textmate-service");
|
|
24
|
+
const monaco_theme_registry_1 = require("./monaco-theme-registry");
|
|
25
|
+
const vscode_oniguruma_1 = require("vscode-oniguruma");
|
|
26
|
+
const vscode_textmate_1 = require("vscode-textmate");
|
|
27
|
+
const monaco_theme_types_1 = require("./monaco-theme-types");
|
|
28
|
+
class OnigasmLib {
|
|
29
|
+
createOnigScanner(sources) {
|
|
30
|
+
return (0, vscode_oniguruma_1.createOnigScanner)(sources);
|
|
31
|
+
}
|
|
32
|
+
createOnigString(sources) {
|
|
33
|
+
return (0, vscode_oniguruma_1.createOnigString)(sources);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.OnigasmLib = OnigasmLib;
|
|
37
|
+
exports.default = (bind, unbind, isBound, rebind) => {
|
|
38
|
+
bind(monaco_theme_types_1.OnigasmPromise).toDynamicValue(dynamicOnigasmLib).inSingletonScope();
|
|
39
|
+
bind(monaco_textmate_service_1.MonacoTextmateService).toSelf().inSingletonScope();
|
|
40
|
+
bind(browser_1.FrontendApplicationContribution).toService(monaco_textmate_service_1.MonacoTextmateService);
|
|
41
|
+
(0, core_1.bindContributionProvider)(bind, textmate_contribution_1.LanguageGrammarDefinitionContribution);
|
|
42
|
+
bind(textmate_registry_1.TextmateRegistry).toSelf().inSingletonScope();
|
|
43
|
+
bind(monaco_theme_registry_1.MonacoThemeRegistry).toSelf().inSingletonScope();
|
|
44
|
+
bind(monaco_theme_types_1.TextmateRegistryFactory).toFactory(({ container }) => (theme) => {
|
|
45
|
+
const onigLib = container.get(monaco_theme_types_1.OnigasmPromise);
|
|
46
|
+
const textmateRegistry = container.get(textmate_registry_1.TextmateRegistry);
|
|
47
|
+
return new vscode_textmate_1.Registry({
|
|
48
|
+
onigLib,
|
|
49
|
+
theme,
|
|
50
|
+
loadGrammar: async (scopeName) => {
|
|
51
|
+
const provider = textmateRegistry.getProvider(scopeName);
|
|
52
|
+
if (provider) {
|
|
53
|
+
const definition = await provider.getGrammarDefinition();
|
|
54
|
+
let rawGrammar;
|
|
55
|
+
if (typeof definition.content === 'string') {
|
|
56
|
+
rawGrammar = (0, vscode_textmate_1.parseRawGrammar)(definition.content, definition.format === 'json' ? 'grammar.json' : 'grammar.plist');
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
rawGrammar = definition.content;
|
|
60
|
+
}
|
|
61
|
+
return rawGrammar;
|
|
62
|
+
}
|
|
63
|
+
return undefined;
|
|
64
|
+
},
|
|
65
|
+
getInjections: (scopeName) => {
|
|
66
|
+
const provider = textmateRegistry.getProvider(scopeName);
|
|
67
|
+
if (provider && provider.getInjections) {
|
|
68
|
+
return provider.getInjections(scopeName);
|
|
69
|
+
}
|
|
70
|
+
return [];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
async function dynamicOnigasmLib(ctx) {
|
|
76
|
+
return createOnigasmLib();
|
|
77
|
+
}
|
|
78
|
+
exports.dynamicOnigasmLib = dynamicOnigasmLib;
|
|
79
|
+
async function createOnigasmLib() {
|
|
80
|
+
if (!browser_1.isBasicWasmSupported) {
|
|
81
|
+
throw new Error('wasm not supported');
|
|
82
|
+
}
|
|
83
|
+
const wasm = await fetchOnigasm();
|
|
84
|
+
await (0, vscode_oniguruma_1.loadWASM)(wasm);
|
|
85
|
+
return new OnigasmLib();
|
|
86
|
+
}
|
|
87
|
+
exports.createOnigasmLib = createOnigasmLib;
|
|
88
|
+
async function fetchOnigasm() {
|
|
89
|
+
// Using Webpack's wasm loader should give us a URL to fetch the resource from:
|
|
90
|
+
const onigasmPath = require('vscode-oniguruma/release/onig.wasm');
|
|
91
|
+
const response = await fetch(onigasmPath, { method: 'GET' });
|
|
92
|
+
return response.arrayBuffer();
|
|
93
|
+
}
|
|
94
|
+
exports.fetchOnigasm = fetchOnigasm;
|
|
95
95
|
//# sourceMappingURL=monaco-textmate-frontend-bindings.js.map
|