@inkandswitch/patchwork-pkg-base 0.0.87 → 0.0.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/module-settings-url +1 -1
- package/package.json +1 -1
- package/packages/file/dist/assets/tsgo-worker-BDQ8_wHH.js +4 -0
- package/packages/file/dist/assets/tsgo-worker-BDQ8_wHH.js.map +4 -0
- package/packages/file/dist/assets/wasm_exec-pYYJXccF.js +440 -0
- package/packages/file/dist/assets/wasm_exec-pYYJXccF.js.map +1 -0
- package/packages/file/dist/index.js +1 -1
- package/packages/file/dist/{tool-NyxQ_6rU.js → tool-B3O4i8l2.js} +2721 -3005
- package/packages/file/dist/{tool-NyxQ_6rU.js.map → tool-B3O4i8l2.js.map} +1 -1
- package/packages/file/dist/typescript-language-server-oTU8pKzb.js +3408 -0
- package/packages/file/dist/typescript-language-server-oTU8pKzb.js.map +1 -0
- package/packages/file/package.json +3 -3
- package/plugin-registry-url +1 -1
- package/packages/file/dist/index-DnZIsnLn.js +0 -827
- package/packages/file/dist/index-DnZIsnLn.js.map +0 -1
- package/packages/file/dist/ts-env-DKYCX7_y.js +0 -67681
- package/packages/file/dist/ts-env-DKYCX7_y.js.map +0 -1
- package/packages/file/dist/typescript-BPnobwB5.js +0 -159802
- package/packages/file/dist/typescript-BPnobwB5.js.map +0 -1
|
@@ -1,827 +0,0 @@
|
|
|
1
|
-
import { EditorView as I, ViewPlugin as Z, Decoration as S, showPanel as G, hoverTooltip as M, WidgetType as X, logException as ee } from "@codemirror/view";
|
|
2
|
-
import { Facet as E, combineConfig as O, StateField as te, RangeSetBuilder as ie, StateEffect as P } from "@codemirror/state";
|
|
3
|
-
import { t as T } from "./typescript-BPnobwB5.js";
|
|
4
|
-
import { c as k } from "./tool-NyxQ_6rU.js";
|
|
5
|
-
function ne(t, e, i) {
|
|
6
|
-
t.getSourceFile(e) ? t.updateFile(e, i) : t.createFile(e, i);
|
|
7
|
-
}
|
|
8
|
-
const L = E.define({
|
|
9
|
-
combine(t) {
|
|
10
|
-
return O(t, {});
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
function Ee() {
|
|
14
|
-
let t = !0;
|
|
15
|
-
return I.updateListener.of((e) => {
|
|
16
|
-
const i = e.view.state.facet(L);
|
|
17
|
-
i && (!e.docChanged && !t || (t = !1, ne(i.env, i.path, e.state.doc.toString() || " ")));
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
function Oe() {
|
|
21
|
-
let t = !0;
|
|
22
|
-
return I.updateListener.of((e) => {
|
|
23
|
-
const i = e.view.state.facet(F);
|
|
24
|
-
i && (!e.docChanged && !t || (t = !1, i.worker.updateFile({
|
|
25
|
-
path: i.path,
|
|
26
|
-
code: e.state.doc.toString()
|
|
27
|
-
})));
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
const oe = [
|
|
31
|
-
"Object",
|
|
32
|
-
"Function",
|
|
33
|
-
"Array",
|
|
34
|
-
"Number",
|
|
35
|
-
"parseFloat",
|
|
36
|
-
"parseInt",
|
|
37
|
-
"Infinity",
|
|
38
|
-
"NaN",
|
|
39
|
-
"undefined",
|
|
40
|
-
"Boolean",
|
|
41
|
-
"String",
|
|
42
|
-
"Symbol",
|
|
43
|
-
"Date",
|
|
44
|
-
"Promise",
|
|
45
|
-
"RegExp",
|
|
46
|
-
"Error",
|
|
47
|
-
"JSON",
|
|
48
|
-
"Math",
|
|
49
|
-
"Intl",
|
|
50
|
-
"ArrayBuffer",
|
|
51
|
-
"Atomics",
|
|
52
|
-
"Uint8Array",
|
|
53
|
-
"Int8Array",
|
|
54
|
-
"Uint16Array",
|
|
55
|
-
"Int16Array",
|
|
56
|
-
"Uint32Array",
|
|
57
|
-
"Int32Array",
|
|
58
|
-
"Float32Array",
|
|
59
|
-
"Float64Array",
|
|
60
|
-
"Uint8ClampedArray",
|
|
61
|
-
"BigUint64Array",
|
|
62
|
-
"BigInt64Array",
|
|
63
|
-
"DataView",
|
|
64
|
-
"Map",
|
|
65
|
-
"BigInt",
|
|
66
|
-
"Set",
|
|
67
|
-
"WeakMap",
|
|
68
|
-
"WeakSet",
|
|
69
|
-
"decodeURI",
|
|
70
|
-
"decodeURIComponent",
|
|
71
|
-
"encodeURI",
|
|
72
|
-
"encodeURIComponent",
|
|
73
|
-
"escape",
|
|
74
|
-
"unescape",
|
|
75
|
-
"isFinite",
|
|
76
|
-
"isNaN",
|
|
77
|
-
"Deno",
|
|
78
|
-
"Blob",
|
|
79
|
-
"FormData",
|
|
80
|
-
"Request",
|
|
81
|
-
"Response",
|
|
82
|
-
"TextDecoder",
|
|
83
|
-
"TextEncoder",
|
|
84
|
-
"URL",
|
|
85
|
-
"URLPattern",
|
|
86
|
-
"URLSearchParams",
|
|
87
|
-
"atob",
|
|
88
|
-
"btoa",
|
|
89
|
-
"crypto",
|
|
90
|
-
"fetch",
|
|
91
|
-
"clearInterval",
|
|
92
|
-
"clearTimeout",
|
|
93
|
-
"performance",
|
|
94
|
-
"setInterval",
|
|
95
|
-
"setTimeout"
|
|
96
|
-
], se = /* @__PURE__ */ new Set([
|
|
97
|
-
"class",
|
|
98
|
-
"constant",
|
|
99
|
-
"enum",
|
|
100
|
-
"function",
|
|
101
|
-
"interface",
|
|
102
|
-
"keyword",
|
|
103
|
-
"method",
|
|
104
|
-
"namespace",
|
|
105
|
-
"property",
|
|
106
|
-
"text",
|
|
107
|
-
"type",
|
|
108
|
-
"variable"
|
|
109
|
-
]);
|
|
110
|
-
function re(t, e) {
|
|
111
|
-
let { source: i } = t, n = i[i.length - 1] != "$";
|
|
112
|
-
return n ? new RegExp(`(?:${i})${n ? "$" : ""}`, t.flags ?? (t.ignoreCase ? "i" : "")) : t;
|
|
113
|
-
}
|
|
114
|
-
function ae(t, e) {
|
|
115
|
-
const i = t.lastIndexOf(`
|
|
116
|
-
`, e - 1) + 1;
|
|
117
|
-
let n = t.indexOf(`
|
|
118
|
-
`, e);
|
|
119
|
-
n === -1 && (n = t.length);
|
|
120
|
-
const o = t.slice(i, n);
|
|
121
|
-
return {
|
|
122
|
-
from: i,
|
|
123
|
-
to: n,
|
|
124
|
-
text: o
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
function W(t, e, i) {
|
|
128
|
-
const n = ae(t, e);
|
|
129
|
-
let o = Math.max(n.from, e - 250), s = n.text.slice(o - n.from, e - n.from), a = s.search(re(i));
|
|
130
|
-
return a < 0 ? null : { from: o + a, to: e, text: s.slice(a) };
|
|
131
|
-
}
|
|
132
|
-
const le = [
|
|
133
|
-
T.ScriptElementKind.warning
|
|
134
|
-
];
|
|
135
|
-
async function ce({ env: t, path: e, context: i, keepLegacyLimitationForAutocompletionSymbols: n = !0 }) {
|
|
136
|
-
var d;
|
|
137
|
-
const { pos: o, explicit: s } = i, a = (d = t.getSourceFile(e)) == null ? void 0 : d.getFullText();
|
|
138
|
-
if (!a)
|
|
139
|
-
return null;
|
|
140
|
-
let r = W(a, o, /\w*/);
|
|
141
|
-
if (r != null && r.text || (r = W(a, o, /\./)), !(r != null && r.text) && !s)
|
|
142
|
-
return null;
|
|
143
|
-
const l = t.languageService.getCompletionsAtPosition(e, o, {}, {});
|
|
144
|
-
if (!l)
|
|
145
|
-
return null;
|
|
146
|
-
const c = l.entries.filter((m) => {
|
|
147
|
-
var g;
|
|
148
|
-
return !le.includes(m.kind) && (m.sortText < "15" || ((g = l.optionalReplacementSpan) == null ? void 0 : g.length) && (!n || oe.includes(m.name)));
|
|
149
|
-
}).map((m) => {
|
|
150
|
-
const g = -Number(m.sortText) || 0;
|
|
151
|
-
let f = m.kind ? String(m.kind) : void 0;
|
|
152
|
-
return f === "member" && (f = "property"), f && !se.has(f) && (f = void 0), {
|
|
153
|
-
label: m.name,
|
|
154
|
-
type: f,
|
|
155
|
-
boost: g
|
|
156
|
-
};
|
|
157
|
-
});
|
|
158
|
-
return {
|
|
159
|
-
from: r ? r.text === "." ? r.to : r.from : o,
|
|
160
|
-
options: c
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
function Be() {
|
|
164
|
-
return async (t) => {
|
|
165
|
-
const e = t.state.facet(L);
|
|
166
|
-
return e ? ce({
|
|
167
|
-
...e,
|
|
168
|
-
context: t
|
|
169
|
-
}) : null;
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
function Ue() {
|
|
173
|
-
return async (t) => {
|
|
174
|
-
const e = t.state.facet(F);
|
|
175
|
-
return e ? e.worker.getAutocompletion({
|
|
176
|
-
path: e.path,
|
|
177
|
-
// Reduce this object so that it's serializable.
|
|
178
|
-
context: {
|
|
179
|
-
pos: t.pos,
|
|
180
|
-
explicit: t.explicit
|
|
181
|
-
}
|
|
182
|
-
}) : null;
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
class $ {
|
|
186
|
-
constructor(e, i, n) {
|
|
187
|
-
this.from = e, this.to = i, this.diagnostic = n;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
class C {
|
|
191
|
-
constructor(e, i, n) {
|
|
192
|
-
this.diagnostics = e, this.panel = i, this.selected = n;
|
|
193
|
-
}
|
|
194
|
-
static init(e, i, n) {
|
|
195
|
-
let o = n.facet(x).markerFilter;
|
|
196
|
-
o && (e = o(e, n));
|
|
197
|
-
let s = e.slice().sort((f, b) => f.from - b.from || f.to - b.to), a = new ie(), r = [], l = 0, c = n.doc.iter(), d = 0, m = n.doc.length;
|
|
198
|
-
for (let f = 0; ; ) {
|
|
199
|
-
let b = f == s.length ? null : s[f];
|
|
200
|
-
if (!b && !r.length)
|
|
201
|
-
break;
|
|
202
|
-
let p, h;
|
|
203
|
-
if (r.length)
|
|
204
|
-
p = l, h = r.reduce((u, w) => Math.min(u, w.to), b && b.from > p ? b.from : 1e8);
|
|
205
|
-
else {
|
|
206
|
-
if (p = b.from, p > m)
|
|
207
|
-
break;
|
|
208
|
-
h = b.to, r.push(b), f++;
|
|
209
|
-
}
|
|
210
|
-
for (; f < s.length; ) {
|
|
211
|
-
let u = s[f];
|
|
212
|
-
if (u.from == p && (u.to > u.from || u.to == p))
|
|
213
|
-
r.push(u), f++, h = Math.min(u.to, h);
|
|
214
|
-
else {
|
|
215
|
-
h = Math.min(u.from, h);
|
|
216
|
-
break;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
h = Math.min(h, m);
|
|
220
|
-
let D = !1;
|
|
221
|
-
if (r.some((u) => u.from == p && (u.to == h || h == m)) && (D = p == h, !D && h - p < 10)) {
|
|
222
|
-
let u = p - (d + c.value.length);
|
|
223
|
-
u > 0 && (c.next(u), d = p);
|
|
224
|
-
for (let w = p; ; ) {
|
|
225
|
-
if (w >= h) {
|
|
226
|
-
D = !0;
|
|
227
|
-
break;
|
|
228
|
-
}
|
|
229
|
-
if (!c.lineBreak && d + c.value.length > w)
|
|
230
|
-
break;
|
|
231
|
-
w = d + c.value.length, d += c.value.length, c.next();
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
let U = Ce(r);
|
|
235
|
-
if (D)
|
|
236
|
-
a.add(p, p, S.widget({
|
|
237
|
-
widget: new ye(U),
|
|
238
|
-
diagnostics: r.slice()
|
|
239
|
-
}));
|
|
240
|
-
else {
|
|
241
|
-
let u = r.reduce((w, N) => N.markClass ? w + " " + N.markClass : w, "");
|
|
242
|
-
a.add(p, h, S.mark({
|
|
243
|
-
class: "cm-lintRange cm-lintRange-" + U + u,
|
|
244
|
-
diagnostics: r.slice(),
|
|
245
|
-
inclusiveEnd: r.some((w) => w.to > h)
|
|
246
|
-
}));
|
|
247
|
-
}
|
|
248
|
-
if (l = h, l == m)
|
|
249
|
-
break;
|
|
250
|
-
for (let u = 0; u < r.length; u++)
|
|
251
|
-
r[u].to <= l && r.splice(u--, 1);
|
|
252
|
-
}
|
|
253
|
-
let g = a.finish();
|
|
254
|
-
return new C(g, i, v(g));
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
function v(t, e = null, i = 0) {
|
|
258
|
-
let n = null;
|
|
259
|
-
return t.between(i, 1e9, (o, s, { spec: a }) => {
|
|
260
|
-
if (!(e && a.diagnostics.indexOf(e) < 0))
|
|
261
|
-
if (!n)
|
|
262
|
-
n = new $(o, s, e || a.diagnostics[0]);
|
|
263
|
-
else {
|
|
264
|
-
if (a.diagnostics.indexOf(n.diagnostic) < 0)
|
|
265
|
-
return !1;
|
|
266
|
-
n = new $(n.from, s, n.diagnostic);
|
|
267
|
-
}
|
|
268
|
-
}), n;
|
|
269
|
-
}
|
|
270
|
-
function fe(t, e) {
|
|
271
|
-
let i = e.pos, n = e.end || i, o = t.state.facet(x).hideOn(t, i, n);
|
|
272
|
-
if (o != null)
|
|
273
|
-
return o;
|
|
274
|
-
let s = t.startState.doc.lineAt(e.pos);
|
|
275
|
-
return !!(t.effects.some((a) => a.is(B)) || t.changes.touchesRange(s.from, Math.max(s.to, n)));
|
|
276
|
-
}
|
|
277
|
-
function de(t, e) {
|
|
278
|
-
return t.field(y, !1) ? e : e.concat(P.appendConfig.of(J));
|
|
279
|
-
}
|
|
280
|
-
function ue(t, e) {
|
|
281
|
-
return {
|
|
282
|
-
effects: de(t, [B.of(e)])
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
const B = /* @__PURE__ */ P.define(), K = /* @__PURE__ */ P.define(), z = /* @__PURE__ */ P.define(), y = /* @__PURE__ */ te.define({
|
|
286
|
-
create() {
|
|
287
|
-
return new C(S.none, null, null);
|
|
288
|
-
},
|
|
289
|
-
update(t, e) {
|
|
290
|
-
if (e.docChanged && t.diagnostics.size) {
|
|
291
|
-
let i = t.diagnostics.map(e.changes), n = null, o = t.panel;
|
|
292
|
-
if (t.selected) {
|
|
293
|
-
let s = e.changes.mapPos(t.selected.from, 1);
|
|
294
|
-
n = v(i, t.selected.diagnostic, s) || v(i, null, s);
|
|
295
|
-
}
|
|
296
|
-
!i.size && o && e.state.facet(x).autoPanel && (o = null), t = new C(i, o, n);
|
|
297
|
-
}
|
|
298
|
-
for (let i of e.effects)
|
|
299
|
-
if (i.is(B)) {
|
|
300
|
-
let n = e.state.facet(x).autoPanel ? i.value.length ? A.open : null : t.panel;
|
|
301
|
-
t = C.init(i.value, n, e.state);
|
|
302
|
-
} else i.is(K) ? t = new C(t.diagnostics, i.value ? A.open : null, t.selected) : i.is(z) && (t = new C(t.diagnostics, t.panel, i.value));
|
|
303
|
-
return t;
|
|
304
|
-
},
|
|
305
|
-
provide: (t) => [
|
|
306
|
-
G.from(t, (e) => e.panel),
|
|
307
|
-
I.decorations.from(t, (e) => e.diagnostics)
|
|
308
|
-
]
|
|
309
|
-
}), me = /* @__PURE__ */ S.mark({ class: "cm-lintRange cm-lintRange-active" });
|
|
310
|
-
function ge(t, e, i) {
|
|
311
|
-
let { diagnostics: n } = t.state.field(y), o, s = -1, a = -1;
|
|
312
|
-
n.between(e - (i < 0 ? 1 : 0), e + (i > 0 ? 1 : 0), (l, c, { spec: d }) => {
|
|
313
|
-
if (e >= l && e <= c && (l == c || (e > l || i > 0) && (e < c || i < 0)))
|
|
314
|
-
return o = d.diagnostics, s = l, a = c, !1;
|
|
315
|
-
});
|
|
316
|
-
let r = t.state.facet(x).tooltipFilter;
|
|
317
|
-
return o && r && (o = r(o, t.state)), o ? {
|
|
318
|
-
pos: s,
|
|
319
|
-
end: a,
|
|
320
|
-
above: !0,
|
|
321
|
-
create() {
|
|
322
|
-
return { dom: he(t, o) };
|
|
323
|
-
}
|
|
324
|
-
} : null;
|
|
325
|
-
}
|
|
326
|
-
function he(t, e) {
|
|
327
|
-
return k("ul", { class: "cm-tooltip-lint" }, e.map((i) => j(t, i, !1)));
|
|
328
|
-
}
|
|
329
|
-
const _ = (t) => {
|
|
330
|
-
let e = t.state.field(y, !1);
|
|
331
|
-
return !e || !e.panel ? !1 : (t.dispatch({ effects: K.of(!1) }), !0);
|
|
332
|
-
}, pe = /* @__PURE__ */ Z.fromClass(class {
|
|
333
|
-
constructor(t) {
|
|
334
|
-
this.view = t, this.timeout = -1, this.set = !0;
|
|
335
|
-
let { delay: e } = t.state.facet(x);
|
|
336
|
-
this.lintTime = Date.now() + e, this.run = this.run.bind(this), this.timeout = setTimeout(this.run, e);
|
|
337
|
-
}
|
|
338
|
-
run() {
|
|
339
|
-
clearTimeout(this.timeout);
|
|
340
|
-
let t = Date.now();
|
|
341
|
-
if (t < this.lintTime - 10)
|
|
342
|
-
this.timeout = setTimeout(this.run, this.lintTime - t);
|
|
343
|
-
else {
|
|
344
|
-
this.set = !1;
|
|
345
|
-
let { state: e } = this.view, { sources: i } = e.facet(x);
|
|
346
|
-
i.length && be(i.map((n) => Promise.resolve(n(this.view))), (n) => {
|
|
347
|
-
this.view.state.doc == e.doc && this.view.dispatch(ue(this.view.state, n.reduce((o, s) => o.concat(s))));
|
|
348
|
-
}, (n) => {
|
|
349
|
-
ee(this.view.state, n);
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
update(t) {
|
|
354
|
-
let e = t.state.facet(x);
|
|
355
|
-
(t.docChanged || e != t.startState.facet(x) || e.needsRefresh && e.needsRefresh(t)) && (this.lintTime = Date.now() + e.delay, this.set || (this.set = !0, this.timeout = setTimeout(this.run, e.delay)));
|
|
356
|
-
}
|
|
357
|
-
force() {
|
|
358
|
-
this.set && (this.lintTime = Date.now(), this.run());
|
|
359
|
-
}
|
|
360
|
-
destroy() {
|
|
361
|
-
clearTimeout(this.timeout);
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
function be(t, e, i) {
|
|
365
|
-
let n = [], o = -1;
|
|
366
|
-
for (let s of t)
|
|
367
|
-
s.then((a) => {
|
|
368
|
-
n.push(a), clearTimeout(o), n.length == t.length ? e(n) : o = setTimeout(() => e(n), 200);
|
|
369
|
-
}, i);
|
|
370
|
-
}
|
|
371
|
-
const x = /* @__PURE__ */ E.define({
|
|
372
|
-
combine(t) {
|
|
373
|
-
return {
|
|
374
|
-
sources: t.map((e) => e.source).filter((e) => e != null),
|
|
375
|
-
...O(t.map((e) => e.config), {
|
|
376
|
-
delay: 750,
|
|
377
|
-
markerFilter: null,
|
|
378
|
-
tooltipFilter: null,
|
|
379
|
-
needsRefresh: null,
|
|
380
|
-
hideOn: () => null
|
|
381
|
-
}, {
|
|
382
|
-
delay: Math.max,
|
|
383
|
-
markerFilter: H,
|
|
384
|
-
tooltipFilter: H,
|
|
385
|
-
needsRefresh: (e, i) => e ? i ? (n) => e(n) || i(n) : e : i,
|
|
386
|
-
hideOn: (e, i) => e ? i ? (n, o, s) => e(n, o, s) || i(n, o, s) : e : i,
|
|
387
|
-
autoPanel: (e, i) => e || i
|
|
388
|
-
})
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
});
|
|
392
|
-
function H(t, e) {
|
|
393
|
-
return t ? e ? (i, n) => e(t(i, n), n) : t : e;
|
|
394
|
-
}
|
|
395
|
-
function V(t, e = {}) {
|
|
396
|
-
return [
|
|
397
|
-
x.of({ source: t, config: e }),
|
|
398
|
-
pe,
|
|
399
|
-
J
|
|
400
|
-
];
|
|
401
|
-
}
|
|
402
|
-
function Y(t) {
|
|
403
|
-
let e = [];
|
|
404
|
-
if (t)
|
|
405
|
-
e: for (let { name: i } of t) {
|
|
406
|
-
for (let n = 0; n < i.length; n++) {
|
|
407
|
-
let o = i[n];
|
|
408
|
-
if (/[a-zA-Z]/.test(o) && !e.some((s) => s.toLowerCase() == o.toLowerCase())) {
|
|
409
|
-
e.push(o);
|
|
410
|
-
continue e;
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
e.push("");
|
|
414
|
-
}
|
|
415
|
-
return e;
|
|
416
|
-
}
|
|
417
|
-
function j(t, e, i) {
|
|
418
|
-
var n;
|
|
419
|
-
let o = i ? Y(e.actions) : [];
|
|
420
|
-
return k("li", { class: "cm-diagnostic cm-diagnostic-" + e.severity }, k("span", { class: "cm-diagnosticText" }, e.renderMessage ? e.renderMessage(t) : e.message), (n = e.actions) === null || n === void 0 ? void 0 : n.map((s, a) => {
|
|
421
|
-
let r = !1, l = (f) => {
|
|
422
|
-
if (f.preventDefault(), r)
|
|
423
|
-
return;
|
|
424
|
-
r = !0;
|
|
425
|
-
let b = v(t.state.field(y).diagnostics, e);
|
|
426
|
-
b && s.apply(t, b.from, b.to);
|
|
427
|
-
}, { name: c } = s, d = o[a] ? c.indexOf(o[a]) : -1, m = d < 0 ? c : [
|
|
428
|
-
c.slice(0, d),
|
|
429
|
-
k("u", c.slice(d, d + 1)),
|
|
430
|
-
c.slice(d + 1)
|
|
431
|
-
], g = s.markClass ? " " + s.markClass : "";
|
|
432
|
-
return k("button", {
|
|
433
|
-
type: "button",
|
|
434
|
-
class: "cm-diagnosticAction" + g,
|
|
435
|
-
onclick: l,
|
|
436
|
-
onmousedown: l,
|
|
437
|
-
"aria-label": ` Action: ${c}${d < 0 ? "" : ` (access key "${o[a]})"`}.`
|
|
438
|
-
}, m);
|
|
439
|
-
}), e.source && k("div", { class: "cm-diagnosticSource" }, e.source));
|
|
440
|
-
}
|
|
441
|
-
class ye extends X {
|
|
442
|
-
constructor(e) {
|
|
443
|
-
super(), this.sev = e;
|
|
444
|
-
}
|
|
445
|
-
eq(e) {
|
|
446
|
-
return e.sev == this.sev;
|
|
447
|
-
}
|
|
448
|
-
toDOM() {
|
|
449
|
-
return k("span", { class: "cm-lintPoint cm-lintPoint-" + this.sev });
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
class q {
|
|
453
|
-
constructor(e, i) {
|
|
454
|
-
this.diagnostic = i, this.id = "item_" + Math.floor(Math.random() * 4294967295).toString(16), this.dom = j(e, i, !0), this.dom.id = this.id, this.dom.setAttribute("role", "option");
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
class A {
|
|
458
|
-
constructor(e) {
|
|
459
|
-
this.view = e, this.items = [];
|
|
460
|
-
let i = (o) => {
|
|
461
|
-
if (!(o.ctrlKey || o.altKey || o.metaKey)) {
|
|
462
|
-
if (o.keyCode == 27)
|
|
463
|
-
_(this.view), this.view.focus();
|
|
464
|
-
else if (o.keyCode == 38 || o.keyCode == 33)
|
|
465
|
-
this.moveSelection((this.selectedIndex - 1 + this.items.length) % this.items.length);
|
|
466
|
-
else if (o.keyCode == 40 || o.keyCode == 34)
|
|
467
|
-
this.moveSelection((this.selectedIndex + 1) % this.items.length);
|
|
468
|
-
else if (o.keyCode == 36)
|
|
469
|
-
this.moveSelection(0);
|
|
470
|
-
else if (o.keyCode == 35)
|
|
471
|
-
this.moveSelection(this.items.length - 1);
|
|
472
|
-
else if (o.keyCode == 13)
|
|
473
|
-
this.view.focus();
|
|
474
|
-
else if (o.keyCode >= 65 && o.keyCode <= 90 && this.selectedIndex >= 0) {
|
|
475
|
-
let { diagnostic: s } = this.items[this.selectedIndex], a = Y(s.actions);
|
|
476
|
-
for (let r = 0; r < a.length; r++)
|
|
477
|
-
if (a[r].toUpperCase().charCodeAt(0) == o.keyCode) {
|
|
478
|
-
let l = v(this.view.state.field(y).diagnostics, s);
|
|
479
|
-
l && s.actions[r].apply(e, l.from, l.to);
|
|
480
|
-
}
|
|
481
|
-
} else
|
|
482
|
-
return;
|
|
483
|
-
o.preventDefault();
|
|
484
|
-
}
|
|
485
|
-
}, n = (o) => {
|
|
486
|
-
for (let s = 0; s < this.items.length; s++)
|
|
487
|
-
this.items[s].dom.contains(o.target) && this.moveSelection(s);
|
|
488
|
-
};
|
|
489
|
-
this.list = k("ul", {
|
|
490
|
-
tabIndex: 0,
|
|
491
|
-
role: "listbox",
|
|
492
|
-
"aria-label": this.view.state.phrase("Diagnostics"),
|
|
493
|
-
onkeydown: i,
|
|
494
|
-
onclick: n
|
|
495
|
-
}), this.dom = k("div", { class: "cm-panel-lint" }, this.list, k("button", {
|
|
496
|
-
type: "button",
|
|
497
|
-
name: "close",
|
|
498
|
-
"aria-label": this.view.state.phrase("close"),
|
|
499
|
-
onclick: () => _(this.view)
|
|
500
|
-
}, "×")), this.update();
|
|
501
|
-
}
|
|
502
|
-
get selectedIndex() {
|
|
503
|
-
let e = this.view.state.field(y).selected;
|
|
504
|
-
if (!e)
|
|
505
|
-
return -1;
|
|
506
|
-
for (let i = 0; i < this.items.length; i++)
|
|
507
|
-
if (this.items[i].diagnostic == e.diagnostic)
|
|
508
|
-
return i;
|
|
509
|
-
return -1;
|
|
510
|
-
}
|
|
511
|
-
update() {
|
|
512
|
-
let { diagnostics: e, selected: i } = this.view.state.field(y), n = 0, o = !1, s = null, a = /* @__PURE__ */ new Set();
|
|
513
|
-
for (e.between(0, this.view.state.doc.length, (r, l, { spec: c }) => {
|
|
514
|
-
for (let d of c.diagnostics) {
|
|
515
|
-
if (a.has(d))
|
|
516
|
-
continue;
|
|
517
|
-
a.add(d);
|
|
518
|
-
let m = -1, g;
|
|
519
|
-
for (let f = n; f < this.items.length; f++)
|
|
520
|
-
if (this.items[f].diagnostic == d) {
|
|
521
|
-
m = f;
|
|
522
|
-
break;
|
|
523
|
-
}
|
|
524
|
-
m < 0 ? (g = new q(this.view, d), this.items.splice(n, 0, g), o = !0) : (g = this.items[m], m > n && (this.items.splice(n, m - n), o = !0)), i && g.diagnostic == i.diagnostic ? g.dom.hasAttribute("aria-selected") || (g.dom.setAttribute("aria-selected", "true"), s = g) : g.dom.hasAttribute("aria-selected") && g.dom.removeAttribute("aria-selected"), n++;
|
|
525
|
-
}
|
|
526
|
-
}); n < this.items.length && !(this.items.length == 1 && this.items[0].diagnostic.from < 0); )
|
|
527
|
-
o = !0, this.items.pop();
|
|
528
|
-
this.items.length == 0 && (this.items.push(new q(this.view, {
|
|
529
|
-
from: -1,
|
|
530
|
-
to: -1,
|
|
531
|
-
severity: "info",
|
|
532
|
-
message: this.view.state.phrase("No diagnostics")
|
|
533
|
-
})), o = !0), s ? (this.list.setAttribute("aria-activedescendant", s.id), this.view.requestMeasure({
|
|
534
|
-
key: this,
|
|
535
|
-
read: () => ({ sel: s.dom.getBoundingClientRect(), panel: this.list.getBoundingClientRect() }),
|
|
536
|
-
write: ({ sel: r, panel: l }) => {
|
|
537
|
-
let c = l.height / this.list.offsetHeight;
|
|
538
|
-
r.top < l.top ? this.list.scrollTop -= (l.top - r.top) / c : r.bottom > l.bottom && (this.list.scrollTop += (r.bottom - l.bottom) / c);
|
|
539
|
-
}
|
|
540
|
-
})) : this.selectedIndex < 0 && this.list.removeAttribute("aria-activedescendant"), o && this.sync();
|
|
541
|
-
}
|
|
542
|
-
sync() {
|
|
543
|
-
let e = this.list.firstChild;
|
|
544
|
-
function i() {
|
|
545
|
-
let n = e;
|
|
546
|
-
e = n.nextSibling, n.remove();
|
|
547
|
-
}
|
|
548
|
-
for (let n of this.items)
|
|
549
|
-
if (n.dom.parentNode == this.list) {
|
|
550
|
-
for (; e != n.dom; )
|
|
551
|
-
i();
|
|
552
|
-
e = n.dom.nextSibling;
|
|
553
|
-
} else
|
|
554
|
-
this.list.insertBefore(n.dom, e);
|
|
555
|
-
for (; e; )
|
|
556
|
-
i();
|
|
557
|
-
}
|
|
558
|
-
moveSelection(e) {
|
|
559
|
-
if (this.selectedIndex < 0)
|
|
560
|
-
return;
|
|
561
|
-
let i = this.view.state.field(y), n = v(i.diagnostics, this.items[e].diagnostic);
|
|
562
|
-
n && this.view.dispatch({
|
|
563
|
-
selection: { anchor: n.from, head: n.to },
|
|
564
|
-
scrollIntoView: !0,
|
|
565
|
-
effects: z.of(n)
|
|
566
|
-
});
|
|
567
|
-
}
|
|
568
|
-
static open(e) {
|
|
569
|
-
return new A(e);
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
function we(t, e = 'viewBox="0 0 40 40"') {
|
|
573
|
-
return `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`;
|
|
574
|
-
}
|
|
575
|
-
function R(t) {
|
|
576
|
-
return we(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`, 'width="6" height="3"');
|
|
577
|
-
}
|
|
578
|
-
const ke = /* @__PURE__ */ I.baseTheme({
|
|
579
|
-
".cm-diagnostic": {
|
|
580
|
-
padding: "3px 6px 3px 8px",
|
|
581
|
-
marginLeft: "-1px",
|
|
582
|
-
display: "block",
|
|
583
|
-
whiteSpace: "pre-wrap"
|
|
584
|
-
},
|
|
585
|
-
".cm-diagnostic-error": { borderLeft: "5px solid #d11" },
|
|
586
|
-
".cm-diagnostic-warning": { borderLeft: "5px solid orange" },
|
|
587
|
-
".cm-diagnostic-info": { borderLeft: "5px solid #999" },
|
|
588
|
-
".cm-diagnostic-hint": { borderLeft: "5px solid #66d" },
|
|
589
|
-
".cm-diagnosticAction": {
|
|
590
|
-
font: "inherit",
|
|
591
|
-
border: "none",
|
|
592
|
-
padding: "2px 4px",
|
|
593
|
-
backgroundColor: "#444",
|
|
594
|
-
color: "white",
|
|
595
|
-
borderRadius: "3px",
|
|
596
|
-
marginLeft: "8px",
|
|
597
|
-
cursor: "pointer"
|
|
598
|
-
},
|
|
599
|
-
".cm-diagnosticSource": {
|
|
600
|
-
fontSize: "70%",
|
|
601
|
-
opacity: 0.7
|
|
602
|
-
},
|
|
603
|
-
".cm-lintRange": {
|
|
604
|
-
backgroundPosition: "left bottom",
|
|
605
|
-
backgroundRepeat: "repeat-x",
|
|
606
|
-
paddingBottom: "0.7px"
|
|
607
|
-
},
|
|
608
|
-
".cm-lintRange-error": { backgroundImage: /* @__PURE__ */ R("#f11") },
|
|
609
|
-
".cm-lintRange-warning": { backgroundImage: /* @__PURE__ */ R("orange") },
|
|
610
|
-
".cm-lintRange-info": { backgroundImage: /* @__PURE__ */ R("#999") },
|
|
611
|
-
".cm-lintRange-hint": { backgroundImage: /* @__PURE__ */ R("#66d") },
|
|
612
|
-
".cm-lintRange-active": { backgroundColor: "#ffdd9980" },
|
|
613
|
-
".cm-tooltip-lint": {
|
|
614
|
-
padding: 0,
|
|
615
|
-
margin: 0
|
|
616
|
-
},
|
|
617
|
-
".cm-lintPoint": {
|
|
618
|
-
position: "relative",
|
|
619
|
-
"&:after": {
|
|
620
|
-
content: '""',
|
|
621
|
-
position: "absolute",
|
|
622
|
-
bottom: 0,
|
|
623
|
-
left: "-2px",
|
|
624
|
-
borderLeft: "3px solid transparent",
|
|
625
|
-
borderRight: "3px solid transparent",
|
|
626
|
-
borderBottom: "4px solid #d11"
|
|
627
|
-
}
|
|
628
|
-
},
|
|
629
|
-
".cm-lintPoint-warning": {
|
|
630
|
-
"&:after": { borderBottomColor: "orange" }
|
|
631
|
-
},
|
|
632
|
-
".cm-lintPoint-info": {
|
|
633
|
-
"&:after": { borderBottomColor: "#999" }
|
|
634
|
-
},
|
|
635
|
-
".cm-lintPoint-hint": {
|
|
636
|
-
"&:after": { borderBottomColor: "#66d" }
|
|
637
|
-
},
|
|
638
|
-
".cm-panel.cm-panel-lint": {
|
|
639
|
-
position: "relative",
|
|
640
|
-
"& ul": {
|
|
641
|
-
maxHeight: "100px",
|
|
642
|
-
overflowY: "auto",
|
|
643
|
-
"& [aria-selected]": {
|
|
644
|
-
backgroundColor: "#ddd",
|
|
645
|
-
"& u": { textDecoration: "underline" }
|
|
646
|
-
},
|
|
647
|
-
"&:focus [aria-selected]": {
|
|
648
|
-
background_fallback: "#bdf",
|
|
649
|
-
backgroundColor: "Highlight",
|
|
650
|
-
color_fallback: "white",
|
|
651
|
-
color: "HighlightText"
|
|
652
|
-
},
|
|
653
|
-
"& u": { textDecoration: "none" },
|
|
654
|
-
padding: 0,
|
|
655
|
-
margin: 0
|
|
656
|
-
},
|
|
657
|
-
"& [name=close]": {
|
|
658
|
-
position: "absolute",
|
|
659
|
-
top: "0",
|
|
660
|
-
right: "2px",
|
|
661
|
-
background: "inherit",
|
|
662
|
-
border: "none",
|
|
663
|
-
font: "inherit",
|
|
664
|
-
padding: 0,
|
|
665
|
-
margin: 0
|
|
666
|
-
}
|
|
667
|
-
},
|
|
668
|
-
"&dark .cm-lintRange-active": { backgroundColor: "#86714a80" },
|
|
669
|
-
"&dark .cm-panel.cm-panel-lint ul": {
|
|
670
|
-
"& [aria-selected]": {
|
|
671
|
-
backgroundColor: "#2e343e"
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
});
|
|
675
|
-
function xe(t) {
|
|
676
|
-
return t == "error" ? 4 : t == "warning" ? 3 : t == "info" ? 2 : 1;
|
|
677
|
-
}
|
|
678
|
-
function Ce(t) {
|
|
679
|
-
let e = "hint", i = 1;
|
|
680
|
-
for (let n of t) {
|
|
681
|
-
let o = xe(n.severity);
|
|
682
|
-
o > i && (i = o, e = n.severity);
|
|
683
|
-
}
|
|
684
|
-
return e;
|
|
685
|
-
}
|
|
686
|
-
const Se = /* @__PURE__ */ M(ge, { hideOn: fe }), J = [
|
|
687
|
-
y,
|
|
688
|
-
/* @__PURE__ */ I.decorations.compute([y], (t) => {
|
|
689
|
-
let { selected: e, panel: i } = t.field(y);
|
|
690
|
-
return !e || !i || e.from == e.to ? S.none : S.set([
|
|
691
|
-
me.range(e.from, e.to)
|
|
692
|
-
]);
|
|
693
|
-
}),
|
|
694
|
-
Se,
|
|
695
|
-
ke
|
|
696
|
-
];
|
|
697
|
-
function ve(t) {
|
|
698
|
-
if (t.code === 7027)
|
|
699
|
-
return "warning";
|
|
700
|
-
switch (t.category) {
|
|
701
|
-
case T.DiagnosticCategory.Error:
|
|
702
|
-
return "error";
|
|
703
|
-
case T.DiagnosticCategory.Message:
|
|
704
|
-
return "info";
|
|
705
|
-
case T.DiagnosticCategory.Warning:
|
|
706
|
-
return "warning";
|
|
707
|
-
case T.DiagnosticCategory.Suggestion:
|
|
708
|
-
return "info";
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
function Te(t) {
|
|
712
|
-
return !!(t.file && typeof t.start == "number" && typeof t.length == "number");
|
|
713
|
-
}
|
|
714
|
-
function Ie(t) {
|
|
715
|
-
return typeof t.messageText == "string" ? t.messageText : t.messageText.messageText;
|
|
716
|
-
}
|
|
717
|
-
function De(t) {
|
|
718
|
-
const e = t.start, i = Ie(t);
|
|
719
|
-
return {
|
|
720
|
-
from: e,
|
|
721
|
-
to: e + t.length,
|
|
722
|
-
message: i,
|
|
723
|
-
severity: ve(t)
|
|
724
|
-
};
|
|
725
|
-
}
|
|
726
|
-
function Re({ env: t, path: e, diagnosticCodesToIgnore: i }) {
|
|
727
|
-
if (!t.getSourceFile(e))
|
|
728
|
-
return [];
|
|
729
|
-
const o = t.languageService.getSyntacticDiagnostics(e), s = t.languageService.getSemanticDiagnostics(e);
|
|
730
|
-
return [...o, ...s].filter((r) => Te(r) && !i.includes(r.code)).map(De);
|
|
731
|
-
}
|
|
732
|
-
function Ne({ diagnosticCodesToIgnore: t } = {}) {
|
|
733
|
-
return V(async (e) => {
|
|
734
|
-
const i = e.state.facet(L);
|
|
735
|
-
return i ? Re({
|
|
736
|
-
...i,
|
|
737
|
-
diagnosticCodesToIgnore: t || []
|
|
738
|
-
}) : [];
|
|
739
|
-
});
|
|
740
|
-
}
|
|
741
|
-
function We({ diagnosticCodesToIgnore: t } = {}) {
|
|
742
|
-
return V(async (e) => {
|
|
743
|
-
const i = e.state.facet(F);
|
|
744
|
-
return i ? i.worker.getLints({
|
|
745
|
-
path: i.path,
|
|
746
|
-
diagnosticCodesToIgnore: t || []
|
|
747
|
-
}) : [];
|
|
748
|
-
});
|
|
749
|
-
}
|
|
750
|
-
function Ae({ env: t, path: e, pos: i }) {
|
|
751
|
-
const n = i;
|
|
752
|
-
if (n === null)
|
|
753
|
-
return null;
|
|
754
|
-
const o = t.languageService.getQuickInfoAtPosition(e, n);
|
|
755
|
-
if (!o)
|
|
756
|
-
return null;
|
|
757
|
-
const s = o.textSpan.start, a = t.languageService.getTypeDefinitionAtPosition(e, n) ?? t.languageService.getDefinitionAtPosition(e, n);
|
|
758
|
-
return {
|
|
759
|
-
start: s,
|
|
760
|
-
end: s + o.textSpan.length,
|
|
761
|
-
typeDef: a,
|
|
762
|
-
quickInfo: o
|
|
763
|
-
};
|
|
764
|
-
}
|
|
765
|
-
const Q = (t) => {
|
|
766
|
-
var i;
|
|
767
|
-
const e = document.createElement("div");
|
|
768
|
-
if ((i = t.quickInfo) != null && i.displayParts)
|
|
769
|
-
for (let n of t.quickInfo.displayParts) {
|
|
770
|
-
const o = e.appendChild(document.createElement("span"));
|
|
771
|
-
o.className = `quick-info-${n.kind}`, o.innerText = n.text;
|
|
772
|
-
}
|
|
773
|
-
return { dom: e };
|
|
774
|
-
};
|
|
775
|
-
function $e({ renderTooltip: t = Q } = {}) {
|
|
776
|
-
return M(async (e, i) => {
|
|
777
|
-
const n = e.state.facet(L);
|
|
778
|
-
if (!n)
|
|
779
|
-
return null;
|
|
780
|
-
const o = Ae({
|
|
781
|
-
...n,
|
|
782
|
-
pos: i
|
|
783
|
-
});
|
|
784
|
-
return o ? {
|
|
785
|
-
pos: o.start,
|
|
786
|
-
end: o.end,
|
|
787
|
-
create: () => t(o, e)
|
|
788
|
-
} : null;
|
|
789
|
-
});
|
|
790
|
-
}
|
|
791
|
-
function _e({ renderTooltip: t = Q } = {}) {
|
|
792
|
-
return M(async (e, i) => {
|
|
793
|
-
const n = e.state.facet(F);
|
|
794
|
-
if (!n)
|
|
795
|
-
return null;
|
|
796
|
-
const o = await n.worker.getHover({
|
|
797
|
-
path: n.path,
|
|
798
|
-
pos: i
|
|
799
|
-
});
|
|
800
|
-
return o ? {
|
|
801
|
-
pos: o.start,
|
|
802
|
-
end: o.end,
|
|
803
|
-
create: () => t(o, e)
|
|
804
|
-
} : null;
|
|
805
|
-
});
|
|
806
|
-
}
|
|
807
|
-
const F = E.define({
|
|
808
|
-
combine(t) {
|
|
809
|
-
return O(t, {});
|
|
810
|
-
}
|
|
811
|
-
});
|
|
812
|
-
export {
|
|
813
|
-
ce as getAutocompletion,
|
|
814
|
-
Ae as getHover,
|
|
815
|
-
Re as getLints,
|
|
816
|
-
Be as tsAutocomplete,
|
|
817
|
-
Ue as tsAutocompleteWorker,
|
|
818
|
-
L as tsFacet,
|
|
819
|
-
F as tsFacetWorker,
|
|
820
|
-
$e as tsHover,
|
|
821
|
-
_e as tsHoverWorker,
|
|
822
|
-
Ne as tsLinter,
|
|
823
|
-
We as tsLinterWorker,
|
|
824
|
-
Ee as tsSync,
|
|
825
|
-
Oe as tsSyncWorker
|
|
826
|
-
};
|
|
827
|
-
//# sourceMappingURL=index-DnZIsnLn.js.map
|