@easyv/biz-components 0.0.52-beta.0 → 0.0.52-beta.2

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