@kong-ui-public/monaco-editor 0.1.1 → 0.1.2-pr.2609.2ce4f4787.0

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 (100) hide show
  1. package/dist/abap-D0Neqhq6.js +1404 -0
  2. package/dist/apex-B5LhxkeG.js +332 -0
  3. package/dist/azcli-BrBH0QTU.js +74 -0
  4. package/dist/bat-BfzAov64.js +106 -0
  5. package/dist/bicep-C3bCSWel.js +108 -0
  6. package/dist/cameligo-sFL5plcd.js +180 -0
  7. package/dist/clojure-CfeExRz0.js +767 -0
  8. package/dist/coffee-Xws5K0WL.js +238 -0
  9. package/dist/cpp-CqOUEpxN.js +395 -0
  10. package/dist/csharp-DVLiBOZb.js +332 -0
  11. package/dist/csp-DVFp9bw5.js +59 -0
  12. package/dist/css-DwARn2R6.js +193 -0
  13. package/dist/cssMode-BRHW0OjB.js +1577 -0
  14. package/dist/cypher-uY0Mffat.js +269 -0
  15. package/dist/dart-D27H-mX_.js +287 -0
  16. package/dist/dockerfile-CmV85WZK.js +136 -0
  17. package/dist/ecl--fKn7yzB.js +462 -0
  18. package/dist/editor.main-BVWEsGeM.js +112170 -0
  19. package/dist/elixir-DUhH17ON.js +575 -0
  20. package/dist/flow9-B3Dx2LLe.js +148 -0
  21. package/dist/freemarker2-DrnILGvf.js +995 -0
  22. package/dist/fsharp-SyqBfUAR.js +223 -0
  23. package/dist/go-BbMR2tdT.js +224 -0
  24. package/dist/graphql-DDJE6tIl.js +157 -0
  25. package/dist/handlebars-D2vGkdp7.js +425 -0
  26. package/dist/hcl-YBvpaUqf.js +189 -0
  27. package/dist/html-D3HI-WFO.js +314 -0
  28. package/dist/htmlMode-CNpiDTvN.js +1587 -0
  29. package/dist/ini-Ct73dBtM.js +77 -0
  30. package/dist/java-C_jlkwoG.js +238 -0
  31. package/dist/javascript-DLZMP-Wa.js +76 -0
  32. package/dist/jsonMode-CEQtUpLb.js +2002 -0
  33. package/dist/julia-D8WE5U1e.js +517 -0
  34. package/dist/kotlin-Zy9aq5yB.js +259 -0
  35. package/dist/less-sZ0iHtE8.js +168 -0
  36. package/dist/lexon-CsdNL29A.js +163 -0
  37. package/dist/liquid-CnqLoV0A.js +246 -0
  38. package/dist/lua-C2YJo0zw.js +168 -0
  39. package/dist/m3-CPLP40SG.js +216 -0
  40. package/dist/markdown-B1mf5e0R.js +235 -0
  41. package/dist/mdx-C6hXTTY6.js +171 -0
  42. package/dist/mips-DA33BZX1.js +204 -0
  43. package/dist/monaco-editor.es.js +224 -14
  44. package/dist/monaco-editor.umd.js +1913 -1
  45. package/dist/msdax-CCYFIQsP.js +381 -0
  46. package/dist/mysql-hjmIjL-D.js +884 -0
  47. package/dist/objective-c-RRCpEmqC.js +189 -0
  48. package/dist/pascal-CeV8XfxB.js +257 -0
  49. package/dist/pascaligo-IEEGVJAJ.js +170 -0
  50. package/dist/perl-B5-QbHq_.js +632 -0
  51. package/dist/pgsql-s6kqEJmi.js +857 -0
  52. package/dist/php-CWWqzOo8.js +506 -0
  53. package/dist/pla-FSvb_YP_.js +143 -0
  54. package/dist/postiats-DQdscQXO.js +913 -0
  55. package/dist/powerquery-CtA5JA1I.js +896 -0
  56. package/dist/powershell-DglEq96N.js +245 -0
  57. package/dist/protobuf-BSepub3e.js +426 -0
  58. package/dist/pug-B1847F4G.js +408 -0
  59. package/dist/python-CGI_fE8F.js +307 -0
  60. package/dist/qsharp-D4i0Nqg9.js +307 -0
  61. package/dist/r-cdRigKxa.js +249 -0
  62. package/dist/razor-DNVpjohl.js +556 -0
  63. package/dist/redis-D9MFxvE8.js +308 -0
  64. package/dist/redshift-CmCnsvL-.js +815 -0
  65. package/dist/restructuredtext-CWy8J51t.js +180 -0
  66. package/dist/ruby-WP-c36m5.js +517 -0
  67. package/dist/rust-Q9FLdYpu.js +349 -0
  68. package/dist/sb-C54-JBGT.js +121 -0
  69. package/dist/scala-CzbFImc5.js +376 -0
  70. package/dist/scheme-BhfDmYN3.js +114 -0
  71. package/dist/scss-CEmiBXpS.js +268 -0
  72. package/dist/shell-Bmc1VhG0.js +227 -0
  73. package/dist/solidity-C9Q2I8Hh.js +1373 -0
  74. package/dist/sophia-jWa1UyKz.js +205 -0
  75. package/dist/sparql-CM7jctbc.js +207 -0
  76. package/dist/sql-WzihTkbg.js +859 -0
  77. package/dist/st-6y7_3aup.js +422 -0
  78. package/dist/style.css +1 -0
  79. package/dist/swift-k-0zxG_D.js +318 -0
  80. package/dist/systemverilog-Pnr5_rIP.js +582 -0
  81. package/dist/tcl-fNPXval8.js +238 -0
  82. package/dist/tsMode-CRUDJ1Gx.js +895 -0
  83. package/dist/twig-L2MkztkV.js +398 -0
  84. package/dist/types/composables/useMonacoEditor.d.ts +25 -0
  85. package/dist/types/composables/useMonacoEditor.d.ts.map +1 -0
  86. package/dist/types/constants/index.d.ts +3 -0
  87. package/dist/types/constants/index.d.ts.map +1 -0
  88. package/dist/types/index.d.ts +1 -0
  89. package/dist/types/index.d.ts.map +1 -1
  90. package/dist/types/tests/mocks/monaco-editor-api.d.ts +78 -0
  91. package/dist/types/tests/mocks/monaco-editor-api.d.ts.map +1 -0
  92. package/dist/types/types/index.d.ts +68 -1
  93. package/dist/types/types/index.d.ts.map +1 -1
  94. package/dist/typescript-C2FvJtQm.js +349 -0
  95. package/dist/typespec-Cqqo-3Pt.js +123 -0
  96. package/dist/vb-B5YC2xN9.js +378 -0
  97. package/dist/wgsl-B-_uRex7.js +445 -0
  98. package/dist/xml-e_XsfZP6.js +101 -0
  99. package/dist/yaml-DOzdDlyx.js +212 -0
  100. package/package.json +14 -8
