datacontract-editor 0.1.11 → 0.1.12

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