markstream-vue2 0.0.45 → 0.0.46
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/dist/chunks/{index-b8d5777d.cjs → index-11432088.cjs} +1 -1
- package/dist/chunks/{index-87cdc60f.js → index-12ec401a.js} +1 -0
- package/dist/chunks/{index-292bb72c.js → index-40b64c02.js} +1 -0
- package/dist/chunks/index-6013a5b2.cjs +1 -0
- package/dist/chunks/{index-e0a22210.js → index-6ae3630b.js} +1 -0
- package/dist/chunks/{index-2a7bea2c.js → index-754b8598.js} +1 -0
- package/dist/chunks/{index-42252d16.js → index-8dc37342.js} +1 -0
- package/dist/chunks/{index-8693b3db.cjs → index-a4867ea2.cjs} +1 -1
- package/dist/chunks/index-e0125777.cjs +1 -0
- package/dist/chunks/{index-91325ae4.cjs → index-fb457079.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +2289 -1399
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/tailwind.ts +1 -1
- package/dist/types/components/CodeBlockNode/CodeBlockNode.vue.d.ts +5 -5
- package/dist/types/components/D2BlockNode/D2BlockNode.vue.d.ts +1 -1
- package/dist/types/components/ImageNode/ImageNode.vue.d.ts +1 -1
- package/dist/types/components/InfographicBlockNode/InfographicBlockNode.vue.d.ts +1 -1
- package/dist/types/components/MarkdownCodeBlockNode/MarkdownCodeBlockNode.vue.d.ts +48 -9
- package/dist/types/components/MarkdownRenderCompat.vue.d.ts +13 -2
- package/dist/types/components/MermaidBlockNode/MermaidBlockNode.vue.d.ts +5 -1
- package/dist/types/components/NodeRenderer/LegacyNodesRenderer.vue.d.ts +23 -3
- package/dist/types/components/NodeRenderer/NodeRenderer.vue.d.ts +39 -4
- package/dist/types/components/PreCodeNode/PreCodeNode.vue.d.ts +2 -0
- package/dist/types/components/TextNode/streamingTextState.d.ts +2 -11
- package/dist/types/composables/useSmoothMarkdownStream.d.ts +21 -0
- package/dist/types/exports.d.ts +5 -3
- package/dist/types/types/component-props.d.ts +17 -4
- package/dist/types/utils/codeBlockExtraProps.d.ts +4 -0
- package/dist/types/utils/devEnv.d.ts +1 -0
- package/package.json +9 -6
- package/dist/chunks/cssMode-58e68511.cjs +0 -1
- package/dist/chunks/cssMode-60d93f28.js +0 -2044
- package/dist/chunks/htmlMode-87a75897.cjs +0 -1
- package/dist/chunks/htmlMode-8d468223.js +0 -2060
- package/dist/chunks/index-c6f74f2d.cjs +0 -1
- package/dist/chunks/index-e1315bc2.cjs +0 -1
- package/dist/chunks/index.legacy-010f0006.js +0 -126308
- package/dist/chunks/index.legacy-e02dc92b.cjs +0 -1
- package/dist/chunks/jsonMode-2a97b947.cjs +0 -1
- package/dist/chunks/jsonMode-307a9a02.js +0 -2759
- package/dist/chunks/tsMode-4f227d36.js +0 -1315
- package/dist/chunks/tsMode-b1f6e7cb.cjs +0 -1
|
@@ -1,1315 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __async = (__this, __arguments, generator) => {
|
|
21
|
-
return new Promise((resolve, reject) => {
|
|
22
|
-
var fulfilled = (value) => {
|
|
23
|
-
try {
|
|
24
|
-
step(generator.next(value));
|
|
25
|
-
} catch (e) {
|
|
26
|
-
reject(e);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
var rejected = (value) => {
|
|
30
|
-
try {
|
|
31
|
-
step(generator.throw(value));
|
|
32
|
-
} catch (e) {
|
|
33
|
-
reject(e);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
37
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
var _a;
|
|
41
|
-
import { t as typescriptDefaults, m as monaco_editor_core_star } from "./index.legacy-010f0006.js";
|
|
42
|
-
import "shiki";
|
|
43
|
-
/*!-----------------------------------------------------------------------------
|
|
44
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
45
|
-
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
46
|
-
* Released under the MIT license
|
|
47
|
-
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
|
48
|
-
*-----------------------------------------------------------------------------*/
|
|
49
|
-
var __defProp2 = Object.defineProperty;
|
|
50
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
51
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
52
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
53
|
-
var __copyProps = (to, from, except, desc) => {
|
|
54
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
55
|
-
for (let key of __getOwnPropNames(from))
|
|
56
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
57
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
58
|
-
}
|
|
59
|
-
return to;
|
|
60
|
-
};
|
|
61
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
62
|
-
var monaco_editor_core_exports = {};
|
|
63
|
-
__reExport(monaco_editor_core_exports, monaco_editor_core_star);
|
|
64
|
-
var WorkerManager = class {
|
|
65
|
-
constructor(_modeId, _defaults) {
|
|
66
|
-
this._modeId = _modeId;
|
|
67
|
-
this._defaults = _defaults;
|
|
68
|
-
this._worker = null;
|
|
69
|
-
this._client = null;
|
|
70
|
-
this._configChangeListener = this._defaults.onDidChange(() => this._stopWorker());
|
|
71
|
-
this._updateExtraLibsToken = 0;
|
|
72
|
-
this._extraLibsChangeListener = this._defaults.onDidExtraLibsChange(
|
|
73
|
-
() => this._updateExtraLibs()
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
dispose() {
|
|
77
|
-
this._configChangeListener.dispose();
|
|
78
|
-
this._extraLibsChangeListener.dispose();
|
|
79
|
-
this._stopWorker();
|
|
80
|
-
}
|
|
81
|
-
_stopWorker() {
|
|
82
|
-
if (this._worker) {
|
|
83
|
-
this._worker.dispose();
|
|
84
|
-
this._worker = null;
|
|
85
|
-
}
|
|
86
|
-
this._client = null;
|
|
87
|
-
}
|
|
88
|
-
_updateExtraLibs() {
|
|
89
|
-
return __async(this, null, function* () {
|
|
90
|
-
if (!this._worker) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
const myToken = ++this._updateExtraLibsToken;
|
|
94
|
-
const proxy = yield this._worker.getProxy();
|
|
95
|
-
if (this._updateExtraLibsToken !== myToken) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
proxy.updateExtraLibs(this._defaults.getExtraLibs());
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
_getClient() {
|
|
102
|
-
if (!this._client) {
|
|
103
|
-
this._client = (() => __async(this, null, function* () {
|
|
104
|
-
this._worker = monaco_editor_core_exports.editor.createWebWorker({
|
|
105
|
-
// module that exports the create() method and returns a `TypeScriptWorker` instance
|
|
106
|
-
moduleId: "vs/language/typescript/tsWorker",
|
|
107
|
-
label: this._modeId,
|
|
108
|
-
keepIdleModels: true,
|
|
109
|
-
// passed in to the create() method
|
|
110
|
-
createData: {
|
|
111
|
-
compilerOptions: this._defaults.getCompilerOptions(),
|
|
112
|
-
extraLibs: this._defaults.getExtraLibs(),
|
|
113
|
-
customWorkerPath: this._defaults.workerOptions.customWorkerPath,
|
|
114
|
-
inlayHintsOptions: this._defaults.inlayHintsOptions
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
if (this._defaults.getEagerModelSync()) {
|
|
118
|
-
return yield this._worker.withSyncedResources(
|
|
119
|
-
monaco_editor_core_exports.editor.getModels().filter((model) => model.getLanguageId() === this._modeId).map((model) => model.uri)
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
return yield this._worker.getProxy();
|
|
123
|
-
}))();
|
|
124
|
-
}
|
|
125
|
-
return this._client;
|
|
126
|
-
}
|
|
127
|
-
getLanguageServiceWorker(...resources) {
|
|
128
|
-
return __async(this, null, function* () {
|
|
129
|
-
const client = yield this._getClient();
|
|
130
|
-
if (this._worker) {
|
|
131
|
-
yield this._worker.withSyncedResources(resources);
|
|
132
|
-
}
|
|
133
|
-
return client;
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
var libFileSet = {};
|
|
138
|
-
libFileSet["lib.d.ts"] = true;
|
|
139
|
-
libFileSet["lib.decorators.d.ts"] = true;
|
|
140
|
-
libFileSet["lib.decorators.legacy.d.ts"] = true;
|
|
141
|
-
libFileSet["lib.dom.asynciterable.d.ts"] = true;
|
|
142
|
-
libFileSet["lib.dom.d.ts"] = true;
|
|
143
|
-
libFileSet["lib.dom.iterable.d.ts"] = true;
|
|
144
|
-
libFileSet["lib.es2015.collection.d.ts"] = true;
|
|
145
|
-
libFileSet["lib.es2015.core.d.ts"] = true;
|
|
146
|
-
libFileSet["lib.es2015.d.ts"] = true;
|
|
147
|
-
libFileSet["lib.es2015.generator.d.ts"] = true;
|
|
148
|
-
libFileSet["lib.es2015.iterable.d.ts"] = true;
|
|
149
|
-
libFileSet["lib.es2015.promise.d.ts"] = true;
|
|
150
|
-
libFileSet["lib.es2015.proxy.d.ts"] = true;
|
|
151
|
-
libFileSet["lib.es2015.reflect.d.ts"] = true;
|
|
152
|
-
libFileSet["lib.es2015.symbol.d.ts"] = true;
|
|
153
|
-
libFileSet["lib.es2015.symbol.wellknown.d.ts"] = true;
|
|
154
|
-
libFileSet["lib.es2016.array.include.d.ts"] = true;
|
|
155
|
-
libFileSet["lib.es2016.d.ts"] = true;
|
|
156
|
-
libFileSet["lib.es2016.full.d.ts"] = true;
|
|
157
|
-
libFileSet["lib.es2016.intl.d.ts"] = true;
|
|
158
|
-
libFileSet["lib.es2017.d.ts"] = true;
|
|
159
|
-
libFileSet["lib.es2017.date.d.ts"] = true;
|
|
160
|
-
libFileSet["lib.es2017.full.d.ts"] = true;
|
|
161
|
-
libFileSet["lib.es2017.intl.d.ts"] = true;
|
|
162
|
-
libFileSet["lib.es2017.object.d.ts"] = true;
|
|
163
|
-
libFileSet["lib.es2017.sharedmemory.d.ts"] = true;
|
|
164
|
-
libFileSet["lib.es2017.string.d.ts"] = true;
|
|
165
|
-
libFileSet["lib.es2017.typedarrays.d.ts"] = true;
|
|
166
|
-
libFileSet["lib.es2018.asyncgenerator.d.ts"] = true;
|
|
167
|
-
libFileSet["lib.es2018.asynciterable.d.ts"] = true;
|
|
168
|
-
libFileSet["lib.es2018.d.ts"] = true;
|
|
169
|
-
libFileSet["lib.es2018.full.d.ts"] = true;
|
|
170
|
-
libFileSet["lib.es2018.intl.d.ts"] = true;
|
|
171
|
-
libFileSet["lib.es2018.promise.d.ts"] = true;
|
|
172
|
-
libFileSet["lib.es2018.regexp.d.ts"] = true;
|
|
173
|
-
libFileSet["lib.es2019.array.d.ts"] = true;
|
|
174
|
-
libFileSet["lib.es2019.d.ts"] = true;
|
|
175
|
-
libFileSet["lib.es2019.full.d.ts"] = true;
|
|
176
|
-
libFileSet["lib.es2019.intl.d.ts"] = true;
|
|
177
|
-
libFileSet["lib.es2019.object.d.ts"] = true;
|
|
178
|
-
libFileSet["lib.es2019.string.d.ts"] = true;
|
|
179
|
-
libFileSet["lib.es2019.symbol.d.ts"] = true;
|
|
180
|
-
libFileSet["lib.es2020.bigint.d.ts"] = true;
|
|
181
|
-
libFileSet["lib.es2020.d.ts"] = true;
|
|
182
|
-
libFileSet["lib.es2020.date.d.ts"] = true;
|
|
183
|
-
libFileSet["lib.es2020.full.d.ts"] = true;
|
|
184
|
-
libFileSet["lib.es2020.intl.d.ts"] = true;
|
|
185
|
-
libFileSet["lib.es2020.number.d.ts"] = true;
|
|
186
|
-
libFileSet["lib.es2020.promise.d.ts"] = true;
|
|
187
|
-
libFileSet["lib.es2020.sharedmemory.d.ts"] = true;
|
|
188
|
-
libFileSet["lib.es2020.string.d.ts"] = true;
|
|
189
|
-
libFileSet["lib.es2020.symbol.wellknown.d.ts"] = true;
|
|
190
|
-
libFileSet["lib.es2021.d.ts"] = true;
|
|
191
|
-
libFileSet["lib.es2021.full.d.ts"] = true;
|
|
192
|
-
libFileSet["lib.es2021.intl.d.ts"] = true;
|
|
193
|
-
libFileSet["lib.es2021.promise.d.ts"] = true;
|
|
194
|
-
libFileSet["lib.es2021.string.d.ts"] = true;
|
|
195
|
-
libFileSet["lib.es2021.weakref.d.ts"] = true;
|
|
196
|
-
libFileSet["lib.es2022.array.d.ts"] = true;
|
|
197
|
-
libFileSet["lib.es2022.d.ts"] = true;
|
|
198
|
-
libFileSet["lib.es2022.error.d.ts"] = true;
|
|
199
|
-
libFileSet["lib.es2022.full.d.ts"] = true;
|
|
200
|
-
libFileSet["lib.es2022.intl.d.ts"] = true;
|
|
201
|
-
libFileSet["lib.es2022.object.d.ts"] = true;
|
|
202
|
-
libFileSet["lib.es2022.regexp.d.ts"] = true;
|
|
203
|
-
libFileSet["lib.es2022.sharedmemory.d.ts"] = true;
|
|
204
|
-
libFileSet["lib.es2022.string.d.ts"] = true;
|
|
205
|
-
libFileSet["lib.es2023.array.d.ts"] = true;
|
|
206
|
-
libFileSet["lib.es2023.collection.d.ts"] = true;
|
|
207
|
-
libFileSet["lib.es2023.d.ts"] = true;
|
|
208
|
-
libFileSet["lib.es2023.full.d.ts"] = true;
|
|
209
|
-
libFileSet["lib.es5.d.ts"] = true;
|
|
210
|
-
libFileSet["lib.es6.d.ts"] = true;
|
|
211
|
-
libFileSet["lib.esnext.collection.d.ts"] = true;
|
|
212
|
-
libFileSet["lib.esnext.d.ts"] = true;
|
|
213
|
-
libFileSet["lib.esnext.decorators.d.ts"] = true;
|
|
214
|
-
libFileSet["lib.esnext.disposable.d.ts"] = true;
|
|
215
|
-
libFileSet["lib.esnext.full.d.ts"] = true;
|
|
216
|
-
libFileSet["lib.esnext.intl.d.ts"] = true;
|
|
217
|
-
libFileSet["lib.esnext.object.d.ts"] = true;
|
|
218
|
-
libFileSet["lib.esnext.promise.d.ts"] = true;
|
|
219
|
-
libFileSet["lib.scripthost.d.ts"] = true;
|
|
220
|
-
libFileSet["lib.webworker.asynciterable.d.ts"] = true;
|
|
221
|
-
libFileSet["lib.webworker.d.ts"] = true;
|
|
222
|
-
libFileSet["lib.webworker.importscripts.d.ts"] = true;
|
|
223
|
-
libFileSet["lib.webworker.iterable.d.ts"] = true;
|
|
224
|
-
function flattenDiagnosticMessageText(diag, newLine, indent = 0) {
|
|
225
|
-
if (typeof diag === "string") {
|
|
226
|
-
return diag;
|
|
227
|
-
} else if (diag === void 0) {
|
|
228
|
-
return "";
|
|
229
|
-
}
|
|
230
|
-
let result = "";
|
|
231
|
-
if (indent) {
|
|
232
|
-
result += newLine;
|
|
233
|
-
for (let i = 0; i < indent; i++) {
|
|
234
|
-
result += " ";
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
result += diag.messageText;
|
|
238
|
-
indent++;
|
|
239
|
-
if (diag.next) {
|
|
240
|
-
for (const kid of diag.next) {
|
|
241
|
-
result += flattenDiagnosticMessageText(kid, newLine, indent);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
return result;
|
|
245
|
-
}
|
|
246
|
-
function displayPartsToString(displayParts) {
|
|
247
|
-
if (displayParts) {
|
|
248
|
-
return displayParts.map((displayPart) => displayPart.text).join("");
|
|
249
|
-
}
|
|
250
|
-
return "";
|
|
251
|
-
}
|
|
252
|
-
var Adapter = class {
|
|
253
|
-
constructor(_worker) {
|
|
254
|
-
this._worker = _worker;
|
|
255
|
-
}
|
|
256
|
-
// protected _positionToOffset(model: editor.ITextModel, position: monaco.IPosition): number {
|
|
257
|
-
// return model.getOffsetAt(position);
|
|
258
|
-
// }
|
|
259
|
-
// protected _offsetToPosition(model: editor.ITextModel, offset: number): monaco.IPosition {
|
|
260
|
-
// return model.getPositionAt(offset);
|
|
261
|
-
// }
|
|
262
|
-
_textSpanToRange(model, span) {
|
|
263
|
-
let p1 = model.getPositionAt(span.start);
|
|
264
|
-
let p2 = model.getPositionAt(span.start + span.length);
|
|
265
|
-
let { lineNumber: startLineNumber, column: startColumn } = p1;
|
|
266
|
-
let { lineNumber: endLineNumber, column: endColumn } = p2;
|
|
267
|
-
return { startLineNumber, startColumn, endLineNumber, endColumn };
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
var LibFiles = class {
|
|
271
|
-
constructor(_worker) {
|
|
272
|
-
this._worker = _worker;
|
|
273
|
-
this._libFiles = {};
|
|
274
|
-
this._hasFetchedLibFiles = false;
|
|
275
|
-
this._fetchLibFilesPromise = null;
|
|
276
|
-
}
|
|
277
|
-
isLibFile(uri) {
|
|
278
|
-
if (!uri) {
|
|
279
|
-
return false;
|
|
280
|
-
}
|
|
281
|
-
if (uri.path.indexOf("/lib.") === 0) {
|
|
282
|
-
return !!libFileSet[uri.path.slice(1)];
|
|
283
|
-
}
|
|
284
|
-
return false;
|
|
285
|
-
}
|
|
286
|
-
getOrCreateModel(fileName) {
|
|
287
|
-
const uri = monaco_editor_core_exports.Uri.parse(fileName);
|
|
288
|
-
const model = monaco_editor_core_exports.editor.getModel(uri);
|
|
289
|
-
if (model) {
|
|
290
|
-
return model;
|
|
291
|
-
}
|
|
292
|
-
if (this.isLibFile(uri) && this._hasFetchedLibFiles) {
|
|
293
|
-
return monaco_editor_core_exports.editor.createModel(this._libFiles[uri.path.slice(1)], "typescript", uri);
|
|
294
|
-
}
|
|
295
|
-
const matchedLibFile = typescriptDefaults.getExtraLibs()[fileName];
|
|
296
|
-
if (matchedLibFile) {
|
|
297
|
-
return monaco_editor_core_exports.editor.createModel(matchedLibFile.content, "typescript", uri);
|
|
298
|
-
}
|
|
299
|
-
return null;
|
|
300
|
-
}
|
|
301
|
-
_containsLibFile(uris) {
|
|
302
|
-
for (let uri of uris) {
|
|
303
|
-
if (this.isLibFile(uri)) {
|
|
304
|
-
return true;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
return false;
|
|
308
|
-
}
|
|
309
|
-
fetchLibFilesIfNecessary(uris) {
|
|
310
|
-
return __async(this, null, function* () {
|
|
311
|
-
if (!this._containsLibFile(uris)) {
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
314
|
-
yield this._fetchLibFiles();
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
_fetchLibFiles() {
|
|
318
|
-
if (!this._fetchLibFilesPromise) {
|
|
319
|
-
this._fetchLibFilesPromise = this._worker().then((w) => w.getLibFiles()).then((libFiles) => {
|
|
320
|
-
this._hasFetchedLibFiles = true;
|
|
321
|
-
this._libFiles = libFiles;
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
return this._fetchLibFilesPromise;
|
|
325
|
-
}
|
|
326
|
-
};
|
|
327
|
-
var DiagnosticsAdapter = class extends Adapter {
|
|
328
|
-
constructor(_libFiles, _defaults, _selector, worker) {
|
|
329
|
-
super(worker);
|
|
330
|
-
this._libFiles = _libFiles;
|
|
331
|
-
this._defaults = _defaults;
|
|
332
|
-
this._selector = _selector;
|
|
333
|
-
this._disposables = [];
|
|
334
|
-
this._listener = /* @__PURE__ */ Object.create(null);
|
|
335
|
-
const onModelAdd = (model) => {
|
|
336
|
-
if (model.getLanguageId() !== _selector) {
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
const maybeValidate = () => {
|
|
340
|
-
const { onlyVisible } = this._defaults.getDiagnosticsOptions();
|
|
341
|
-
if (onlyVisible) {
|
|
342
|
-
if (model.isAttachedToEditor()) {
|
|
343
|
-
this._doValidate(model);
|
|
344
|
-
}
|
|
345
|
-
} else {
|
|
346
|
-
this._doValidate(model);
|
|
347
|
-
}
|
|
348
|
-
};
|
|
349
|
-
let handle;
|
|
350
|
-
const changeSubscription = model.onDidChangeContent(() => {
|
|
351
|
-
clearTimeout(handle);
|
|
352
|
-
handle = window.setTimeout(maybeValidate, 500);
|
|
353
|
-
});
|
|
354
|
-
const visibleSubscription = model.onDidChangeAttached(() => {
|
|
355
|
-
const { onlyVisible } = this._defaults.getDiagnosticsOptions();
|
|
356
|
-
if (onlyVisible) {
|
|
357
|
-
if (model.isAttachedToEditor()) {
|
|
358
|
-
maybeValidate();
|
|
359
|
-
} else {
|
|
360
|
-
monaco_editor_core_exports.editor.setModelMarkers(model, this._selector, []);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
this._listener[model.uri.toString()] = {
|
|
365
|
-
dispose() {
|
|
366
|
-
changeSubscription.dispose();
|
|
367
|
-
visibleSubscription.dispose();
|
|
368
|
-
clearTimeout(handle);
|
|
369
|
-
}
|
|
370
|
-
};
|
|
371
|
-
maybeValidate();
|
|
372
|
-
};
|
|
373
|
-
const onModelRemoved = (model) => {
|
|
374
|
-
monaco_editor_core_exports.editor.setModelMarkers(model, this._selector, []);
|
|
375
|
-
const key = model.uri.toString();
|
|
376
|
-
if (this._listener[key]) {
|
|
377
|
-
this._listener[key].dispose();
|
|
378
|
-
delete this._listener[key];
|
|
379
|
-
}
|
|
380
|
-
};
|
|
381
|
-
this._disposables.push(
|
|
382
|
-
monaco_editor_core_exports.editor.onDidCreateModel((model) => onModelAdd(model))
|
|
383
|
-
);
|
|
384
|
-
this._disposables.push(monaco_editor_core_exports.editor.onWillDisposeModel(onModelRemoved));
|
|
385
|
-
this._disposables.push(
|
|
386
|
-
monaco_editor_core_exports.editor.onDidChangeModelLanguage((event) => {
|
|
387
|
-
onModelRemoved(event.model);
|
|
388
|
-
onModelAdd(event.model);
|
|
389
|
-
})
|
|
390
|
-
);
|
|
391
|
-
this._disposables.push({
|
|
392
|
-
dispose() {
|
|
393
|
-
for (const model of monaco_editor_core_exports.editor.getModels()) {
|
|
394
|
-
onModelRemoved(model);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
});
|
|
398
|
-
const recomputeDiagostics = () => {
|
|
399
|
-
for (const model of monaco_editor_core_exports.editor.getModels()) {
|
|
400
|
-
onModelRemoved(model);
|
|
401
|
-
onModelAdd(model);
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
|
-
this._disposables.push(this._defaults.onDidChange(recomputeDiagostics));
|
|
405
|
-
this._disposables.push(this._defaults.onDidExtraLibsChange(recomputeDiagostics));
|
|
406
|
-
monaco_editor_core_exports.editor.getModels().forEach((model) => onModelAdd(model));
|
|
407
|
-
}
|
|
408
|
-
dispose() {
|
|
409
|
-
this._disposables.forEach((d) => d && d.dispose());
|
|
410
|
-
this._disposables = [];
|
|
411
|
-
}
|
|
412
|
-
_doValidate(model) {
|
|
413
|
-
return __async(this, null, function* () {
|
|
414
|
-
const worker = yield this._worker(model.uri);
|
|
415
|
-
if (model.isDisposed()) {
|
|
416
|
-
return;
|
|
417
|
-
}
|
|
418
|
-
const promises = [];
|
|
419
|
-
const { noSyntaxValidation, noSemanticValidation, noSuggestionDiagnostics } = this._defaults.getDiagnosticsOptions();
|
|
420
|
-
if (!noSyntaxValidation) {
|
|
421
|
-
promises.push(worker.getSyntacticDiagnostics(model.uri.toString()));
|
|
422
|
-
}
|
|
423
|
-
if (!noSemanticValidation) {
|
|
424
|
-
promises.push(worker.getSemanticDiagnostics(model.uri.toString()));
|
|
425
|
-
}
|
|
426
|
-
if (!noSuggestionDiagnostics) {
|
|
427
|
-
promises.push(worker.getSuggestionDiagnostics(model.uri.toString()));
|
|
428
|
-
}
|
|
429
|
-
const allDiagnostics = yield Promise.all(promises);
|
|
430
|
-
if (!allDiagnostics || model.isDisposed()) {
|
|
431
|
-
return;
|
|
432
|
-
}
|
|
433
|
-
const diagnostics = allDiagnostics.reduce((p, c) => c.concat(p), []).filter(
|
|
434
|
-
(d) => (this._defaults.getDiagnosticsOptions().diagnosticCodesToIgnore || []).indexOf(d.code) === -1
|
|
435
|
-
);
|
|
436
|
-
const relatedUris = diagnostics.map((d) => d.relatedInformation || []).reduce((p, c) => c.concat(p), []).map(
|
|
437
|
-
(relatedInformation) => relatedInformation.file ? monaco_editor_core_exports.Uri.parse(relatedInformation.file.fileName) : null
|
|
438
|
-
);
|
|
439
|
-
yield this._libFiles.fetchLibFilesIfNecessary(relatedUris);
|
|
440
|
-
if (model.isDisposed()) {
|
|
441
|
-
return;
|
|
442
|
-
}
|
|
443
|
-
monaco_editor_core_exports.editor.setModelMarkers(
|
|
444
|
-
model,
|
|
445
|
-
this._selector,
|
|
446
|
-
diagnostics.map((d) => this._convertDiagnostics(model, d))
|
|
447
|
-
);
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
_convertDiagnostics(model, diag) {
|
|
451
|
-
const diagStart = diag.start || 0;
|
|
452
|
-
const diagLength = diag.length || 1;
|
|
453
|
-
const { lineNumber: startLineNumber, column: startColumn } = model.getPositionAt(diagStart);
|
|
454
|
-
const { lineNumber: endLineNumber, column: endColumn } = model.getPositionAt(
|
|
455
|
-
diagStart + diagLength
|
|
456
|
-
);
|
|
457
|
-
const tags = [];
|
|
458
|
-
if (diag.reportsUnnecessary) {
|
|
459
|
-
tags.push(monaco_editor_core_exports.MarkerTag.Unnecessary);
|
|
460
|
-
}
|
|
461
|
-
if (diag.reportsDeprecated) {
|
|
462
|
-
tags.push(monaco_editor_core_exports.MarkerTag.Deprecated);
|
|
463
|
-
}
|
|
464
|
-
return {
|
|
465
|
-
severity: this._tsDiagnosticCategoryToMarkerSeverity(diag.category),
|
|
466
|
-
startLineNumber,
|
|
467
|
-
startColumn,
|
|
468
|
-
endLineNumber,
|
|
469
|
-
endColumn,
|
|
470
|
-
message: flattenDiagnosticMessageText(diag.messageText, "\n"),
|
|
471
|
-
code: diag.code.toString(),
|
|
472
|
-
tags,
|
|
473
|
-
relatedInformation: this._convertRelatedInformation(model, diag.relatedInformation)
|
|
474
|
-
};
|
|
475
|
-
}
|
|
476
|
-
_convertRelatedInformation(model, relatedInformation) {
|
|
477
|
-
if (!relatedInformation) {
|
|
478
|
-
return [];
|
|
479
|
-
}
|
|
480
|
-
const result = [];
|
|
481
|
-
relatedInformation.forEach((info) => {
|
|
482
|
-
let relatedResource = model;
|
|
483
|
-
if (info.file) {
|
|
484
|
-
relatedResource = this._libFiles.getOrCreateModel(info.file.fileName);
|
|
485
|
-
}
|
|
486
|
-
if (!relatedResource) {
|
|
487
|
-
return;
|
|
488
|
-
}
|
|
489
|
-
const infoStart = info.start || 0;
|
|
490
|
-
const infoLength = info.length || 1;
|
|
491
|
-
const { lineNumber: startLineNumber, column: startColumn } = relatedResource.getPositionAt(infoStart);
|
|
492
|
-
const { lineNumber: endLineNumber, column: endColumn } = relatedResource.getPositionAt(
|
|
493
|
-
infoStart + infoLength
|
|
494
|
-
);
|
|
495
|
-
result.push({
|
|
496
|
-
resource: relatedResource.uri,
|
|
497
|
-
startLineNumber,
|
|
498
|
-
startColumn,
|
|
499
|
-
endLineNumber,
|
|
500
|
-
endColumn,
|
|
501
|
-
message: flattenDiagnosticMessageText(info.messageText, "\n")
|
|
502
|
-
});
|
|
503
|
-
});
|
|
504
|
-
return result;
|
|
505
|
-
}
|
|
506
|
-
_tsDiagnosticCategoryToMarkerSeverity(category) {
|
|
507
|
-
switch (category) {
|
|
508
|
-
case 1:
|
|
509
|
-
return monaco_editor_core_exports.MarkerSeverity.Error;
|
|
510
|
-
case 3:
|
|
511
|
-
return monaco_editor_core_exports.MarkerSeverity.Info;
|
|
512
|
-
case 0:
|
|
513
|
-
return monaco_editor_core_exports.MarkerSeverity.Warning;
|
|
514
|
-
case 2:
|
|
515
|
-
return monaco_editor_core_exports.MarkerSeverity.Hint;
|
|
516
|
-
}
|
|
517
|
-
return monaco_editor_core_exports.MarkerSeverity.Info;
|
|
518
|
-
}
|
|
519
|
-
};
|
|
520
|
-
var SuggestAdapter = class _SuggestAdapter extends Adapter {
|
|
521
|
-
get triggerCharacters() {
|
|
522
|
-
return ["."];
|
|
523
|
-
}
|
|
524
|
-
provideCompletionItems(model, position, _context, token) {
|
|
525
|
-
return __async(this, null, function* () {
|
|
526
|
-
const wordInfo = model.getWordUntilPosition(position);
|
|
527
|
-
const wordRange = new monaco_editor_core_exports.Range(
|
|
528
|
-
position.lineNumber,
|
|
529
|
-
wordInfo.startColumn,
|
|
530
|
-
position.lineNumber,
|
|
531
|
-
wordInfo.endColumn
|
|
532
|
-
);
|
|
533
|
-
const resource = model.uri;
|
|
534
|
-
const offset = model.getOffsetAt(position);
|
|
535
|
-
const worker = yield this._worker(resource);
|
|
536
|
-
if (model.isDisposed()) {
|
|
537
|
-
return;
|
|
538
|
-
}
|
|
539
|
-
const info = yield worker.getCompletionsAtPosition(resource.toString(), offset);
|
|
540
|
-
if (!info || model.isDisposed()) {
|
|
541
|
-
return;
|
|
542
|
-
}
|
|
543
|
-
const suggestions = info.entries.map((entry) => {
|
|
544
|
-
let range = wordRange;
|
|
545
|
-
if (entry.replacementSpan) {
|
|
546
|
-
const p1 = model.getPositionAt(entry.replacementSpan.start);
|
|
547
|
-
const p2 = model.getPositionAt(entry.replacementSpan.start + entry.replacementSpan.length);
|
|
548
|
-
range = new monaco_editor_core_exports.Range(p1.lineNumber, p1.column, p2.lineNumber, p2.column);
|
|
549
|
-
}
|
|
550
|
-
const tags = [];
|
|
551
|
-
if (entry.kindModifiers !== void 0 && entry.kindModifiers.indexOf("deprecated") !== -1) {
|
|
552
|
-
tags.push(monaco_editor_core_exports.languages.CompletionItemTag.Deprecated);
|
|
553
|
-
}
|
|
554
|
-
return {
|
|
555
|
-
uri: resource,
|
|
556
|
-
position,
|
|
557
|
-
offset,
|
|
558
|
-
range,
|
|
559
|
-
label: entry.name,
|
|
560
|
-
insertText: entry.name,
|
|
561
|
-
sortText: entry.sortText,
|
|
562
|
-
kind: _SuggestAdapter.convertKind(entry.kind),
|
|
563
|
-
tags
|
|
564
|
-
};
|
|
565
|
-
});
|
|
566
|
-
return {
|
|
567
|
-
suggestions
|
|
568
|
-
};
|
|
569
|
-
});
|
|
570
|
-
}
|
|
571
|
-
resolveCompletionItem(item, token) {
|
|
572
|
-
return __async(this, null, function* () {
|
|
573
|
-
const myItem = item;
|
|
574
|
-
const resource = myItem.uri;
|
|
575
|
-
const position = myItem.position;
|
|
576
|
-
const offset = myItem.offset;
|
|
577
|
-
const worker = yield this._worker(resource);
|
|
578
|
-
const details = yield worker.getCompletionEntryDetails(
|
|
579
|
-
resource.toString(),
|
|
580
|
-
offset,
|
|
581
|
-
myItem.label
|
|
582
|
-
);
|
|
583
|
-
if (!details) {
|
|
584
|
-
return myItem;
|
|
585
|
-
}
|
|
586
|
-
return {
|
|
587
|
-
uri: resource,
|
|
588
|
-
position,
|
|
589
|
-
label: details.name,
|
|
590
|
-
kind: _SuggestAdapter.convertKind(details.kind),
|
|
591
|
-
detail: displayPartsToString(details.displayParts),
|
|
592
|
-
documentation: {
|
|
593
|
-
value: _SuggestAdapter.createDocumentationString(details)
|
|
594
|
-
}
|
|
595
|
-
};
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
static convertKind(kind) {
|
|
599
|
-
switch (kind) {
|
|
600
|
-
case Kind.primitiveType:
|
|
601
|
-
case Kind.keyword:
|
|
602
|
-
return monaco_editor_core_exports.languages.CompletionItemKind.Keyword;
|
|
603
|
-
case Kind.variable:
|
|
604
|
-
case Kind.localVariable:
|
|
605
|
-
return monaco_editor_core_exports.languages.CompletionItemKind.Variable;
|
|
606
|
-
case Kind.memberVariable:
|
|
607
|
-
case Kind.memberGetAccessor:
|
|
608
|
-
case Kind.memberSetAccessor:
|
|
609
|
-
return monaco_editor_core_exports.languages.CompletionItemKind.Field;
|
|
610
|
-
case Kind.function:
|
|
611
|
-
case Kind.memberFunction:
|
|
612
|
-
case Kind.constructSignature:
|
|
613
|
-
case Kind.callSignature:
|
|
614
|
-
case Kind.indexSignature:
|
|
615
|
-
return monaco_editor_core_exports.languages.CompletionItemKind.Function;
|
|
616
|
-
case Kind.enum:
|
|
617
|
-
return monaco_editor_core_exports.languages.CompletionItemKind.Enum;
|
|
618
|
-
case Kind.module:
|
|
619
|
-
return monaco_editor_core_exports.languages.CompletionItemKind.Module;
|
|
620
|
-
case Kind.class:
|
|
621
|
-
return monaco_editor_core_exports.languages.CompletionItemKind.Class;
|
|
622
|
-
case Kind.interface:
|
|
623
|
-
return monaco_editor_core_exports.languages.CompletionItemKind.Interface;
|
|
624
|
-
case Kind.warning:
|
|
625
|
-
return monaco_editor_core_exports.languages.CompletionItemKind.File;
|
|
626
|
-
}
|
|
627
|
-
return monaco_editor_core_exports.languages.CompletionItemKind.Property;
|
|
628
|
-
}
|
|
629
|
-
static createDocumentationString(details) {
|
|
630
|
-
let documentationString = displayPartsToString(details.documentation);
|
|
631
|
-
if (details.tags) {
|
|
632
|
-
for (const tag of details.tags) {
|
|
633
|
-
documentationString += `
|
|
634
|
-
|
|
635
|
-
${tagToString(tag)}`;
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
return documentationString;
|
|
639
|
-
}
|
|
640
|
-
};
|
|
641
|
-
function tagToString(tag) {
|
|
642
|
-
let tagLabel = `*@${tag.name}*`;
|
|
643
|
-
if (tag.name === "param" && tag.text) {
|
|
644
|
-
const [paramName, ...rest] = tag.text;
|
|
645
|
-
tagLabel += `\`${paramName.text}\``;
|
|
646
|
-
if (rest.length > 0)
|
|
647
|
-
tagLabel += ` — ${rest.map((r) => r.text).join(" ")}`;
|
|
648
|
-
} else if (Array.isArray(tag.text)) {
|
|
649
|
-
tagLabel += ` — ${tag.text.map((r) => r.text).join(" ")}`;
|
|
650
|
-
} else if (tag.text) {
|
|
651
|
-
tagLabel += ` — ${tag.text}`;
|
|
652
|
-
}
|
|
653
|
-
return tagLabel;
|
|
654
|
-
}
|
|
655
|
-
var SignatureHelpAdapter = class _SignatureHelpAdapter extends Adapter {
|
|
656
|
-
constructor() {
|
|
657
|
-
super(...arguments);
|
|
658
|
-
this.signatureHelpTriggerCharacters = ["(", ","];
|
|
659
|
-
}
|
|
660
|
-
static _toSignatureHelpTriggerReason(context) {
|
|
661
|
-
switch (context.triggerKind) {
|
|
662
|
-
case monaco_editor_core_exports.languages.SignatureHelpTriggerKind.TriggerCharacter:
|
|
663
|
-
if (context.triggerCharacter) {
|
|
664
|
-
if (context.isRetrigger) {
|
|
665
|
-
return { kind: "retrigger", triggerCharacter: context.triggerCharacter };
|
|
666
|
-
} else {
|
|
667
|
-
return { kind: "characterTyped", triggerCharacter: context.triggerCharacter };
|
|
668
|
-
}
|
|
669
|
-
} else {
|
|
670
|
-
return { kind: "invoked" };
|
|
671
|
-
}
|
|
672
|
-
case monaco_editor_core_exports.languages.SignatureHelpTriggerKind.ContentChange:
|
|
673
|
-
return context.isRetrigger ? { kind: "retrigger" } : { kind: "invoked" };
|
|
674
|
-
case monaco_editor_core_exports.languages.SignatureHelpTriggerKind.Invoke:
|
|
675
|
-
default:
|
|
676
|
-
return { kind: "invoked" };
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
provideSignatureHelp(model, position, token, context) {
|
|
680
|
-
return __async(this, null, function* () {
|
|
681
|
-
const resource = model.uri;
|
|
682
|
-
const offset = model.getOffsetAt(position);
|
|
683
|
-
const worker = yield this._worker(resource);
|
|
684
|
-
if (model.isDisposed()) {
|
|
685
|
-
return;
|
|
686
|
-
}
|
|
687
|
-
const info = yield worker.getSignatureHelpItems(resource.toString(), offset, {
|
|
688
|
-
triggerReason: _SignatureHelpAdapter._toSignatureHelpTriggerReason(context)
|
|
689
|
-
});
|
|
690
|
-
if (!info || model.isDisposed()) {
|
|
691
|
-
return;
|
|
692
|
-
}
|
|
693
|
-
const ret = {
|
|
694
|
-
activeSignature: info.selectedItemIndex,
|
|
695
|
-
activeParameter: info.argumentIndex,
|
|
696
|
-
signatures: []
|
|
697
|
-
};
|
|
698
|
-
info.items.forEach((item) => {
|
|
699
|
-
const signature = {
|
|
700
|
-
label: "",
|
|
701
|
-
parameters: []
|
|
702
|
-
};
|
|
703
|
-
signature.documentation = {
|
|
704
|
-
value: displayPartsToString(item.documentation)
|
|
705
|
-
};
|
|
706
|
-
signature.label += displayPartsToString(item.prefixDisplayParts);
|
|
707
|
-
item.parameters.forEach((p, i, a) => {
|
|
708
|
-
const label = displayPartsToString(p.displayParts);
|
|
709
|
-
const parameter = {
|
|
710
|
-
label,
|
|
711
|
-
documentation: {
|
|
712
|
-
value: displayPartsToString(p.documentation)
|
|
713
|
-
}
|
|
714
|
-
};
|
|
715
|
-
signature.label += label;
|
|
716
|
-
signature.parameters.push(parameter);
|
|
717
|
-
if (i < a.length - 1) {
|
|
718
|
-
signature.label += displayPartsToString(item.separatorDisplayParts);
|
|
719
|
-
}
|
|
720
|
-
});
|
|
721
|
-
signature.label += displayPartsToString(item.suffixDisplayParts);
|
|
722
|
-
ret.signatures.push(signature);
|
|
723
|
-
});
|
|
724
|
-
return {
|
|
725
|
-
value: ret,
|
|
726
|
-
dispose() {
|
|
727
|
-
}
|
|
728
|
-
};
|
|
729
|
-
});
|
|
730
|
-
}
|
|
731
|
-
};
|
|
732
|
-
var QuickInfoAdapter = class extends Adapter {
|
|
733
|
-
provideHover(model, position, token) {
|
|
734
|
-
return __async(this, null, function* () {
|
|
735
|
-
const resource = model.uri;
|
|
736
|
-
const offset = model.getOffsetAt(position);
|
|
737
|
-
const worker = yield this._worker(resource);
|
|
738
|
-
if (model.isDisposed()) {
|
|
739
|
-
return;
|
|
740
|
-
}
|
|
741
|
-
const info = yield worker.getQuickInfoAtPosition(resource.toString(), offset);
|
|
742
|
-
if (!info || model.isDisposed()) {
|
|
743
|
-
return;
|
|
744
|
-
}
|
|
745
|
-
const documentation = displayPartsToString(info.documentation);
|
|
746
|
-
const tags = info.tags ? info.tags.map((tag) => tagToString(tag)).join(" \n\n") : "";
|
|
747
|
-
const contents = displayPartsToString(info.displayParts);
|
|
748
|
-
return {
|
|
749
|
-
range: this._textSpanToRange(model, info.textSpan),
|
|
750
|
-
contents: [
|
|
751
|
-
{
|
|
752
|
-
value: "```typescript\n" + contents + "\n```\n"
|
|
753
|
-
},
|
|
754
|
-
{
|
|
755
|
-
value: documentation + (tags ? "\n\n" + tags : "")
|
|
756
|
-
}
|
|
757
|
-
]
|
|
758
|
-
};
|
|
759
|
-
});
|
|
760
|
-
}
|
|
761
|
-
};
|
|
762
|
-
var DocumentHighlightAdapter = class extends Adapter {
|
|
763
|
-
provideDocumentHighlights(model, position, token) {
|
|
764
|
-
return __async(this, null, function* () {
|
|
765
|
-
const resource = model.uri;
|
|
766
|
-
const offset = model.getOffsetAt(position);
|
|
767
|
-
const worker = yield this._worker(resource);
|
|
768
|
-
if (model.isDisposed()) {
|
|
769
|
-
return;
|
|
770
|
-
}
|
|
771
|
-
const entries = yield worker.getDocumentHighlights(resource.toString(), offset, [
|
|
772
|
-
resource.toString()
|
|
773
|
-
]);
|
|
774
|
-
if (!entries || model.isDisposed()) {
|
|
775
|
-
return;
|
|
776
|
-
}
|
|
777
|
-
return entries.flatMap((entry) => {
|
|
778
|
-
return entry.highlightSpans.map((highlightSpans) => {
|
|
779
|
-
return {
|
|
780
|
-
range: this._textSpanToRange(model, highlightSpans.textSpan),
|
|
781
|
-
kind: highlightSpans.kind === "writtenReference" ? monaco_editor_core_exports.languages.DocumentHighlightKind.Write : monaco_editor_core_exports.languages.DocumentHighlightKind.Text
|
|
782
|
-
};
|
|
783
|
-
});
|
|
784
|
-
});
|
|
785
|
-
});
|
|
786
|
-
}
|
|
787
|
-
};
|
|
788
|
-
var DefinitionAdapter = class extends Adapter {
|
|
789
|
-
constructor(_libFiles, worker) {
|
|
790
|
-
super(worker);
|
|
791
|
-
this._libFiles = _libFiles;
|
|
792
|
-
}
|
|
793
|
-
provideDefinition(model, position, token) {
|
|
794
|
-
return __async(this, null, function* () {
|
|
795
|
-
const resource = model.uri;
|
|
796
|
-
const offset = model.getOffsetAt(position);
|
|
797
|
-
const worker = yield this._worker(resource);
|
|
798
|
-
if (model.isDisposed()) {
|
|
799
|
-
return;
|
|
800
|
-
}
|
|
801
|
-
const entries = yield worker.getDefinitionAtPosition(resource.toString(), offset);
|
|
802
|
-
if (!entries || model.isDisposed()) {
|
|
803
|
-
return;
|
|
804
|
-
}
|
|
805
|
-
yield this._libFiles.fetchLibFilesIfNecessary(
|
|
806
|
-
entries.map((entry) => monaco_editor_core_exports.Uri.parse(entry.fileName))
|
|
807
|
-
);
|
|
808
|
-
if (model.isDisposed()) {
|
|
809
|
-
return;
|
|
810
|
-
}
|
|
811
|
-
const result = [];
|
|
812
|
-
for (let entry of entries) {
|
|
813
|
-
const refModel = this._libFiles.getOrCreateModel(entry.fileName);
|
|
814
|
-
if (refModel) {
|
|
815
|
-
result.push({
|
|
816
|
-
uri: refModel.uri,
|
|
817
|
-
range: this._textSpanToRange(refModel, entry.textSpan)
|
|
818
|
-
});
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
return result;
|
|
822
|
-
});
|
|
823
|
-
}
|
|
824
|
-
};
|
|
825
|
-
var ReferenceAdapter = class extends Adapter {
|
|
826
|
-
constructor(_libFiles, worker) {
|
|
827
|
-
super(worker);
|
|
828
|
-
this._libFiles = _libFiles;
|
|
829
|
-
}
|
|
830
|
-
provideReferences(model, position, context, token) {
|
|
831
|
-
return __async(this, null, function* () {
|
|
832
|
-
const resource = model.uri;
|
|
833
|
-
const offset = model.getOffsetAt(position);
|
|
834
|
-
const worker = yield this._worker(resource);
|
|
835
|
-
if (model.isDisposed()) {
|
|
836
|
-
return;
|
|
837
|
-
}
|
|
838
|
-
const entries = yield worker.getReferencesAtPosition(resource.toString(), offset);
|
|
839
|
-
if (!entries || model.isDisposed()) {
|
|
840
|
-
return;
|
|
841
|
-
}
|
|
842
|
-
yield this._libFiles.fetchLibFilesIfNecessary(
|
|
843
|
-
entries.map((entry) => monaco_editor_core_exports.Uri.parse(entry.fileName))
|
|
844
|
-
);
|
|
845
|
-
if (model.isDisposed()) {
|
|
846
|
-
return;
|
|
847
|
-
}
|
|
848
|
-
const result = [];
|
|
849
|
-
for (let entry of entries) {
|
|
850
|
-
const refModel = this._libFiles.getOrCreateModel(entry.fileName);
|
|
851
|
-
if (refModel) {
|
|
852
|
-
result.push({
|
|
853
|
-
uri: refModel.uri,
|
|
854
|
-
range: this._textSpanToRange(refModel, entry.textSpan)
|
|
855
|
-
});
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
return result;
|
|
859
|
-
});
|
|
860
|
-
}
|
|
861
|
-
};
|
|
862
|
-
var OutlineAdapter = class extends Adapter {
|
|
863
|
-
provideDocumentSymbols(model, token) {
|
|
864
|
-
return __async(this, null, function* () {
|
|
865
|
-
const resource = model.uri;
|
|
866
|
-
const worker = yield this._worker(resource);
|
|
867
|
-
if (model.isDisposed()) {
|
|
868
|
-
return;
|
|
869
|
-
}
|
|
870
|
-
const root = yield worker.getNavigationTree(resource.toString());
|
|
871
|
-
if (!root || model.isDisposed()) {
|
|
872
|
-
return;
|
|
873
|
-
}
|
|
874
|
-
const convert = (item, containerLabel) => {
|
|
875
|
-
var _a2;
|
|
876
|
-
const result2 = {
|
|
877
|
-
name: item.text,
|
|
878
|
-
detail: "",
|
|
879
|
-
kind: outlineTypeTable[item.kind] || monaco_editor_core_exports.languages.SymbolKind.Variable,
|
|
880
|
-
range: this._textSpanToRange(model, item.spans[0]),
|
|
881
|
-
selectionRange: this._textSpanToRange(model, item.spans[0]),
|
|
882
|
-
tags: [],
|
|
883
|
-
children: (_a2 = item.childItems) == null ? void 0 : _a2.map((child) => convert(child, item.text)),
|
|
884
|
-
containerName: containerLabel
|
|
885
|
-
};
|
|
886
|
-
return result2;
|
|
887
|
-
};
|
|
888
|
-
const result = root.childItems ? root.childItems.map((item) => convert(item)) : [];
|
|
889
|
-
return result;
|
|
890
|
-
});
|
|
891
|
-
}
|
|
892
|
-
};
|
|
893
|
-
var Kind = (_a = class {
|
|
894
|
-
}, _a.unknown = "", _a.keyword = "keyword", _a.script = "script", _a.module = "module", _a.class = "class", _a.interface = "interface", _a.type = "type", _a.enum = "enum", _a.variable = "var", _a.localVariable = "local var", _a.function = "function", _a.localFunction = "local function", _a.memberFunction = "method", _a.memberGetAccessor = "getter", _a.memberSetAccessor = "setter", _a.memberVariable = "property", _a.constructorImplementation = "constructor", _a.callSignature = "call", _a.indexSignature = "index", _a.constructSignature = "construct", _a.parameter = "parameter", _a.typeParameter = "type parameter", _a.primitiveType = "primitive type", _a.label = "label", _a.alias = "alias", _a.const = "const", _a.let = "let", _a.warning = "warning", _a);
|
|
895
|
-
var outlineTypeTable = /* @__PURE__ */ Object.create(null);
|
|
896
|
-
outlineTypeTable[Kind.module] = monaco_editor_core_exports.languages.SymbolKind.Module;
|
|
897
|
-
outlineTypeTable[Kind.class] = monaco_editor_core_exports.languages.SymbolKind.Class;
|
|
898
|
-
outlineTypeTable[Kind.enum] = monaco_editor_core_exports.languages.SymbolKind.Enum;
|
|
899
|
-
outlineTypeTable[Kind.interface] = monaco_editor_core_exports.languages.SymbolKind.Interface;
|
|
900
|
-
outlineTypeTable[Kind.memberFunction] = monaco_editor_core_exports.languages.SymbolKind.Method;
|
|
901
|
-
outlineTypeTable[Kind.memberVariable] = monaco_editor_core_exports.languages.SymbolKind.Property;
|
|
902
|
-
outlineTypeTable[Kind.memberGetAccessor] = monaco_editor_core_exports.languages.SymbolKind.Property;
|
|
903
|
-
outlineTypeTable[Kind.memberSetAccessor] = monaco_editor_core_exports.languages.SymbolKind.Property;
|
|
904
|
-
outlineTypeTable[Kind.variable] = monaco_editor_core_exports.languages.SymbolKind.Variable;
|
|
905
|
-
outlineTypeTable[Kind.const] = monaco_editor_core_exports.languages.SymbolKind.Variable;
|
|
906
|
-
outlineTypeTable[Kind.localVariable] = monaco_editor_core_exports.languages.SymbolKind.Variable;
|
|
907
|
-
outlineTypeTable[Kind.variable] = monaco_editor_core_exports.languages.SymbolKind.Variable;
|
|
908
|
-
outlineTypeTable[Kind.function] = monaco_editor_core_exports.languages.SymbolKind.Function;
|
|
909
|
-
outlineTypeTable[Kind.localFunction] = monaco_editor_core_exports.languages.SymbolKind.Function;
|
|
910
|
-
var FormatHelper = class extends Adapter {
|
|
911
|
-
static _convertOptions(options) {
|
|
912
|
-
return {
|
|
913
|
-
ConvertTabsToSpaces: options.insertSpaces,
|
|
914
|
-
TabSize: options.tabSize,
|
|
915
|
-
IndentSize: options.tabSize,
|
|
916
|
-
IndentStyle: 2,
|
|
917
|
-
NewLineCharacter: "\n",
|
|
918
|
-
InsertSpaceAfterCommaDelimiter: true,
|
|
919
|
-
InsertSpaceAfterSemicolonInForStatements: true,
|
|
920
|
-
InsertSpaceBeforeAndAfterBinaryOperators: true,
|
|
921
|
-
InsertSpaceAfterKeywordsInControlFlowStatements: true,
|
|
922
|
-
InsertSpaceAfterFunctionKeywordForAnonymousFunctions: true,
|
|
923
|
-
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
|
|
924
|
-
InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
|
|
925
|
-
InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false,
|
|
926
|
-
PlaceOpenBraceOnNewLineForControlBlocks: false,
|
|
927
|
-
PlaceOpenBraceOnNewLineForFunctions: false
|
|
928
|
-
};
|
|
929
|
-
}
|
|
930
|
-
_convertTextChanges(model, change) {
|
|
931
|
-
return {
|
|
932
|
-
text: change.newText,
|
|
933
|
-
range: this._textSpanToRange(model, change.span)
|
|
934
|
-
};
|
|
935
|
-
}
|
|
936
|
-
};
|
|
937
|
-
var FormatAdapter = class extends FormatHelper {
|
|
938
|
-
constructor() {
|
|
939
|
-
super(...arguments);
|
|
940
|
-
this.canFormatMultipleRanges = false;
|
|
941
|
-
}
|
|
942
|
-
provideDocumentRangeFormattingEdits(model, range, options, token) {
|
|
943
|
-
return __async(this, null, function* () {
|
|
944
|
-
const resource = model.uri;
|
|
945
|
-
const startOffset = model.getOffsetAt({
|
|
946
|
-
lineNumber: range.startLineNumber,
|
|
947
|
-
column: range.startColumn
|
|
948
|
-
});
|
|
949
|
-
const endOffset = model.getOffsetAt({
|
|
950
|
-
lineNumber: range.endLineNumber,
|
|
951
|
-
column: range.endColumn
|
|
952
|
-
});
|
|
953
|
-
const worker = yield this._worker(resource);
|
|
954
|
-
if (model.isDisposed()) {
|
|
955
|
-
return;
|
|
956
|
-
}
|
|
957
|
-
const edits = yield worker.getFormattingEditsForRange(
|
|
958
|
-
resource.toString(),
|
|
959
|
-
startOffset,
|
|
960
|
-
endOffset,
|
|
961
|
-
FormatHelper._convertOptions(options)
|
|
962
|
-
);
|
|
963
|
-
if (!edits || model.isDisposed()) {
|
|
964
|
-
return;
|
|
965
|
-
}
|
|
966
|
-
return edits.map((edit) => this._convertTextChanges(model, edit));
|
|
967
|
-
});
|
|
968
|
-
}
|
|
969
|
-
};
|
|
970
|
-
var FormatOnTypeAdapter = class extends FormatHelper {
|
|
971
|
-
get autoFormatTriggerCharacters() {
|
|
972
|
-
return [";", "}", "\n"];
|
|
973
|
-
}
|
|
974
|
-
provideOnTypeFormattingEdits(model, position, ch, options, token) {
|
|
975
|
-
return __async(this, null, function* () {
|
|
976
|
-
const resource = model.uri;
|
|
977
|
-
const offset = model.getOffsetAt(position);
|
|
978
|
-
const worker = yield this._worker(resource);
|
|
979
|
-
if (model.isDisposed()) {
|
|
980
|
-
return;
|
|
981
|
-
}
|
|
982
|
-
const edits = yield worker.getFormattingEditsAfterKeystroke(
|
|
983
|
-
resource.toString(),
|
|
984
|
-
offset,
|
|
985
|
-
ch,
|
|
986
|
-
FormatHelper._convertOptions(options)
|
|
987
|
-
);
|
|
988
|
-
if (!edits || model.isDisposed()) {
|
|
989
|
-
return;
|
|
990
|
-
}
|
|
991
|
-
return edits.map((edit) => this._convertTextChanges(model, edit));
|
|
992
|
-
});
|
|
993
|
-
}
|
|
994
|
-
};
|
|
995
|
-
var CodeActionAdaptor = class extends FormatHelper {
|
|
996
|
-
provideCodeActions(model, range, context, token) {
|
|
997
|
-
return __async(this, null, function* () {
|
|
998
|
-
const resource = model.uri;
|
|
999
|
-
const start = model.getOffsetAt({
|
|
1000
|
-
lineNumber: range.startLineNumber,
|
|
1001
|
-
column: range.startColumn
|
|
1002
|
-
});
|
|
1003
|
-
const end = model.getOffsetAt({
|
|
1004
|
-
lineNumber: range.endLineNumber,
|
|
1005
|
-
column: range.endColumn
|
|
1006
|
-
});
|
|
1007
|
-
const formatOptions = FormatHelper._convertOptions(model.getOptions());
|
|
1008
|
-
const errorCodes = context.markers.filter((m) => m.code).map((m) => m.code).map(Number);
|
|
1009
|
-
const worker = yield this._worker(resource);
|
|
1010
|
-
if (model.isDisposed()) {
|
|
1011
|
-
return;
|
|
1012
|
-
}
|
|
1013
|
-
const codeFixes = yield worker.getCodeFixesAtPosition(
|
|
1014
|
-
resource.toString(),
|
|
1015
|
-
start,
|
|
1016
|
-
end,
|
|
1017
|
-
errorCodes,
|
|
1018
|
-
formatOptions
|
|
1019
|
-
);
|
|
1020
|
-
if (!codeFixes || model.isDisposed()) {
|
|
1021
|
-
return { actions: [], dispose: () => {
|
|
1022
|
-
} };
|
|
1023
|
-
}
|
|
1024
|
-
const actions = codeFixes.filter((fix) => {
|
|
1025
|
-
return fix.changes.filter((change) => change.isNewFile).length === 0;
|
|
1026
|
-
}).map((fix) => {
|
|
1027
|
-
return this._tsCodeFixActionToMonacoCodeAction(model, context, fix);
|
|
1028
|
-
});
|
|
1029
|
-
return {
|
|
1030
|
-
actions,
|
|
1031
|
-
dispose: () => {
|
|
1032
|
-
}
|
|
1033
|
-
};
|
|
1034
|
-
});
|
|
1035
|
-
}
|
|
1036
|
-
_tsCodeFixActionToMonacoCodeAction(model, context, codeFix) {
|
|
1037
|
-
const edits = [];
|
|
1038
|
-
for (const change of codeFix.changes) {
|
|
1039
|
-
for (const textChange of change.textChanges) {
|
|
1040
|
-
edits.push({
|
|
1041
|
-
resource: model.uri,
|
|
1042
|
-
versionId: void 0,
|
|
1043
|
-
textEdit: {
|
|
1044
|
-
range: this._textSpanToRange(model, textChange.span),
|
|
1045
|
-
text: textChange.newText
|
|
1046
|
-
}
|
|
1047
|
-
});
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
const action = {
|
|
1051
|
-
title: codeFix.description,
|
|
1052
|
-
edit: { edits },
|
|
1053
|
-
diagnostics: context.markers,
|
|
1054
|
-
kind: "quickfix"
|
|
1055
|
-
};
|
|
1056
|
-
return action;
|
|
1057
|
-
}
|
|
1058
|
-
};
|
|
1059
|
-
var RenameAdapter = class extends Adapter {
|
|
1060
|
-
constructor(_libFiles, worker) {
|
|
1061
|
-
super(worker);
|
|
1062
|
-
this._libFiles = _libFiles;
|
|
1063
|
-
}
|
|
1064
|
-
provideRenameEdits(model, position, newName, token) {
|
|
1065
|
-
return __async(this, null, function* () {
|
|
1066
|
-
const resource = model.uri;
|
|
1067
|
-
const fileName = resource.toString();
|
|
1068
|
-
const offset = model.getOffsetAt(position);
|
|
1069
|
-
const worker = yield this._worker(resource);
|
|
1070
|
-
if (model.isDisposed()) {
|
|
1071
|
-
return;
|
|
1072
|
-
}
|
|
1073
|
-
const renameInfo = yield worker.getRenameInfo(fileName, offset, {
|
|
1074
|
-
allowRenameOfImportPath: false
|
|
1075
|
-
});
|
|
1076
|
-
if (renameInfo.canRename === false) {
|
|
1077
|
-
return {
|
|
1078
|
-
edits: [],
|
|
1079
|
-
rejectReason: renameInfo.localizedErrorMessage
|
|
1080
|
-
};
|
|
1081
|
-
}
|
|
1082
|
-
if (renameInfo.fileToRename !== void 0) {
|
|
1083
|
-
throw new Error("Renaming files is not supported.");
|
|
1084
|
-
}
|
|
1085
|
-
const renameLocations = yield worker.findRenameLocations(
|
|
1086
|
-
fileName,
|
|
1087
|
-
offset,
|
|
1088
|
-
/*strings*/
|
|
1089
|
-
false,
|
|
1090
|
-
/*comments*/
|
|
1091
|
-
false,
|
|
1092
|
-
/*prefixAndSuffix*/
|
|
1093
|
-
false
|
|
1094
|
-
);
|
|
1095
|
-
if (!renameLocations || model.isDisposed()) {
|
|
1096
|
-
return;
|
|
1097
|
-
}
|
|
1098
|
-
const edits = [];
|
|
1099
|
-
for (const renameLocation of renameLocations) {
|
|
1100
|
-
const model2 = this._libFiles.getOrCreateModel(renameLocation.fileName);
|
|
1101
|
-
if (model2) {
|
|
1102
|
-
edits.push({
|
|
1103
|
-
resource: model2.uri,
|
|
1104
|
-
versionId: void 0,
|
|
1105
|
-
textEdit: {
|
|
1106
|
-
range: this._textSpanToRange(model2, renameLocation.textSpan),
|
|
1107
|
-
text: newName
|
|
1108
|
-
}
|
|
1109
|
-
});
|
|
1110
|
-
} else {
|
|
1111
|
-
throw new Error(`Unknown file ${renameLocation.fileName}.`);
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
return { edits };
|
|
1115
|
-
});
|
|
1116
|
-
}
|
|
1117
|
-
};
|
|
1118
|
-
var InlayHintsAdapter = class extends Adapter {
|
|
1119
|
-
provideInlayHints(model, range, token) {
|
|
1120
|
-
return __async(this, null, function* () {
|
|
1121
|
-
const resource = model.uri;
|
|
1122
|
-
const fileName = resource.toString();
|
|
1123
|
-
const start = model.getOffsetAt({
|
|
1124
|
-
lineNumber: range.startLineNumber,
|
|
1125
|
-
column: range.startColumn
|
|
1126
|
-
});
|
|
1127
|
-
const end = model.getOffsetAt({
|
|
1128
|
-
lineNumber: range.endLineNumber,
|
|
1129
|
-
column: range.endColumn
|
|
1130
|
-
});
|
|
1131
|
-
const worker = yield this._worker(resource);
|
|
1132
|
-
if (model.isDisposed()) {
|
|
1133
|
-
return null;
|
|
1134
|
-
}
|
|
1135
|
-
const tsHints = yield worker.provideInlayHints(fileName, start, end);
|
|
1136
|
-
const hints = tsHints.map((hint) => {
|
|
1137
|
-
return __spreadProps(__spreadValues({}, hint), {
|
|
1138
|
-
label: hint.text,
|
|
1139
|
-
position: model.getPositionAt(hint.position),
|
|
1140
|
-
kind: this._convertHintKind(hint.kind)
|
|
1141
|
-
});
|
|
1142
|
-
});
|
|
1143
|
-
return { hints, dispose: () => {
|
|
1144
|
-
} };
|
|
1145
|
-
});
|
|
1146
|
-
}
|
|
1147
|
-
_convertHintKind(kind) {
|
|
1148
|
-
switch (kind) {
|
|
1149
|
-
case "Parameter":
|
|
1150
|
-
return monaco_editor_core_exports.languages.InlayHintKind.Parameter;
|
|
1151
|
-
case "Type":
|
|
1152
|
-
return monaco_editor_core_exports.languages.InlayHintKind.Type;
|
|
1153
|
-
default:
|
|
1154
|
-
return monaco_editor_core_exports.languages.InlayHintKind.Type;
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
};
|
|
1158
|
-
var javaScriptWorker;
|
|
1159
|
-
var typeScriptWorker;
|
|
1160
|
-
function setupTypeScript(defaults) {
|
|
1161
|
-
typeScriptWorker = setupMode(defaults, "typescript");
|
|
1162
|
-
}
|
|
1163
|
-
function setupJavaScript(defaults) {
|
|
1164
|
-
javaScriptWorker = setupMode(defaults, "javascript");
|
|
1165
|
-
}
|
|
1166
|
-
function getJavaScriptWorker() {
|
|
1167
|
-
return new Promise((resolve, reject) => {
|
|
1168
|
-
if (!javaScriptWorker) {
|
|
1169
|
-
return reject("JavaScript not registered!");
|
|
1170
|
-
}
|
|
1171
|
-
resolve(javaScriptWorker);
|
|
1172
|
-
});
|
|
1173
|
-
}
|
|
1174
|
-
function getTypeScriptWorker() {
|
|
1175
|
-
return new Promise((resolve, reject) => {
|
|
1176
|
-
if (!typeScriptWorker) {
|
|
1177
|
-
return reject("TypeScript not registered!");
|
|
1178
|
-
}
|
|
1179
|
-
resolve(typeScriptWorker);
|
|
1180
|
-
});
|
|
1181
|
-
}
|
|
1182
|
-
function setupMode(defaults, modeId) {
|
|
1183
|
-
const providers = [];
|
|
1184
|
-
const client = new WorkerManager(modeId, defaults);
|
|
1185
|
-
const worker = (...uris) => {
|
|
1186
|
-
return client.getLanguageServiceWorker(...uris);
|
|
1187
|
-
};
|
|
1188
|
-
const libFiles = new LibFiles(worker);
|
|
1189
|
-
function registerProviders() {
|
|
1190
|
-
const { modeConfiguration } = defaults;
|
|
1191
|
-
disposeAll(providers);
|
|
1192
|
-
if (modeConfiguration.completionItems) {
|
|
1193
|
-
providers.push(
|
|
1194
|
-
monaco_editor_core_exports.languages.registerCompletionItemProvider(
|
|
1195
|
-
modeId,
|
|
1196
|
-
new SuggestAdapter(worker)
|
|
1197
|
-
)
|
|
1198
|
-
);
|
|
1199
|
-
}
|
|
1200
|
-
if (modeConfiguration.signatureHelp) {
|
|
1201
|
-
providers.push(
|
|
1202
|
-
monaco_editor_core_exports.languages.registerSignatureHelpProvider(
|
|
1203
|
-
modeId,
|
|
1204
|
-
new SignatureHelpAdapter(worker)
|
|
1205
|
-
)
|
|
1206
|
-
);
|
|
1207
|
-
}
|
|
1208
|
-
if (modeConfiguration.hovers) {
|
|
1209
|
-
providers.push(
|
|
1210
|
-
monaco_editor_core_exports.languages.registerHoverProvider(modeId, new QuickInfoAdapter(worker))
|
|
1211
|
-
);
|
|
1212
|
-
}
|
|
1213
|
-
if (modeConfiguration.documentHighlights) {
|
|
1214
|
-
providers.push(
|
|
1215
|
-
monaco_editor_core_exports.languages.registerDocumentHighlightProvider(
|
|
1216
|
-
modeId,
|
|
1217
|
-
new DocumentHighlightAdapter(worker)
|
|
1218
|
-
)
|
|
1219
|
-
);
|
|
1220
|
-
}
|
|
1221
|
-
if (modeConfiguration.definitions) {
|
|
1222
|
-
providers.push(
|
|
1223
|
-
monaco_editor_core_exports.languages.registerDefinitionProvider(
|
|
1224
|
-
modeId,
|
|
1225
|
-
new DefinitionAdapter(libFiles, worker)
|
|
1226
|
-
)
|
|
1227
|
-
);
|
|
1228
|
-
}
|
|
1229
|
-
if (modeConfiguration.references) {
|
|
1230
|
-
providers.push(
|
|
1231
|
-
monaco_editor_core_exports.languages.registerReferenceProvider(
|
|
1232
|
-
modeId,
|
|
1233
|
-
new ReferenceAdapter(libFiles, worker)
|
|
1234
|
-
)
|
|
1235
|
-
);
|
|
1236
|
-
}
|
|
1237
|
-
if (modeConfiguration.documentSymbols) {
|
|
1238
|
-
providers.push(
|
|
1239
|
-
monaco_editor_core_exports.languages.registerDocumentSymbolProvider(
|
|
1240
|
-
modeId,
|
|
1241
|
-
new OutlineAdapter(worker)
|
|
1242
|
-
)
|
|
1243
|
-
);
|
|
1244
|
-
}
|
|
1245
|
-
if (modeConfiguration.rename) {
|
|
1246
|
-
providers.push(
|
|
1247
|
-
monaco_editor_core_exports.languages.registerRenameProvider(
|
|
1248
|
-
modeId,
|
|
1249
|
-
new RenameAdapter(libFiles, worker)
|
|
1250
|
-
)
|
|
1251
|
-
);
|
|
1252
|
-
}
|
|
1253
|
-
if (modeConfiguration.documentRangeFormattingEdits) {
|
|
1254
|
-
providers.push(
|
|
1255
|
-
monaco_editor_core_exports.languages.registerDocumentRangeFormattingEditProvider(
|
|
1256
|
-
modeId,
|
|
1257
|
-
new FormatAdapter(worker)
|
|
1258
|
-
)
|
|
1259
|
-
);
|
|
1260
|
-
}
|
|
1261
|
-
if (modeConfiguration.onTypeFormattingEdits) {
|
|
1262
|
-
providers.push(
|
|
1263
|
-
monaco_editor_core_exports.languages.registerOnTypeFormattingEditProvider(
|
|
1264
|
-
modeId,
|
|
1265
|
-
new FormatOnTypeAdapter(worker)
|
|
1266
|
-
)
|
|
1267
|
-
);
|
|
1268
|
-
}
|
|
1269
|
-
if (modeConfiguration.codeActions) {
|
|
1270
|
-
providers.push(
|
|
1271
|
-
monaco_editor_core_exports.languages.registerCodeActionProvider(modeId, new CodeActionAdaptor(worker))
|
|
1272
|
-
);
|
|
1273
|
-
}
|
|
1274
|
-
if (modeConfiguration.inlayHints) {
|
|
1275
|
-
providers.push(
|
|
1276
|
-
monaco_editor_core_exports.languages.registerInlayHintsProvider(modeId, new InlayHintsAdapter(worker))
|
|
1277
|
-
);
|
|
1278
|
-
}
|
|
1279
|
-
if (modeConfiguration.diagnostics) {
|
|
1280
|
-
providers.push(new DiagnosticsAdapter(libFiles, defaults, modeId, worker));
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
registerProviders();
|
|
1284
|
-
return worker;
|
|
1285
|
-
}
|
|
1286
|
-
function disposeAll(disposables) {
|
|
1287
|
-
while (disposables.length) {
|
|
1288
|
-
disposables.pop().dispose();
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
export {
|
|
1292
|
-
Adapter,
|
|
1293
|
-
CodeActionAdaptor,
|
|
1294
|
-
DefinitionAdapter,
|
|
1295
|
-
DiagnosticsAdapter,
|
|
1296
|
-
DocumentHighlightAdapter,
|
|
1297
|
-
FormatAdapter,
|
|
1298
|
-
FormatHelper,
|
|
1299
|
-
FormatOnTypeAdapter,
|
|
1300
|
-
InlayHintsAdapter,
|
|
1301
|
-
Kind,
|
|
1302
|
-
LibFiles,
|
|
1303
|
-
OutlineAdapter,
|
|
1304
|
-
QuickInfoAdapter,
|
|
1305
|
-
ReferenceAdapter,
|
|
1306
|
-
RenameAdapter,
|
|
1307
|
-
SignatureHelpAdapter,
|
|
1308
|
-
SuggestAdapter,
|
|
1309
|
-
WorkerManager,
|
|
1310
|
-
flattenDiagnosticMessageText,
|
|
1311
|
-
getJavaScriptWorker,
|
|
1312
|
-
getTypeScriptWorker,
|
|
1313
|
-
setupJavaScript,
|
|
1314
|
-
setupTypeScript
|
|
1315
|
-
};
|