@@ -0,0 +1,895 @@
1
+ import { t as O, m as I } from "./editor.main-BVWEsGeM.js";
2
+ /*!-----------------------------------------------------------------------------
3
+ * Copyright (c) Microsoft Corporation. All rights reserved.
4
+ * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
5
+ * Released under the MIT license
6
+ * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
7
+ *-----------------------------------------------------------------------------*/
8
+ var N = Object.defineProperty, M = Object.getOwnPropertyDescriptor, R = Object.getOwnPropertyNames, K = Object.prototype.hasOwnProperty, E = (e, t, i, o) => {
9
+ if (t && typeof t == "object" || typeof t == "function")
10
+ for (let n of R(t))
11
+ !K.call(e, n) && n !== i && N(e, n, { get: () => t[n], enumerable: !(o = M(t, n)) || o.enumerable });
12
+ return e;
13
+ }, H = (e, t, i) => (E(e, t, "default"), i), a = {};
14
+ H(a, I);
15
+ var V = class {
16
+ constructor(e, t) {
17
+ this._modeId = e, this._defaults = t, this._worker = null, this._client = null, this._configChangeListener = this._defaults.onDidChange(() => this._stopWorker()), this._updateExtraLibsToken = 0, this._extraLibsChangeListener = this._defaults.onDidExtraLibsChange(
18
+ () => this._updateExtraLibs()
19
+ );
20
+ }
21
+ dispose() {
22
+ this._configChangeListener.dispose(), this._extraLibsChangeListener.dispose(), this._stopWorker();
23
+ }
24
+ _stopWorker() {
25
+ this._worker && (this._worker.dispose(), this._worker = null), this._client = null;
26
+ }
27
+ async _updateExtraLibs() {
28
+ if (!this._worker)
29
+ return;
30
+ const e = ++this._updateExtraLibsToken, t = await this._worker.getProxy();
31
+ this._updateExtraLibsToken === e && t.updateExtraLibs(this._defaults.getExtraLibs());
32
+ }
33
+ _getClient() {
34
+ return this._client || (this._client = (async () => (this._worker = a.editor.createWebWorker({
35
+ // module that exports the create() method and returns a `TypeScriptWorker` instance
36
+ moduleId: "vs/language/typescript/tsWorker",
37
+ label: this._modeId,
38
+ keepIdleModels: !0,
39
+ // passed in to the create() method
40
+ createData: {
41
+ compilerOptions: this._defaults.getCompilerOptions(),
42
+ extraLibs: this._defaults.getExtraLibs(),
43
+ customWorkerPath: this._defaults.workerOptions.customWorkerPath,
44
+ inlayHintsOptions: this._defaults.inlayHintsOptions
45
+ }
46
+ }), this._defaults.getEagerModelSync() ? await this._worker.withSyncedResources(
47
+ a.editor.getModels().filter((e) => e.getLanguageId() === this._modeId).map((e) => e.uri)
48
+ ) : await this._worker.getProxy()))()), this._client;
49
+ }
50
+ async getLanguageServiceWorker(...e) {
51
+ const t = await this._getClient();
52
+ return this._worker && await this._worker.withSyncedResources(e), t;
53
+ }
54
+ }, r = {};
55
+ r["lib.d.ts"] = !0;
56
+ r["lib.decorators.d.ts"] = !0;
57
+ r["lib.decorators.legacy.d.ts"] = !0;
58
+ r["lib.dom.asynciterable.d.ts"] = !0;
59
+ r["lib.dom.d.ts"] = !0;
60
+ r["lib.dom.iterable.d.ts"] = !0;
61
+ r["lib.es2015.collection.d.ts"] = !0;
62
+ r["lib.es2015.core.d.ts"] = !0;
63
+ r["lib.es2015.d.ts"] = !0;
64
+ r["lib.es2015.generator.d.ts"] = !0;
65
+ r["lib.es2015.iterable.d.ts"] = !0;
66
+ r["lib.es2015.promise.d.ts"] = !0;
67
+ r["lib.es2015.proxy.d.ts"] = !0;
68
+ r["lib.es2015.reflect.d.ts"] = !0;
69
+ r["lib.es2015.symbol.d.ts"] = !0;
70
+ r["lib.es2015.symbol.wellknown.d.ts"] = !0;
71
+ r["lib.es2016.array.include.d.ts"] = !0;
72
+ r["lib.es2016.d.ts"] = !0;
73
+ r["lib.es2016.full.d.ts"] = !0;
74
+ r["lib.es2016.intl.d.ts"] = !0;
75
+ r["lib.es2017.d.ts"] = !0;
76
+ r["lib.es2017.date.d.ts"] = !0;
77
+ r["lib.es2017.full.d.ts"] = !0;
78
+ r["lib.es2017.intl.d.ts"] = !0;
79
+ r["lib.es2017.object.d.ts"] = !0;
80
+ r["lib.es2017.sharedmemory.d.ts"] = !0;
81
+ r["lib.es2017.string.d.ts"] = !0;
82
+ r["lib.es2017.typedarrays.d.ts"] = !0;
83
+ r["lib.es2018.asyncgenerator.d.ts"] = !0;
84
+ r["lib.es2018.asynciterable.d.ts"] = !0;
85
+ r["lib.es2018.d.ts"] = !0;
86
+ r["lib.es2018.full.d.ts"] = !0;
87
+ r["lib.es2018.intl.d.ts"] = !0;
88
+ r["lib.es2018.promise.d.ts"] = !0;
89
+ r["lib.es2018.regexp.d.ts"] = !0;
90
+ r["lib.es2019.array.d.ts"] = !0;
91
+ r["lib.es2019.d.ts"] = !0;
92
+ r["lib.es2019.full.d.ts"] = !0;
93
+ r["lib.es2019.intl.d.ts"] = !0;
94
+ r["lib.es2019.object.d.ts"] = !0;
95
+ r["lib.es2019.string.d.ts"] = !0;
96
+ r["lib.es2019.symbol.d.ts"] = !0;
97
+ r["lib.es2020.bigint.d.ts"] = !0;
98
+ r["lib.es2020.d.ts"] = !0;
99
+ r["lib.es2020.date.d.ts"] = !0;
100
+ r["lib.es2020.full.d.ts"] = !0;
101
+ r["lib.es2020.intl.d.ts"] = !0;
102
+ r["lib.es2020.number.d.ts"] = !0;
103
+ r["lib.es2020.promise.d.ts"] = !0;
104
+ r["lib.es2020.sharedmemory.d.ts"] = !0;
105
+ r["lib.es2020.string.d.ts"] = !0;
106
+ r["lib.es2020.symbol.wellknown.d.ts"] = !0;
107
+ r["lib.es2021.d.ts"] = !0;
108
+ r["lib.es2021.full.d.ts"] = !0;
109
+ r["lib.es2021.intl.d.ts"] = !0;
110
+ r["lib.es2021.promise.d.ts"] = !0;
111
+ r["lib.es2021.string.d.ts"] = !0;
112
+ r["lib.es2021.weakref.d.ts"] = !0;
113
+ r["lib.es2022.array.d.ts"] = !0;
114
+ r["lib.es2022.d.ts"] = !0;
115
+ r["lib.es2022.error.d.ts"] = !0;
116
+ r["lib.es2022.full.d.ts"] = !0;
117
+ r["lib.es2022.intl.d.ts"] = !0;
118
+ r["lib.es2022.object.d.ts"] = !0;
119
+ r["lib.es2022.regexp.d.ts"] = !0;
120
+ r["lib.es2022.sharedmemory.d.ts"] = !0;
121
+ r["lib.es2022.string.d.ts"] = !0;
122
+ r["lib.es2023.array.d.ts"] = !0;
123
+ r["lib.es2023.collection.d.ts"] = !0;
124
+ r["lib.es2023.d.ts"] = !0;
125
+ r["lib.es2023.full.d.ts"] = !0;
126
+ r["lib.es5.d.ts"] = !0;
127
+ r["lib.es6.d.ts"] = !0;
128
+ r["lib.esnext.collection.d.ts"] = !0;
129
+ r["lib.esnext.d.ts"] = !0;
130
+ r["lib.esnext.decorators.d.ts"] = !0;
131
+ r["lib.esnext.disposable.d.ts"] = !0;
132
+ r["lib.esnext.full.d.ts"] = !0;
133
+ r["lib.esnext.intl.d.ts"] = !0;
134
+ r["lib.esnext.object.d.ts"] = !0;
135
+ r["lib.esnext.promise.d.ts"] = !0;
136
+ r["lib.scripthost.d.ts"] = !0;
137
+ r["lib.webworker.asynciterable.d.ts"] = !0;
138
+ r["lib.webworker.d.ts"] = !0;
139
+ r["lib.webworker.importscripts.d.ts"] = !0;
140
+ r["lib.webworker.iterable.d.ts"] = !0;
141
+ function D(e, t, i = 0) {
142
+ if (typeof e == "string")
143
+ return e;
144
+ if (e === void 0)
145
+ return "";
146
+ let o = "";
147
+ if (i) {
148
+ o += t;
149
+ for (let n = 0; n < i; n++)
150
+ o += " ";
151
+ }
152
+ if (o += e.messageText, i++, e.next)
153
+ for (const n of e.next)
154
+ o += D(n, t, i);
155
+ return o;
156
+ }
157
+ function w(e) {
158
+ return e ? e.map((t) => t.text).join("") : "";
159
+ }
160
+ var _ = class {
161
+ constructor(e) {
162
+ this._worker = e;
163
+ }
164
+ // protected _positionToOffset(model: editor.ITextModel, position: monaco.IPosition): number {
165
+ // return model.getOffsetAt(position);
166
+ // }
167
+ // protected _offsetToPosition(model: editor.ITextModel, offset: number): monaco.IPosition {
168
+ // return model.getPositionAt(offset);
169
+ // }
170
+ _textSpanToRange(e, t) {
171
+ let i = e.getPositionAt(t.start), o = e.getPositionAt(t.start + t.length), { lineNumber: n, column: c } = i, { lineNumber: u, column: s } = o;
172
+ return { startLineNumber: n, startColumn: c, endLineNumber: u, endColumn: s };
173
+ }
174
+ }, W = class {
175
+ constructor(e) {
176
+ this._worker = e, this._libFiles = {}, this._hasFetchedLibFiles = !1, this._fetchLibFilesPromise = null;
177
+ }
178
+ isLibFile(e) {
179
+ return e && e.path.indexOf("/lib.") === 0 ? !!r[e.path.slice(1)] : !1;
180
+ }
181
+ getOrCreateModel(e) {
182
+ const t = a.Uri.parse(e), i = a.editor.getModel(t);
183
+ if (i)
184
+ return i;
185
+ if (this.isLibFile(t) && this._hasFetchedLibFiles)
186
+ return a.editor.createModel(this._libFiles[t.path.slice(1)], "typescript", t);
187
+ const o = O.getExtraLibs()[e];
188
+ return o ? a.editor.createModel(o.content, "typescript", t) : null;
189
+ }
190
+ _containsLibFile(e) {
191
+ for (let t of e)
192
+ if (this.isLibFile(t))
193
+ return !0;
194
+ return !1;
195
+ }
196
+ async fetchLibFilesIfNecessary(e) {
197
+ this._containsLibFile(e) && await this._fetchLibFiles();
198
+ }
199
+ _fetchLibFiles() {
200
+ return this._fetchLibFilesPromise || (this._fetchLibFilesPromise = this._worker().then((e) => e.getLibFiles()).then((e) => {
201
+ this._hasFetchedLibFiles = !0, this._libFiles = e;
202
+ })), this._fetchLibFilesPromise;
203
+ }
204
+ }, j = class extends _ {
205
+ constructor(e, t, i, o) {
206
+ super(o), this._libFiles = e, this._defaults = t, this._selector = i, this._disposables = [], this._listener = /* @__PURE__ */ Object.create(null);
207
+ const n = (s) => {
208
+ if (s.getLanguageId() !== i)
209
+ return;
210
+ const l = () => {
211
+ const { onlyVisible: h } = this._defaults.getDiagnosticsOptions();
212
+ h ? s.isAttachedToEditor() && this._doValidate(s) : this._doValidate(s);
213
+ };
214
+ let g;
215
+ const d = s.onDidChangeContent(() => {
216
+ clearTimeout(g), g = window.setTimeout(l, 500);
217
+ }), b = s.onDidChangeAttached(() => {
218
+ const { onlyVisible: h } = this._defaults.getDiagnosticsOptions();
219
+ h && (s.isAttachedToEditor() ? l() : a.editor.setModelMarkers(s, this._selector, []));
220
+ });
221
+ this._listener[s.uri.toString()] = {
222
+ dispose() {
223
+ d.dispose(), b.dispose(), clearTimeout(g);
224
+ }
225
+ }, l();
226
+ }, c = (s) => {
227
+ a.editor.setModelMarkers(s, this._selector, []);
228
+ const l = s.uri.toString();
229
+ this._listener[l] && (this._listener[l].dispose(), delete this._listener[l]);
230
+ };
231
+ this._disposables.push(
232
+ a.editor.onDidCreateModel((s) => n(s))
233
+ ), this._disposables.push(a.editor.onWillDisposeModel(c)), this._disposables.push(
234
+ a.editor.onDidChangeModelLanguage((s) => {
235
+ c(s.model), n(s.model);
236
+ })
237
+ ), this._disposables.push({
238
+ dispose() {
239
+ for (const s of a.editor.getModels())
240
+ c(s);
241
+ }
242
+ });
243
+ const u = () => {
244
+ for (const s of a.editor.getModels())
245
+ c(s), n(s);
246
+ };
247
+ this._disposables.push(this._defaults.onDidChange(u)), this._disposables.push(this._defaults.onDidExtraLibsChange(u)), a.editor.getModels().forEach((s) => n(s));
248
+ }
249
+ dispose() {
250
+ this._disposables.forEach((e) => e && e.dispose()), this._disposables = [];
251
+ }
252
+ async _doValidate(e) {
253
+ const t = await this._worker(e.uri);
254
+ if (e.isDisposed())
255
+ return;
256
+ const i = [], { noSyntaxValidation: o, noSemanticValidation: n, noSuggestionDiagnostics: c } = this._defaults.getDiagnosticsOptions();
257
+ o || i.push(t.getSyntacticDiagnostics(e.uri.toString())), n || i.push(t.getSemanticDiagnostics(e.uri.toString())), c || i.push(t.getSuggestionDiagnostics(e.uri.toString()));
258
+ const u = await Promise.all(i);
259
+ if (!u || e.isDisposed())
260
+ return;
261
+ const s = u.reduce((g, d) => d.concat(g), []).filter(
262
+ (g) => (this._defaults.getDiagnosticsOptions().diagnosticCodesToIgnore || []).indexOf(g.code) === -1
263
+ ), l = s.map((g) => g.relatedInformation || []).reduce((g, d) => d.concat(g), []).map(
264
+ (g) => g.file ? a.Uri.parse(g.file.fileName) : null
265
+ );
266
+ await this._libFiles.fetchLibFilesIfNecessary(l), !e.isDisposed() && a.editor.setModelMarkers(
267
+ e,
268
+ this._selector,
269
+ s.map((g) => this._convertDiagnostics(e, g))
270
+ );
271
+ }
272
+ _convertDiagnostics(e, t) {
273
+ const i = t.start || 0, o = t.length || 1, { lineNumber: n, column: c } = e.getPositionAt(i), { lineNumber: u, column: s } = e.getPositionAt(
274
+ i + o
275
+ ), l = [];
276
+ return t.reportsUnnecessary && l.push(a.MarkerTag.Unnecessary), t.reportsDeprecated && l.push(a.MarkerTag.Deprecated), {
277
+ severity: this._tsDiagnosticCategoryToMarkerSeverity(t.category),
278
+ startLineNumber: n,
279
+ startColumn: c,
280
+ endLineNumber: u,
281
+ endColumn: s,
282
+ message: D(t.messageText, `
283
+ `),
284
+ code: t.code.toString(),
285
+ tags: l,
286
+ relatedInformation: this._convertRelatedInformation(e, t.relatedInformation)
287
+ };
288
+ }
289
+ _convertRelatedInformation(e, t) {
290
+ if (!t)
291
+ return [];
292
+ const i = [];
293
+ return t.forEach((o) => {
294
+ let n = e;
295
+ if (o.file && (n = this._libFiles.getOrCreateModel(o.file.fileName)), !n)
296
+ return;
297
+ const c = o.start || 0, u = o.length || 1, { lineNumber: s, column: l } = n.getPositionAt(c), { lineNumber: g, column: d } = n.getPositionAt(
298
+ c + u
299
+ );
300
+ i.push({
301
+ resource: n.uri,
302
+ startLineNumber: s,
303
+ startColumn: l,
304
+ endLineNumber: g,
305
+ endColumn: d,
306
+ message: D(o.messageText, `
307
+ `)
308
+ });
309
+ }), i;
310
+ }
311
+ _tsDiagnosticCategoryToMarkerSeverity(e) {
312
+ switch (e) {
313
+ case 1:
314
+ return a.MarkerSeverity.Error;
315
+ case 3:
316
+ return a.MarkerSeverity.Info;
317
+ case 0:
318
+ return a.MarkerSeverity.Warning;
319
+ case 2:
320
+ return a.MarkerSeverity.Hint;
321
+ }
322
+ return a.MarkerSeverity.Info;
323
+ }
324
+ }, B = class C extends _ {
325
+ get triggerCharacters() {
326
+ return ["."];
327
+ }
328
+ async provideCompletionItems(t, i, o, n) {
329
+ const c = t.getWordUntilPosition(i), u = new a.Range(
330
+ i.lineNumber,
331
+ c.startColumn,
332
+ i.lineNumber,
333
+ c.endColumn
334
+ ), s = t.uri, l = t.getOffsetAt(i), g = await this._worker(s);
335
+ if (t.isDisposed())
336
+ return;
337
+ const d = await g.getCompletionsAtPosition(s.toString(), l);
338
+ return !d || t.isDisposed() ? void 0 : {
339
+ suggestions: d.entries.map((h) => {
340
+ let y = u;
341
+ if (h.replacementSpan) {
342
+ const S = t.getPositionAt(h.replacementSpan.start), x = t.getPositionAt(h.replacementSpan.start + h.replacementSpan.length);
343
+ y = new a.Range(S.lineNumber, S.column, x.lineNumber, x.column);
344
+ }
345
+ const v = [];
346
+ return h.kindModifiers !== void 0 && h.kindModifiers.indexOf("deprecated") !== -1 && v.push(a.languages.CompletionItemTag.Deprecated), {
347
+ uri: s,
348
+ position: i,
349
+ offset: l,
350
+ range: y,
351
+ label: h.name,
352
+ insertText: h.name,
353
+ sortText: h.sortText,
354
+ kind: C.convertKind(h.kind),
355
+ tags: v
356
+ };
357
+ })
358
+ };
359
+ }
360
+ async resolveCompletionItem(t, i) {
361
+ const o = t, n = o.uri, c = o.position, u = o.offset, l = await (await this._worker(n)).getCompletionEntryDetails(
362
+ n.toString(),
363
+ u,
364
+ o.label
365
+ );
366
+ return l ? {
367
+ uri: n,
368
+ position: c,
369
+ label: l.name,
370
+ kind: C.convertKind(l.kind),
371
+ detail: w(l.displayParts),
372
+ documentation: {
373
+ value: C.createDocumentationString(l)
374
+ }
375
+ } : o;
376
+ }
377
+ static convertKind(t) {
378
+ switch (t) {
379
+ case f.primitiveType:
380
+ case f.keyword:
381
+ return a.languages.CompletionItemKind.Keyword;
382
+ case f.variable:
383
+ case f.localVariable:
384
+ return a.languages.CompletionItemKind.Variable;
385
+ case f.memberVariable:
386
+ case f.memberGetAccessor:
387
+ case f.memberSetAccessor:
388
+ return a.languages.CompletionItemKind.Field;
389
+ case f.function:
390
+ case f.memberFunction:
391
+ case f.constructSignature:
392
+ case f.callSignature:
393
+ case f.indexSignature:
394
+ return a.languages.CompletionItemKind.Function;
395
+ case f.enum:
396
+ return a.languages.CompletionItemKind.Enum;
397
+ case f.module:
398
+ return a.languages.CompletionItemKind.Module;
399
+ case f.class:
400
+ return a.languages.CompletionItemKind.Class;
401
+ case f.interface:
402
+ return a.languages.CompletionItemKind.Interface;
403
+ case f.warning:
404
+ return a.languages.CompletionItemKind.File;
405
+ }
406
+ return a.languages.CompletionItemKind.Property;
407
+ }
408
+ static createDocumentationString(t) {
409
+ let i = w(t.documentation);
410
+ if (t.tags)
411
+ for (const o of t.tags)
412
+ i += `
413
+
414
+ ${T(o)}`;
415
+ return i;
416
+ }
417
+ };
418
+ function T(e) {
419
+ let t = `*@${e.name}*`;
420
+ if (e.name === "param" && e.text) {
421
+ const [i, ...o] = e.text;
422
+ t += `\`${i.text}\``, o.length > 0 && (t += ` — ${o.map((n) => n.text).join(" ")}`);
423
+ } else Array.isArray(e.text) ? t += ` — ${e.text.map((i) => i.text).join(" ")}` : e.text && (t += ` — ${e.text}`);
424
+ return t;
425
+ }
426
+ var U = class P extends _ {
427
+ constructor() {
428
+ super(...arguments), this.signatureHelpTriggerCharacters = ["(", ","];
429
+ }
430
+ static _toSignatureHelpTriggerReason(t) {
431
+ switch (t.triggerKind) {
432
+ case a.languages.SignatureHelpTriggerKind.TriggerCharacter:
433
+ return t.triggerCharacter ? t.isRetrigger ? { kind: "retrigger", triggerCharacter: t.triggerCharacter } : { kind: "characterTyped", triggerCharacter: t.triggerCharacter } : { kind: "invoked" };
434
+ case a.languages.SignatureHelpTriggerKind.ContentChange:
435
+ return t.isRetrigger ? { kind: "retrigger" } : { kind: "invoked" };
436
+ case a.languages.SignatureHelpTriggerKind.Invoke:
437
+ default:
438
+ return { kind: "invoked" };
439
+ }
440
+ }
441
+ async provideSignatureHelp(t, i, o, n) {
442
+ const c = t.uri, u = t.getOffsetAt(i), s = await this._worker(c);
443
+ if (t.isDisposed())
444
+ return;
445
+ const l = await s.getSignatureHelpItems(c.toString(), u, {
446
+ triggerReason: P._toSignatureHelpTriggerReason(n)
447
+ });
448
+ if (!l || t.isDisposed())
449
+ return;
450
+ const g = {
451
+ activeSignature: l.selectedItemIndex,
452
+ activeParameter: l.argumentIndex,
453
+ signatures: []
454
+ };
455
+ return l.items.forEach((d) => {
456
+ const b = {
457
+ label: "",
458
+ parameters: []
459
+ };
460
+ b.documentation = {
461
+ value: w(d.documentation)
462
+ }, b.label += w(d.prefixDisplayParts), d.parameters.forEach((h, y, v) => {
463
+ const S = w(h.displayParts), x = {
464
+ label: S,
465
+ documentation: {
466
+ value: w(h.documentation)
467
+ }
468
+ };
469
+ b.label += S, b.parameters.push(x), y < v.length - 1 && (b.label += w(d.separatorDisplayParts));
470
+ }), b.label += w(d.suffixDisplayParts), g.signatures.push(b);
471
+ }), {
472
+ value: g,
473
+ dispose() {
474
+ }
475
+ };
476
+ }
477
+ }, $ = class extends _ {
478
+ async provideHover(e, t, i) {
479
+ const o = e.uri, n = e.getOffsetAt(t), c = await this._worker(o);
480
+ if (e.isDisposed())
481
+ return;
482
+ const u = await c.getQuickInfoAtPosition(o.toString(), n);
483
+ if (!u || e.isDisposed())
484
+ return;
485
+ const s = w(u.documentation), l = u.tags ? u.tags.map((d) => T(d)).join(`
486
+
487
+ `) : "", g = w(u.displayParts);
488
+ return {
489
+ range: this._textSpanToRange(e, u.textSpan),
490
+ contents: [
491
+ {
492
+ value: "```typescript\n" + g + "\n```\n"
493
+ },
494
+ {
495
+ value: s + (l ? `
496
+
497
+ ` + l : "")
498
+ }
499
+ ]
500
+ };
501
+ }
502
+ }, z = class extends _ {
503
+ async provideDocumentHighlights(e, t, i) {
504
+ const o = e.uri, n = e.getOffsetAt(t), c = await this._worker(o);
505
+ if (e.isDisposed())
506
+ return;
507
+ const u = await c.getDocumentHighlights(o.toString(), n, [
508
+ o.toString()
509
+ ]);
510
+ if (!(!u || e.isDisposed()))
511
+ return u.flatMap((s) => s.highlightSpans.map((l) => ({
512
+ range: this._textSpanToRange(e, l.textSpan),
513
+ kind: l.kind === "writtenReference" ? a.languages.DocumentHighlightKind.Write : a.languages.DocumentHighlightKind.Text
514
+ })));
515
+ }
516
+ }, G = class extends _ {
517
+ constructor(e, t) {
518
+ super(t), this._libFiles = e;
519
+ }
520
+ async provideDefinition(e, t, i) {
521
+ const o = e.uri, n = e.getOffsetAt(t), c = await this._worker(o);
522
+ if (e.isDisposed())
523
+ return;
524
+ const u = await c.getDefinitionAtPosition(o.toString(), n);
525
+ if (!u || e.isDisposed() || (await this._libFiles.fetchLibFilesIfNecessary(
526
+ u.map((l) => a.Uri.parse(l.fileName))
527
+ ), e.isDisposed()))
528
+ return;
529
+ const s = [];
530
+ for (let l of u) {
531
+ const g = this._libFiles.getOrCreateModel(l.fileName);
532
+ g && s.push({
533
+ uri: g.uri,
534
+ range: this._textSpanToRange(g, l.textSpan)
535
+ });
536
+ }
537
+ return s;
538
+ }
539
+ }, J = class extends _ {
540
+ constructor(e, t) {
541
+ super(t), this._libFiles = e;
542
+ }
543
+ async provideReferences(e, t, i, o) {
544
+ const n = e.uri, c = e.getOffsetAt(t), u = await this._worker(n);
545
+ if (e.isDisposed())
546
+ return;
547
+ const s = await u.getReferencesAtPosition(n.toString(), c);
548
+ if (!s || e.isDisposed() || (await this._libFiles.fetchLibFilesIfNecessary(
549
+ s.map((g) => a.Uri.parse(g.fileName))
550
+ ), e.isDisposed()))
551
+ return;
552
+ const l = [];
553
+ for (let g of s) {
554
+ const d = this._libFiles.getOrCreateModel(g.fileName);
555
+ d && l.push({
556
+ uri: d.uri,
557
+ range: this._textSpanToRange(d, g.textSpan)
558
+ });
559
+ }
560
+ return l;
561
+ }
562
+ }, Q = class extends _ {
563
+ async provideDocumentSymbols(e, t) {
564
+ const i = e.uri, o = await this._worker(i);
565
+ if (e.isDisposed())
566
+ return;
567
+ const n = await o.getNavigationTree(i.toString());
568
+ if (!n || e.isDisposed())
569
+ return;
570
+ const c = (s, l) => {
571
+ var d;
572
+ return {
573
+ name: s.text,
574
+ detail: "",
575
+ kind: m[s.kind] || a.languages.SymbolKind.Variable,
576
+ range: this._textSpanToRange(e, s.spans[0]),
577
+ selectionRange: this._textSpanToRange(e, s.spans[0]),
578
+ tags: [],
579
+ children: (d = s.childItems) == null ? void 0 : d.map((b) => c(b, s.text)),
580
+ containerName: l
581
+ };
582
+ };
583
+ return n.childItems ? n.childItems.map((s) => c(s)) : [];
584
+ }
585
+ }, p, f = (p = class {
586
+ }, p.unknown = "", p.keyword = "keyword", p.script = "script", p.module = "module", p.class = "class", p.interface = "interface", p.type = "type", p.enum = "enum", p.variable = "var", p.localVariable = "local var", p.function = "function", p.localFunction = "local function", p.memberFunction = "method", p.memberGetAccessor = "getter", p.memberSetAccessor = "setter", p.memberVariable = "property", p.constructorImplementation = "constructor", p.callSignature = "call", p.indexSignature = "index", p.constructSignature = "construct", p.parameter = "parameter", p.typeParameter = "type parameter", p.primitiveType = "primitive type", p.label = "label", p.alias = "alias", p.const = "const", p.let = "let", p.warning = "warning", p), m = /* @__PURE__ */ Object.create(null);
587
+ m[f.module] = a.languages.SymbolKind.Module;
588
+ m[f.class] = a.languages.SymbolKind.Class;
589
+ m[f.enum] = a.languages.SymbolKind.Enum;
590
+ m[f.interface] = a.languages.SymbolKind.Interface;
591
+ m[f.memberFunction] = a.languages.SymbolKind.Method;
592
+ m[f.memberVariable] = a.languages.SymbolKind.Property;
593
+ m[f.memberGetAccessor] = a.languages.SymbolKind.Property;
594
+ m[f.memberSetAccessor] = a.languages.SymbolKind.Property;
595
+ m[f.variable] = a.languages.SymbolKind.Variable;
596
+ m[f.const] = a.languages.SymbolKind.Variable;
597
+ m[f.localVariable] = a.languages.SymbolKind.Variable;
598
+ m[f.variable] = a.languages.SymbolKind.Variable;
599
+ m[f.function] = a.languages.SymbolKind.Function;
600
+ m[f.localFunction] = a.languages.SymbolKind.Function;
601
+ var k = class extends _ {
602
+ static _convertOptions(e) {
603
+ return {
604
+ ConvertTabsToSpaces: e.insertSpaces,
605
+ TabSize: e.tabSize,
606
+ IndentSize: e.tabSize,
607
+ IndentStyle: 2,
608
+ NewLineCharacter: `
609
+ `,
610
+ InsertSpaceAfterCommaDelimiter: !0,
611
+ InsertSpaceAfterSemicolonInForStatements: !0,
612
+ InsertSpaceBeforeAndAfterBinaryOperators: !0,
613
+ InsertSpaceAfterKeywordsInControlFlowStatements: !0,
614
+ InsertSpaceAfterFunctionKeywordForAnonymousFunctions: !0,
615
+ InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: !1,
616
+ InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: !1,
617
+ InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: !1,
618
+ PlaceOpenBraceOnNewLineForControlBlocks: !1,
619
+ PlaceOpenBraceOnNewLineForFunctions: !1
620
+ };
621
+ }
622
+ _convertTextChanges(e, t) {
623
+ return {
624
+ text: t.newText,
625
+ range: this._textSpanToRange(e, t.span)
626
+ };
627
+ }
628
+ }, q = class extends k {
629
+ constructor() {
630
+ super(...arguments), this.canFormatMultipleRanges = !1;
631
+ }
632
+ async provideDocumentRangeFormattingEdits(e, t, i, o) {
633
+ const n = e.uri, c = e.getOffsetAt({
634
+ lineNumber: t.startLineNumber,
635
+ column: t.startColumn
636
+ }), u = e.getOffsetAt({
637
+ lineNumber: t.endLineNumber,
638
+ column: t.endColumn
639
+ }), s = await this._worker(n);
640
+ if (e.isDisposed())
641
+ return;
642
+ const l = await s.getFormattingEditsForRange(
643
+ n.toString(),
644
+ c,
645
+ u,
646
+ k._convertOptions(i)
647
+ );
648
+ if (!(!l || e.isDisposed()))
649
+ return l.map((g) => this._convertTextChanges(e, g));
650
+ }
651
+ }, X = class extends k {
652
+ get autoFormatTriggerCharacters() {
653
+ return [";", "}", `
654
+ `];
655
+ }
656
+ async provideOnTypeFormattingEdits(e, t, i, o, n) {
657
+ const c = e.uri, u = e.getOffsetAt(t), s = await this._worker(c);
658
+ if (e.isDisposed())
659
+ return;
660
+ const l = await s.getFormattingEditsAfterKeystroke(
661
+ c.toString(),
662
+ u,
663
+ i,
664
+ k._convertOptions(o)
665
+ );
666
+ if (!(!l || e.isDisposed()))
667
+ return l.map((g) => this._convertTextChanges(e, g));
668
+ }
669
+ }, Y = class extends k {
670
+ async provideCodeActions(e, t, i, o) {
671
+ const n = e.uri, c = e.getOffsetAt({
672
+ lineNumber: t.startLineNumber,
673
+ column: t.startColumn
674
+ }), u = e.getOffsetAt({
675
+ lineNumber: t.endLineNumber,
676
+ column: t.endColumn
677
+ }), s = k._convertOptions(e.getOptions()), l = i.markers.filter((h) => h.code).map((h) => h.code).map(Number), g = await this._worker(n);
678
+ if (e.isDisposed())
679
+ return;
680
+ const d = await g.getCodeFixesAtPosition(
681
+ n.toString(),
682
+ c,
683
+ u,
684
+ l,
685
+ s
686
+ );
687
+ return !d || e.isDisposed() ? { actions: [], dispose: () => {
688
+ } } : {
689
+ actions: d.filter((h) => h.changes.filter((y) => y.isNewFile).length === 0).map((h) => this._tsCodeFixActionToMonacoCodeAction(e, i, h)),
690
+ dispose: () => {
691
+ }
692
+ };
693
+ }
694
+ _tsCodeFixActionToMonacoCodeAction(e, t, i) {
695
+ const o = [];
696
+ for (const c of i.changes)
697
+ for (const u of c.textChanges)
698
+ o.push({
699
+ resource: e.uri,
700
+ versionId: void 0,
701
+ textEdit: {
702
+ range: this._textSpanToRange(e, u.span),
703
+ text: u.newText
704
+ }
705
+ });
706
+ return {
707
+ title: i.description,
708
+ edit: { edits: o },
709
+ diagnostics: t.markers,
710
+ kind: "quickfix"
711
+ };
712
+ }
713
+ }, Z = class extends _ {
714
+ constructor(e, t) {
715
+ super(t), this._libFiles = e;
716
+ }
717
+ async provideRenameEdits(e, t, i, o) {
718
+ const n = e.uri, c = n.toString(), u = e.getOffsetAt(t), s = await this._worker(n);
719
+ if (e.isDisposed())
720
+ return;
721
+ const l = await s.getRenameInfo(c, u, {
722
+ allowRenameOfImportPath: !1
723
+ });
724
+ if (l.canRename === !1)
725
+ return {
726
+ edits: [],
727
+ rejectReason: l.localizedErrorMessage
728
+ };
729
+ if (l.fileToRename !== void 0)
730
+ throw new Error("Renaming files is not supported.");
731
+ const g = await s.findRenameLocations(
732
+ c,
733
+ u,
734
+ /*strings*/
735
+ !1,
736
+ /*comments*/
737
+ !1,
738
+ /*prefixAndSuffix*/
739
+ !1
740
+ );
741
+ if (!g || e.isDisposed())
742
+ return;
743
+ const d = [];
744
+ for (const b of g) {
745
+ const h = this._libFiles.getOrCreateModel(b.fileName);
746
+ if (h)
747
+ d.push({
748
+ resource: h.uri,
749
+ versionId: void 0,
750
+ textEdit: {
751
+ range: this._textSpanToRange(h, b.textSpan),
752
+ text: i
753
+ }
754
+ });
755
+ else
756
+ throw new Error(`Unknown file ${b.fileName}.`);
757
+ }
758
+ return { edits: d };
759
+ }
760
+ }, ee = class extends _ {
761
+ async provideInlayHints(e, t, i) {
762
+ const o = e.uri, n = o.toString(), c = e.getOffsetAt({
763
+ lineNumber: t.startLineNumber,
764
+ column: t.startColumn
765
+ }), u = e.getOffsetAt({
766
+ lineNumber: t.endLineNumber,
767
+ column: t.endColumn
768
+ }), s = await this._worker(o);
769
+ return e.isDisposed() ? null : { hints: (await s.provideInlayHints(n, c, u)).map((d) => ({
770
+ ...d,
771
+ label: d.text,
772
+ position: e.getPositionAt(d.position),
773
+ kind: this._convertHintKind(d.kind)
774
+ })), dispose: () => {
775
+ } };
776
+ }
777
+ _convertHintKind(e) {
778
+ switch (e) {
779
+ case "Parameter":
780
+ return a.languages.InlayHintKind.Parameter;
781
+ case "Type":
782
+ return a.languages.InlayHintKind.Type;
783
+ default:
784
+ return a.languages.InlayHintKind.Type;
785
+ }
786
+ }
787
+ }, A, F;
788
+ function re(e) {
789
+ F = L(e, "typescript");
790
+ }
791
+ function ie(e) {
792
+ A = L(e, "javascript");
793
+ }
794
+ function ne() {
795
+ return new Promise((e, t) => {
796
+ if (!A)
797
+ return t("JavaScript not registered!");
798
+ e(A);
799
+ });
800
+ }
801
+ function ae() {
802
+ return new Promise((e, t) => {
803
+ if (!F)
804
+ return t("TypeScript not registered!");
805
+ e(F);
806
+ });
807
+ }
808
+ function L(e, t) {
809
+ const i = [], o = new V(t, e), n = (...s) => o.getLanguageServiceWorker(...s), c = new W(n);
810
+ function u() {
811
+ const { modeConfiguration: s } = e;
812
+ te(i), s.completionItems && i.push(
813
+ a.languages.registerCompletionItemProvider(
814
+ t,
815
+ new B(n)
816
+ )
817
+ ), s.signatureHelp && i.push(
818
+ a.languages.registerSignatureHelpProvider(
819
+ t,
820
+ new U(n)
821
+ )
822
+ ), s.hovers && i.push(
823
+ a.languages.registerHoverProvider(t, new $(n))
824
+ ), s.documentHighlights && i.push(
825
+ a.languages.registerDocumentHighlightProvider(
826
+ t,
827
+ new z(n)
828
+ )
829
+ ), s.definitions && i.push(
830
+ a.languages.registerDefinitionProvider(
831
+ t,
832
+ new G(c, n)
833
+ )
834
+ ), s.references && i.push(
835
+ a.languages.registerReferenceProvider(
836
+ t,
837
+ new J(c, n)
838
+ )
839
+ ), s.documentSymbols && i.push(
840
+ a.languages.registerDocumentSymbolProvider(
841
+ t,
842
+ new Q(n)
843
+ )
844
+ ), s.rename && i.push(
845
+ a.languages.registerRenameProvider(
846
+ t,
847
+ new Z(c, n)
848
+ )
849
+ ), s.documentRangeFormattingEdits && i.push(
850
+ a.languages.registerDocumentRangeFormattingEditProvider(
851
+ t,
852
+ new q(n)
853
+ )
854
+ ), s.onTypeFormattingEdits && i.push(
855
+ a.languages.registerOnTypeFormattingEditProvider(
856
+ t,
857
+ new X(n)
858
+ )
859
+ ), s.codeActions && i.push(
860
+ a.languages.registerCodeActionProvider(t, new Y(n))
861
+ ), s.inlayHints && i.push(
862
+ a.languages.registerInlayHintsProvider(t, new ee(n))
863
+ ), s.diagnostics && i.push(new j(c, e, t, n));
864
+ }
865
+ return u(), n;
866
+ }
867
+ function te(e) {
868
+ for (; e.length; )
869
+ e.pop().dispose();
870
+ }
871
+ export {
872
+ _ as Adapter,
873
+ Y as CodeActionAdaptor,
874
+ G as DefinitionAdapter,
875
+ j as DiagnosticsAdapter,
876
+ z as DocumentHighlightAdapter,
877
+ q as FormatAdapter,
878
+ k as FormatHelper,
879
+ X as FormatOnTypeAdapter,
880
+ ee as InlayHintsAdapter,
881
+ f as Kind,
882
+ W as LibFiles,
883
+ Q as OutlineAdapter,
884
+ $ as QuickInfoAdapter,
885
+ J as ReferenceAdapter,
886
+ Z as RenameAdapter,
887
+ U as SignatureHelpAdapter,
888
+ B as SuggestAdapter,
889
+ V as WorkerManager,
890
+ D as flattenDiagnosticMessageText,
891
+ ne as getJavaScriptWorker,
892
+ ae as getTypeScriptWorker,
893
+ ie as setupJavaScript,
894
+ re as setupTypeScript
895
+ };