@arcgis/arcade-languageservice 5.1.0-next.89 → 5.1.0-next.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +183 -185
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -152,7 +152,7 @@ declare interface CallExpression extends NodeBase<typeof NodeTypes.CallExpressio
|
|
|
152
152
|
* Example: foo(1, 2, 3)
|
|
153
153
|
* The callee is foo.
|
|
154
154
|
*/
|
|
155
|
-
callee:
|
|
155
|
+
callee: Expression;
|
|
156
156
|
/**
|
|
157
157
|
* The arguments of the call expression.
|
|
158
158
|
* Example: foo(1, 2, 3)
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CompletionItemKind as
|
|
1
|
+
import { CompletionItemKind as x, InsertTextFormat as B, InsertTextMode as S, DiagnosticSeverity as A } from "vscode-languageserver-types";
|
|
2
2
|
import { DiagnosticSeverity as fi } from "vscode-languageserver-types";
|
|
3
|
-
import { isDictionaryVariable as
|
|
3
|
+
import { isDictionaryVariable as Ge, isValueVariable as Ee, ApiService as Je } from "@arcgis/languages-api-utils";
|
|
4
4
|
const V = {
|
|
5
5
|
False: "false",
|
|
6
6
|
Null: "null",
|
|
@@ -58,7 +58,7 @@ const V = {
|
|
|
58
58
|
VariableDeclaration: "VariableDeclaration",
|
|
59
59
|
VariableDeclarator: "VariableDeclarator",
|
|
60
60
|
WhileStatement: "WhileStatement"
|
|
61
|
-
}, ue = ["++", "--"], Ne = ["-", "+", "!", "~"], Me = ["=", "/=", "*=", "%=", "+=", "-="], Ue = ["||", "&&"],
|
|
61
|
+
}, ue = ["++", "--"], Ne = ["-", "+", "!", "~"], Me = ["=", "/=", "*=", "%=", "+=", "-="], Ue = ["||", "&&"], Qe = [
|
|
62
62
|
"|",
|
|
63
63
|
"&",
|
|
64
64
|
">>",
|
|
@@ -188,22 +188,22 @@ class z extends Error {
|
|
|
188
188
|
);
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function Ze(n) {
|
|
192
192
|
return !!n && typeof n == "object" && "type" in n && n.type === u.Program;
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function b(n) {
|
|
195
195
|
return !!n && typeof n == "object" && "type" in n && n.type === u.BlockStatement;
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function Xe(n) {
|
|
198
198
|
return !!n && typeof n == "object" && "type" in n && n.type === u.BlockComment;
|
|
199
199
|
}
|
|
200
200
|
function pe(n) {
|
|
201
201
|
return !!n && typeof n == "object" && "type" in n && n.type === u.EmptyStatement;
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function Ye(n) {
|
|
204
204
|
return !!n && typeof n == "object" && "type" in n && n.type === u.ExpressionStatement;
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function ge(n) {
|
|
207
207
|
return !!n && typeof n == "object" && "type" in n && n.type === u.FunctionDeclaration;
|
|
208
208
|
}
|
|
209
209
|
function ae(n) {
|
|
@@ -218,7 +218,7 @@ function J(n) {
|
|
|
218
218
|
function oe(n) {
|
|
219
219
|
return !!n && typeof n == "object" && "type" in n && n.type === u.BinaryExpression;
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function I(n) {
|
|
222
222
|
return !!n && typeof n == "object" && "type" in n && n.type === u.Identifier;
|
|
223
223
|
}
|
|
224
224
|
function ze(n) {
|
|
@@ -227,28 +227,28 @@ function ze(n) {
|
|
|
227
227
|
function ce(n) {
|
|
228
228
|
return !!n && typeof n == "object" && "type" in n && n.type === u.LogicalExpression;
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function xe(n) {
|
|
231
231
|
return !!n && typeof n == "object" && "type" in n && n.type === u.ObjectExpression;
|
|
232
232
|
}
|
|
233
233
|
function Fe(n) {
|
|
234
234
|
return !!n && typeof n == "object" && "type" in n && n.type === u.MemberExpression;
|
|
235
235
|
}
|
|
236
|
-
function
|
|
236
|
+
function et(n) {
|
|
237
237
|
return !!n && typeof n == "object" && "type" in n && n.type === u.SafeMemberExpression;
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function tt(n) {
|
|
240
240
|
return !!n && typeof n == "object" && "type" in n && n.type === u.MemberAccessChainExpression;
|
|
241
241
|
}
|
|
242
|
-
function
|
|
242
|
+
function it(n) {
|
|
243
243
|
return !!n && typeof n == "object" && "type" in n && n.type === u.UnaryExpression;
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function nt(n) {
|
|
246
246
|
return !!n && typeof n == "object" && "type" in n && n.type === u.UpdateExpression;
|
|
247
247
|
}
|
|
248
248
|
function Ve(n) {
|
|
249
249
|
return !!n && typeof n == "object" && "type" in n && n.type === u.VariableDeclarator;
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function rt(n) {
|
|
252
252
|
return !!n && typeof n == "object" && "type" in n && n.type === u.Property;
|
|
253
253
|
}
|
|
254
254
|
function ie(n, e) {
|
|
@@ -257,12 +257,12 @@ function ie(n, e) {
|
|
|
257
257
|
function Ae(n, e) {
|
|
258
258
|
return n.range[0] >= e.range[0] && n.range[1] <= e.range[1];
|
|
259
259
|
}
|
|
260
|
-
class
|
|
260
|
+
class st {
|
|
261
261
|
constructor() {
|
|
262
262
|
this.comments = [], this._nodeStack = [], this._newComments = [];
|
|
263
263
|
}
|
|
264
264
|
insertInnerComments(e) {
|
|
265
|
-
if (!
|
|
265
|
+
if (!b(e) || e.body.length !== 0)
|
|
266
266
|
return;
|
|
267
267
|
const t = [];
|
|
268
268
|
for (let i = this._newComments.length - 1; i >= 0; i--) {
|
|
@@ -275,7 +275,7 @@ class ut {
|
|
|
275
275
|
const t = this._nodeStack.at(-1);
|
|
276
276
|
if (!t)
|
|
277
277
|
return;
|
|
278
|
-
if (
|
|
278
|
+
if (b(e) && Ae(t, e))
|
|
279
279
|
for (let r = this._newComments.length - 1; r >= 0; r--) {
|
|
280
280
|
const s = this._newComments[r];
|
|
281
281
|
Ae(s, e) && (t.trailingComments = [...t.trailingComments ?? [], s], this._newComments.splice(r, 1));
|
|
@@ -312,7 +312,7 @@ class ut {
|
|
|
312
312
|
i.unshift(a), t.leadingComments.splice(s, 1);
|
|
313
313
|
continue;
|
|
314
314
|
}
|
|
315
|
-
Ve(e) && !
|
|
315
|
+
Ve(e) && !Xe(a) && (r.unshift(a), t.leadingComments.splice(s, 1));
|
|
316
316
|
}
|
|
317
317
|
t.leadingComments.length === 0 && delete t.leadingComments, i.length && (e.leadingComments = i), r.length && (e.trailingComments = [...r, ...e.trailingComments ?? []]);
|
|
318
318
|
return;
|
|
@@ -324,7 +324,7 @@ class ut {
|
|
|
324
324
|
i.length && (e.leadingComments = i);
|
|
325
325
|
}
|
|
326
326
|
attachComments(e) {
|
|
327
|
-
if (
|
|
327
|
+
if (Ze(e) && e.body.length > 0) {
|
|
328
328
|
const t = this._nodeStack.at(-1);
|
|
329
329
|
if (t) {
|
|
330
330
|
t.trailingComments = [...t.trailingComments ?? [], ...this._newComments], this._newComments.length = 0, this._nodeStack.pop();
|
|
@@ -339,10 +339,10 @@ class ut {
|
|
|
339
339
|
this.comments.push(e), this._newComments.push(e);
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
|
-
const
|
|
342
|
+
const ut = /\$\{(.*?)\}/gu;
|
|
343
343
|
function he(n, e) {
|
|
344
344
|
const t = je[n];
|
|
345
|
-
return e ? t.replace(
|
|
345
|
+
return e ? t.replace(ut, (i, r) => e[r]?.toString() ?? "") : t;
|
|
346
346
|
}
|
|
347
347
|
class _e {
|
|
348
348
|
constructor(e = !1) {
|
|
@@ -450,7 +450,7 @@ ue.forEach((n) => N[n.length - 1].push(n));
|
|
|
450
450
|
Ne.forEach((n) => N[n.length - 1].push(n));
|
|
451
451
|
Ue.forEach((n) => N[n.length - 1].push(n));
|
|
452
452
|
Me.forEach((n) => N[n.length - 1].push(n));
|
|
453
|
-
|
|
453
|
+
Qe.forEach((n) => N[n.length - 1].push(n));
|
|
454
454
|
N[w.length - 1].push(w);
|
|
455
455
|
class $e {
|
|
456
456
|
constructor(e, t) {
|
|
@@ -993,11 +993,11 @@ const y = {
|
|
|
993
993
|
AsObject: 0,
|
|
994
994
|
Automatic: 1
|
|
995
995
|
};
|
|
996
|
-
function
|
|
996
|
+
function Ie(n, e = 0) {
|
|
997
997
|
let t = n.start - n.lineStart, i = n.lineNumber;
|
|
998
998
|
return t < 0 && (t += e, i -= 1), { index: n.start, line: i, column: t };
|
|
999
999
|
}
|
|
1000
|
-
function
|
|
1000
|
+
function be(n) {
|
|
1001
1001
|
return [
|
|
1002
1002
|
{ index: n.range[0], ...n.loc.start },
|
|
1003
1003
|
{ index: n.range[1], ...n.loc.end }
|
|
@@ -1006,13 +1006,13 @@ function Ie(n) {
|
|
|
1006
1006
|
function we(n) {
|
|
1007
1007
|
return n in q ? q[n] : 0;
|
|
1008
1008
|
}
|
|
1009
|
-
class
|
|
1009
|
+
class at {
|
|
1010
1010
|
constructor(e, t = {}, i) {
|
|
1011
1011
|
this.delegate = i, this.hasLineTerminator = !1, this.options = {
|
|
1012
1012
|
tokens: typeof t.tokens == "boolean" && t.tokens,
|
|
1013
1013
|
comments: typeof t.comments == "boolean" && t.comments,
|
|
1014
1014
|
tolerant: typeof t.tolerant == "boolean" && t.tolerant
|
|
1015
|
-
}, this.options.comments && (this.commentHandler = new
|
|
1015
|
+
}, this.options.comments && (this.commentHandler = new st()), this.errorHandler = new _e(this.options.tolerant), this.scanner = new $e(e, this.errorHandler), this.context = {
|
|
1016
1016
|
isAssignmentTarget: !1,
|
|
1017
1017
|
blockContext: y.None,
|
|
1018
1018
|
curlyParsingType: re.AsObject
|
|
@@ -1079,11 +1079,11 @@ class ot {
|
|
|
1079
1079
|
i ??= h.UnexpectedToken, r ??= { value: s };
|
|
1080
1080
|
const a = he(i, r);
|
|
1081
1081
|
if (t) {
|
|
1082
|
-
const d = t.start,
|
|
1082
|
+
const d = t.start, E = t.lineNumber, F = t.start - t.lineStart + 1;
|
|
1083
1083
|
return new z({
|
|
1084
1084
|
code: i,
|
|
1085
1085
|
index: d,
|
|
1086
|
-
line:
|
|
1086
|
+
line: E,
|
|
1087
1087
|
column: F,
|
|
1088
1088
|
len: t.end - t.start - 1,
|
|
1089
1089
|
data: r,
|
|
@@ -1421,50 +1421,48 @@ class ot {
|
|
|
1421
1421
|
}
|
|
1422
1422
|
parseLeftHandSideExpression() {
|
|
1423
1423
|
const e = this.captureStartMarker();
|
|
1424
|
-
let t = this.inheritCoverGrammar(this.parsePrimaryExpression.bind(this));
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
let a = !1;
|
|
1429
|
-
switch (s === w && (r = !0, a = !0, this.expectPunctuator(w), this.getMatchingPunctuator("[") ? s = "[" : s = "."), s) {
|
|
1424
|
+
let t = this.inheritCoverGrammar(this.parsePrimaryExpression.bind(this)), i = !1, r;
|
|
1425
|
+
for (; r = this.getMatchingPunctuator(["(", "[", ".", w]); ) {
|
|
1426
|
+
let s = !1;
|
|
1427
|
+
switch (r === w && (i = !0, s = !0, this.expectPunctuator(w), this.getMatchingPunctuator("[") ? r = "[" : r = "."), r) {
|
|
1430
1428
|
case "(": {
|
|
1431
|
-
this.context.isAssignmentTarget = !1
|
|
1432
|
-
const
|
|
1429
|
+
this.context.isAssignmentTarget = !1;
|
|
1430
|
+
const a = this.parseArguments();
|
|
1433
1431
|
t = this.finalize({
|
|
1434
1432
|
type: u.CallExpression,
|
|
1435
1433
|
callee: t,
|
|
1436
|
-
arguments:
|
|
1434
|
+
arguments: a,
|
|
1437
1435
|
...this.getItemLocation(e)
|
|
1438
1436
|
});
|
|
1439
1437
|
continue;
|
|
1440
1438
|
}
|
|
1441
1439
|
case "[": {
|
|
1442
|
-
this.context.isAssignmentTarget = !
|
|
1443
|
-
const
|
|
1440
|
+
this.context.isAssignmentTarget = !s, this.expectPunctuator("[");
|
|
1441
|
+
const a = this.isolateCoverGrammar(() => this.parseExpression());
|
|
1444
1442
|
this.expectPunctuator("]"), t = this.finalize({
|
|
1445
|
-
type:
|
|
1443
|
+
type: s ? u.SafeMemberExpression : u.MemberExpression,
|
|
1446
1444
|
computed: !0,
|
|
1447
1445
|
object: t,
|
|
1448
|
-
property:
|
|
1446
|
+
property: a,
|
|
1449
1447
|
...this.getItemLocation(e)
|
|
1450
1448
|
});
|
|
1451
1449
|
continue;
|
|
1452
1450
|
}
|
|
1453
1451
|
case ".": {
|
|
1454
|
-
this.context.isAssignmentTarget = !
|
|
1455
|
-
const
|
|
1452
|
+
this.context.isAssignmentTarget = !s, s || this.expectPunctuator(".");
|
|
1453
|
+
const a = this.parseMemberName();
|
|
1456
1454
|
t = this.finalize({
|
|
1457
|
-
type:
|
|
1455
|
+
type: s ? u.SafeMemberExpression : u.MemberExpression,
|
|
1458
1456
|
computed: !1,
|
|
1459
1457
|
object: t,
|
|
1460
|
-
property:
|
|
1458
|
+
property: a,
|
|
1461
1459
|
...this.getItemLocation(e)
|
|
1462
1460
|
});
|
|
1463
1461
|
continue;
|
|
1464
1462
|
}
|
|
1465
1463
|
}
|
|
1466
1464
|
}
|
|
1467
|
-
return
|
|
1465
|
+
return i ? this.finalize({
|
|
1468
1466
|
type: u.MemberAccessChainExpression,
|
|
1469
1467
|
expression: t,
|
|
1470
1468
|
...this.getItemLocation(e)
|
|
@@ -1529,27 +1527,27 @@ class ot {
|
|
|
1529
1527
|
o = c.pop();
|
|
1530
1528
|
const k = c.pop();
|
|
1531
1529
|
d.pop(), a = c.pop(), s.pop();
|
|
1532
|
-
const R = s[s.length - 1], ee =
|
|
1530
|
+
const R = s[s.length - 1], ee = Ie(R, R.lineStart);
|
|
1533
1531
|
c.push(this.finalize(this.createBinaryOrLogicalExpression(ee, k, a, o)));
|
|
1534
1532
|
}
|
|
1535
1533
|
c.push(this.rawToken.value), d.push(r), s.push(this.rawToken), this.readNextRawToken(), c.push(this.inheritCoverGrammar(this.parseUnaryExpression.bind(this)));
|
|
1536
1534
|
}
|
|
1537
|
-
let
|
|
1538
|
-
t = c[
|
|
1535
|
+
let E = c.length - 1;
|
|
1536
|
+
t = c[E];
|
|
1539
1537
|
let F = s.pop();
|
|
1540
|
-
for (;
|
|
1538
|
+
for (; E > 1; ) {
|
|
1541
1539
|
const k = s.pop();
|
|
1542
1540
|
if (!k)
|
|
1543
1541
|
break;
|
|
1544
|
-
const R = F?.lineStart, ee =
|
|
1542
|
+
const R = F?.lineStart, ee = Ie(k, R), qe = c[E - 1];
|
|
1545
1543
|
t = this.finalize(
|
|
1546
|
-
this.createBinaryOrLogicalExpression(ee,
|
|
1547
|
-
),
|
|
1544
|
+
this.createBinaryOrLogicalExpression(ee, qe, c[E - 2], t)
|
|
1545
|
+
), E -= 2, F = k;
|
|
1548
1546
|
}
|
|
1549
1547
|
return t;
|
|
1550
1548
|
}
|
|
1551
1549
|
createBinaryOrLogicalExpression(e, t, i, r) {
|
|
1552
|
-
return Ue.includes(t) ? ((i.type === u.AssignmentExpression || i.type === u.UpdateExpression) && this.throwError(h.InvalidExpression, ...
|
|
1550
|
+
return Ue.includes(t) ? ((i.type === u.AssignmentExpression || i.type === u.UpdateExpression) && this.throwError(h.InvalidExpression, ...be(i)), (r.type === u.AssignmentExpression || r.type === u.UpdateExpression) && this.throwError(h.InvalidExpression, ...be(i)), {
|
|
1553
1551
|
type: u.LogicalExpression,
|
|
1554
1552
|
operator: t,
|
|
1555
1553
|
left: i,
|
|
@@ -1703,20 +1701,20 @@ class ot {
|
|
|
1703
1701
|
if (this.expectKeyword(f.For), this.expectPunctuator("("), this.matchKeyword(f.Var)) {
|
|
1704
1702
|
const d = this.captureStartMarker();
|
|
1705
1703
|
this.readNextRawToken();
|
|
1706
|
-
const
|
|
1704
|
+
const E = this.parseVariableDeclarators();
|
|
1707
1705
|
t = this.finalize({
|
|
1708
1706
|
type: u.VariableDeclaration,
|
|
1709
|
-
declarations:
|
|
1707
|
+
declarations: E,
|
|
1710
1708
|
kind: "var",
|
|
1711
1709
|
...this.getItemLocation(d)
|
|
1712
1710
|
});
|
|
1713
1711
|
const F = this.matchKeyword(f.In), k = this.matchContextualKeyword(te.Of);
|
|
1714
|
-
|
|
1712
|
+
E.length === 1 && (F || k) && (E[0].init && this.throwError(h.ForInOfLoopInitializer, d), e = F ? u.ForInStatement : u.ForOfStatement, s = t);
|
|
1715
1713
|
} else if (!this.matchPunctuator(";")) {
|
|
1716
|
-
const d = this.context.isAssignmentTarget,
|
|
1714
|
+
const d = this.context.isAssignmentTarget, E = this.captureStartMarker();
|
|
1717
1715
|
t = this.inheritCoverGrammar(this.parseAssignmentExpression.bind(this));
|
|
1718
1716
|
const F = this.matchKeyword(f.In), k = this.matchContextualKeyword(te.Of);
|
|
1719
|
-
F || k ? (this.context.isAssignmentTarget || this.tolerateError(h.InvalidLeftHandSideInForIn,
|
|
1717
|
+
F || k ? (this.context.isAssignmentTarget || this.tolerateError(h.InvalidLeftHandSideInForIn, E), t.type !== u.Identifier && this.throwError(h.InvalidLeftHandSideInForIn, E), e = F ? u.ForInStatement : u.ForOfStatement, s = t) : this.context.isAssignmentTarget = d;
|
|
1720
1718
|
}
|
|
1721
1719
|
e === u.ForStatement ? (this.expectPunctuator(";"), i = this.matchPunctuator(";") ? null : this.isolateCoverGrammar(this.parseExpression.bind(this)), this.expectPunctuator(";"), r = this.matchPunctuator(")") ? null : this.isolateCoverGrammar(this.parseExpression.bind(this))) : (this.readNextRawToken(), a = this.parseExpression()), this.expectPunctuator(")");
|
|
1722
1720
|
const c = this.withBlockContext(
|
|
@@ -1871,7 +1869,7 @@ class ot {
|
|
|
1871
1869
|
});
|
|
1872
1870
|
}
|
|
1873
1871
|
}
|
|
1874
|
-
class
|
|
1872
|
+
class ot {
|
|
1875
1873
|
constructor(e, t) {
|
|
1876
1874
|
this.errorHandler = new _e(), this.errorHandler.tolerant = t ? typeof t.tolerant == "boolean" && t.tolerant : !1, this.scanner = new $e(e, this.errorHandler), this.trackComments = t ? typeof t.comment == "boolean" && t.comment : !1, this.buffer = [];
|
|
1877
1875
|
}
|
|
@@ -1912,10 +1910,10 @@ class ct {
|
|
|
1912
1910
|
}
|
|
1913
1911
|
}
|
|
1914
1912
|
function Re(n, e, t) {
|
|
1915
|
-
return new
|
|
1913
|
+
return new at(n, e, t).parseScript();
|
|
1916
1914
|
}
|
|
1917
|
-
function
|
|
1918
|
-
const i = new
|
|
1915
|
+
function ct(n, e, t) {
|
|
1916
|
+
const i = new ot(n, e), r = [];
|
|
1919
1917
|
let s;
|
|
1920
1918
|
try {
|
|
1921
1919
|
let a;
|
|
@@ -1948,7 +1946,7 @@ const p = {
|
|
|
1948
1946
|
UnexpectedEmptyFunction: "UnexpectedEmptyFunction",
|
|
1949
1947
|
UnexpectedPropertyIdentifier: "UnexpectedPropertyIdentifier",
|
|
1950
1948
|
UnknownPropertyIdentifier: "UnknownPropertyIdentifier"
|
|
1951
|
-
},
|
|
1949
|
+
}, ht = {
|
|
1952
1950
|
[p.AlreadyDefined]: "'${identifier}' is already defined.",
|
|
1953
1951
|
[p.ApiConflict]: "'${identifier}' is already defined as an Arcade constant or function.",
|
|
1954
1952
|
[p.AssignedNeverUsed]: "'${identifier}' is assigned but never used.",
|
|
@@ -1975,19 +1973,19 @@ const p = {
|
|
|
1975
1973
|
function Q(n, e) {
|
|
1976
1974
|
return n.line - e.line || n.column - e.column;
|
|
1977
1975
|
}
|
|
1978
|
-
function
|
|
1976
|
+
function lt(n, e) {
|
|
1979
1977
|
const t = {
|
|
1980
1978
|
start: n.loc.start,
|
|
1981
1979
|
end: n.loc.end
|
|
1982
|
-
}, i = (r) =>
|
|
1980
|
+
}, i = (r) => Dt(t, r.loc);
|
|
1983
1981
|
return Q(t.start, t.end) < 0 && (t.start = { ...t.start }, e.skipSpaces(t.start), Q(t.start, t.end) < 0 && (t.end = { ...t.end }, e.skipSpaces(t.end, !0))), n.leadingComments?.forEach(i), n.trailingComments?.forEach(i), t;
|
|
1984
1982
|
}
|
|
1985
|
-
function
|
|
1983
|
+
function Dt(n, e) {
|
|
1986
1984
|
Q(e.start, n.start) < 0 && (n.start = e.start), Q(n.end, e.end) < 0 && (n.end = e.end);
|
|
1987
1985
|
}
|
|
1988
|
-
const
|
|
1986
|
+
const pt = /\S/u;
|
|
1989
1987
|
function W(n = "") {
|
|
1990
|
-
return !
|
|
1988
|
+
return !pt.test(n);
|
|
1991
1989
|
}
|
|
1992
1990
|
const se = {
|
|
1993
1991
|
indentWidth: 2,
|
|
@@ -2001,7 +1999,7 @@ function de(n) {
|
|
|
2001
1999
|
quote: n?.quote ?? se.quote
|
|
2002
2000
|
};
|
|
2003
2001
|
}
|
|
2004
|
-
const
|
|
2002
|
+
const dt = /^\s*/u, mt = /\u000D\u000A|\u000D(?!\u000A)|\u000A|\u2028|\u2029/u;
|
|
2005
2003
|
class Z {
|
|
2006
2004
|
// private cachedIndentWidth: number | void = void 0;
|
|
2007
2005
|
constructor(e) {
|
|
@@ -2013,11 +2011,11 @@ class Z {
|
|
|
2013
2011
|
return e;
|
|
2014
2012
|
const i = t?.indentWidth;
|
|
2015
2013
|
return new Z(
|
|
2016
|
-
e.split(
|
|
2017
|
-
const a =
|
|
2014
|
+
e.split(mt).map((s) => {
|
|
2015
|
+
const a = dt.exec(s)?.[0] ?? "";
|
|
2018
2016
|
return {
|
|
2019
2017
|
line: s,
|
|
2020
|
-
indentation:
|
|
2018
|
+
indentation: ft(a, i),
|
|
2021
2019
|
// Boolean indicating whether this line can be re-indented.
|
|
2022
2020
|
locked: !1,
|
|
2023
2021
|
sliceStart: a.length,
|
|
@@ -2118,7 +2116,7 @@ class Z {
|
|
|
2118
2116
|
`);
|
|
2119
2117
|
}
|
|
2120
2118
|
}
|
|
2121
|
-
function
|
|
2119
|
+
function ft(n, e = 2) {
|
|
2122
2120
|
let t = 0;
|
|
2123
2121
|
const i = n.length;
|
|
2124
2122
|
for (let r = 0; r < i; r++)
|
|
@@ -2156,13 +2154,13 @@ function O(n, e, t) {
|
|
|
2156
2154
|
function ke(n, e, t) {
|
|
2157
2155
|
return !n && !t ? "" : n ? t ? `${n}${e}${t}` : n : t;
|
|
2158
2156
|
}
|
|
2159
|
-
const
|
|
2157
|
+
const Ct = /\u000D\u000A|\u000D(?!\u000A)|\u000A|\u2028|\u2029/u;
|
|
2160
2158
|
class D {
|
|
2161
2159
|
constructor(e = []) {
|
|
2162
2160
|
this.lines = e;
|
|
2163
2161
|
}
|
|
2164
2162
|
static fromString(e) {
|
|
2165
|
-
return new D(e.split(
|
|
2163
|
+
return new D(e.split(Ct));
|
|
2166
2164
|
}
|
|
2167
2165
|
/**
|
|
2168
2166
|
* Append the elements lines together into a new FormattedLines.
|
|
@@ -2251,10 +2249,10 @@ function M(n = 0, e) {
|
|
|
2251
2249
|
function K(n) {
|
|
2252
2250
|
return n.replace(/['"]/gu, (e) => e === '"' ? "'" : '"');
|
|
2253
2251
|
}
|
|
2254
|
-
function
|
|
2252
|
+
function Et(n, e) {
|
|
2255
2253
|
switch (n.type) {
|
|
2256
2254
|
case u.UnaryExpression:
|
|
2257
|
-
return (Fe(e) ||
|
|
2255
|
+
return (Fe(e) || et(e)) && e.object === n;
|
|
2258
2256
|
case u.BinaryExpression:
|
|
2259
2257
|
case u.LogicalExpression:
|
|
2260
2258
|
switch (e.type) {
|
|
@@ -2296,7 +2294,7 @@ function xt(n, e) {
|
|
|
2296
2294
|
return !1;
|
|
2297
2295
|
}
|
|
2298
2296
|
}
|
|
2299
|
-
function
|
|
2297
|
+
function C(n, e, t) {
|
|
2300
2298
|
switch (n?.type) {
|
|
2301
2299
|
case u.BinaryExpression:
|
|
2302
2300
|
case u.LogicalExpression:
|
|
@@ -2305,11 +2303,11 @@ function E(n, e, t) {
|
|
|
2305
2303
|
return new fe(n, e, t);
|
|
2306
2304
|
case u.MemberExpression:
|
|
2307
2305
|
case u.SafeMemberExpression:
|
|
2308
|
-
return new
|
|
2306
|
+
return new At(n, e, t);
|
|
2309
2307
|
case u.Identifier:
|
|
2310
2308
|
return new le(n, e, t);
|
|
2311
2309
|
case u.CallExpression:
|
|
2312
|
-
return new
|
|
2310
|
+
return new Ft(n, e, t);
|
|
2313
2311
|
case u.ObjectExpression:
|
|
2314
2312
|
return U(n, e, t);
|
|
2315
2313
|
case u.ArrayExpression:
|
|
@@ -2333,7 +2331,7 @@ function U(n, e, t) {
|
|
|
2333
2331
|
switch (n.type) {
|
|
2334
2332
|
case u.ArrayExpression:
|
|
2335
2333
|
return i.setupCollection(
|
|
2336
|
-
n.elements.map((r) =>
|
|
2334
|
+
n.elements.map((r) => C(r, n, t)),
|
|
2337
2335
|
"SquareBrackets"
|
|
2338
2336
|
), i;
|
|
2339
2337
|
case u.ObjectExpression:
|
|
@@ -2348,15 +2346,15 @@ function U(n, e, t) {
|
|
|
2348
2346
|
), i;
|
|
2349
2347
|
case u.FunctionDeclaration:
|
|
2350
2348
|
return i.prefix = `function ${n.id.name}`, i.setupCollection(
|
|
2351
|
-
n.params.map((r) =>
|
|
2349
|
+
n.params.map((r) => C(r, n, t)),
|
|
2352
2350
|
"Parentheses"
|
|
2353
2351
|
), i;
|
|
2354
2352
|
case u.ForStatement:
|
|
2355
2353
|
return i.prefix = "for ", i.setupCollection(
|
|
2356
2354
|
[
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2355
|
+
C(n.init, n, t),
|
|
2356
|
+
C(n.test, n, t),
|
|
2357
|
+
C(n.update, n, t)
|
|
2360
2358
|
],
|
|
2361
2359
|
"Parentheses",
|
|
2362
2360
|
";"
|
|
@@ -2365,9 +2363,9 @@ function U(n, e, t) {
|
|
|
2365
2363
|
case u.ForOfStatement:
|
|
2366
2364
|
return i.prefix = "for ", i.setupCollection([new fe(n, e, t)], "Parentheses", ""), i;
|
|
2367
2365
|
case u.IfStatement:
|
|
2368
|
-
return i.prefix = "if ", i.setupCollection([
|
|
2366
|
+
return i.prefix = "if ", i.setupCollection([C(n.test, n, t)], "Parentheses", ""), i;
|
|
2369
2367
|
case u.WhileStatement:
|
|
2370
|
-
return i.prefix = "while ", i.setupCollection([
|
|
2368
|
+
return i.prefix = "while ", i.setupCollection([C(n.test, n, t)], "Parentheses", ""), i;
|
|
2371
2369
|
default:
|
|
2372
2370
|
return i;
|
|
2373
2371
|
}
|
|
@@ -2379,7 +2377,7 @@ function gt(n, e, t) {
|
|
|
2379
2377
|
const r = [
|
|
2380
2378
|
...X(n.left, n.operator),
|
|
2381
2379
|
...X(n.right, n.operator)
|
|
2382
|
-
].map((a) =>
|
|
2380
|
+
].map((a) => C(a, n, t)), s = new Y(n, e, t);
|
|
2383
2381
|
return s.setupCollection(r, "None", ` ${n.operator}`), s;
|
|
2384
2382
|
}
|
|
2385
2383
|
function X(n, e) {
|
|
@@ -2390,7 +2388,7 @@ function X(n, e) {
|
|
|
2390
2388
|
}
|
|
2391
2389
|
class L {
|
|
2392
2390
|
constructor(e, t, i) {
|
|
2393
|
-
this.node = e, this.parent = t, this.options = i, this.prefix = "", this.suffix = "", this.groupingParentheses = !1, this.groupingParentheses =
|
|
2391
|
+
this.node = e, this.parent = t, this.options = i, this.prefix = "", this.suffix = "", this.groupingParentheses = !1, this.groupingParentheses = Et(e, t);
|
|
2394
2392
|
}
|
|
2395
2393
|
get openingParenthesis() {
|
|
2396
2394
|
return this.groupingParentheses ? "(" : "";
|
|
@@ -2444,7 +2442,7 @@ class Y extends L {
|
|
|
2444
2442
|
}
|
|
2445
2443
|
}
|
|
2446
2444
|
getLinesLevel(e = 0) {
|
|
2447
|
-
return this.bracketsType !== "None" ||
|
|
2445
|
+
return this.bracketsType !== "None" || Ye(this.parent) || Ve(this.parent) || (ce(this.node) || oe(this.node)) && (ce(this.parent) || oe(this.parent)) ? e + 1 : e;
|
|
2448
2446
|
}
|
|
2449
2447
|
finalize(e, t = "singleLine", i = 0) {
|
|
2450
2448
|
if (this.bracketsType === "None")
|
|
@@ -2486,17 +2484,17 @@ class Y extends L {
|
|
|
2486
2484
|
return this.finalize(i, e, t);
|
|
2487
2485
|
}
|
|
2488
2486
|
}
|
|
2489
|
-
const
|
|
2487
|
+
const xt = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/u;
|
|
2490
2488
|
class le extends L {
|
|
2491
2489
|
constructor(e, t, i) {
|
|
2492
2490
|
super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "StringPrinter";
|
|
2493
2491
|
}
|
|
2494
2492
|
format() {
|
|
2495
|
-
if (
|
|
2493
|
+
if (I(this.node))
|
|
2496
2494
|
return this.finalize(this.node.name);
|
|
2497
2495
|
if (typeof this.node.value != "string")
|
|
2498
2496
|
return this.finalize(this.node.raw);
|
|
2499
|
-
if (
|
|
2497
|
+
if (rt(this.parent) && this.parent.key === this.node && ze(this.node) && typeof this.node.value == "string" && xt.test(this.node.value))
|
|
2500
2498
|
return this.finalize(this.node.value);
|
|
2501
2499
|
switch (this.options.quote) {
|
|
2502
2500
|
case "auto": {
|
|
@@ -2513,16 +2511,16 @@ class le extends L {
|
|
|
2513
2511
|
class Ke extends L {
|
|
2514
2512
|
constructor(e, t, i) {
|
|
2515
2513
|
super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "SingleExpressionPrinter";
|
|
2516
|
-
const r =
|
|
2514
|
+
const r = it(e), s = nt(e);
|
|
2517
2515
|
if (r || s) {
|
|
2518
|
-
this.prefix = r ? e.operator : "", this.suffix = s && !e.prefix ? e.operator : "", this.printer =
|
|
2516
|
+
this.prefix = r ? e.operator : "", this.suffix = s && !e.prefix ? e.operator : "", this.printer = C(e.argument, e, this.options);
|
|
2519
2517
|
return;
|
|
2520
2518
|
}
|
|
2521
|
-
if (
|
|
2522
|
-
this.printer =
|
|
2519
|
+
if (tt(e)) {
|
|
2520
|
+
this.printer = C(e.expression, e, this.options);
|
|
2523
2521
|
return;
|
|
2524
2522
|
}
|
|
2525
|
-
this.printer =
|
|
2523
|
+
this.printer = C(e, t, this.options);
|
|
2526
2524
|
}
|
|
2527
2525
|
format(e = "singleLine", t = 0) {
|
|
2528
2526
|
return this.finalize(this.printer.format(e, t));
|
|
@@ -2536,28 +2534,28 @@ class De extends L {
|
|
|
2536
2534
|
return this.finalize(this.printer.format(e, t));
|
|
2537
2535
|
}
|
|
2538
2536
|
}
|
|
2539
|
-
class
|
|
2537
|
+
class Ft extends L {
|
|
2540
2538
|
constructor(e, t, i) {
|
|
2541
2539
|
super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "CallExpressionPrinter", this.argumentsPrinter = new Y(e, t, i), this.argumentsPrinter.setupCollection(
|
|
2542
|
-
e.arguments.map((r) =>
|
|
2540
|
+
e.arguments.map((r) => C(r, e, i)),
|
|
2543
2541
|
"Parentheses"
|
|
2544
|
-
),
|
|
2542
|
+
), I(e.callee) ? this.argumentsPrinter.prefix = e.callee.name : this.calleePrinter = C(e.callee, t, i);
|
|
2545
2543
|
}
|
|
2546
2544
|
format(e = "singleLine", t = 0) {
|
|
2547
|
-
if (!this.
|
|
2545
|
+
if (!this.calleePrinter)
|
|
2548
2546
|
return this.finalize(this.argumentsPrinter.format(e, t));
|
|
2549
|
-
let i = this.
|
|
2547
|
+
let i = this.calleePrinter.format("singleLine", t), r = this.argumentsPrinter.format("singleLine", t);
|
|
2550
2548
|
if (e === "singleLine")
|
|
2551
2549
|
return this.finalize(D.joinLines([i, r]));
|
|
2552
2550
|
let s = me(t, this.options) + this.leadingString.length + i.firstLineLength;
|
|
2553
|
-
return s + 1 < this.options.wrapColumn ? (r = this.argumentsPrinter.format("multiline", t), this.finalize(D.joinLines([i, r]))) : (i = this.
|
|
2551
|
+
return s + 1 < this.options.wrapColumn ? (r = this.argumentsPrinter.format("multiline", t), this.finalize(D.joinLines([i, r]))) : (i = this.calleePrinter.format("multiline", t), s = i.lastLineLength, s + r.maxLineLength > this.options.wrapColumn && (r = this.argumentsPrinter.format("multiline", t + 1)), this.finalize(D.joinLines([i, r])));
|
|
2554
2552
|
}
|
|
2555
2553
|
}
|
|
2556
|
-
class
|
|
2554
|
+
class At extends L {
|
|
2557
2555
|
constructor(e, t, i) {
|
|
2558
|
-
if (super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "MemberExpressionPrinter", this.objectPrinter =
|
|
2556
|
+
if (super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "MemberExpressionPrinter", this.objectPrinter = C(e.object, e, this.options), e.computed) {
|
|
2559
2557
|
const r = new Y(e.property, e, this.options);
|
|
2560
|
-
r.setupCollection([
|
|
2558
|
+
r.setupCollection([C(e.property, e, this.options)], "SquareBrackets"), r.prefix = e.type === "SafeMemberExpression" ? w : "", this.propertyPrinter = r;
|
|
2561
2559
|
} else {
|
|
2562
2560
|
const r = new Ke(e.property, e, this.options);
|
|
2563
2561
|
r.prefix = e.type === "SafeMemberExpression" ? w : ".", this.propertyPrinter = r;
|
|
@@ -2580,7 +2578,7 @@ class He extends L {
|
|
|
2580
2578
|
}
|
|
2581
2579
|
class yt extends L {
|
|
2582
2580
|
constructor(e, t, i) {
|
|
2583
|
-
super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "PropertyPrinter", this.key =
|
|
2581
|
+
super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "PropertyPrinter", this.key = C(e.key, e, this.options), e.shorthand || (this.key.suffix = ":", this.value = C(e.value, e, this.options));
|
|
2584
2582
|
}
|
|
2585
2583
|
format(e = "singleLine", t = 0) {
|
|
2586
2584
|
if (this.node.shorthand || !this.value)
|
|
@@ -2603,18 +2601,18 @@ class fe extends L {
|
|
|
2603
2601
|
constructor(e, t, i) {
|
|
2604
2602
|
switch (super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "OperationPrinter", this.operator = "", this.noNewLineWrapping = !1, e.type) {
|
|
2605
2603
|
case u.AssignmentExpression:
|
|
2606
|
-
this.leftPrinter =
|
|
2604
|
+
this.leftPrinter = C(e.left, e, this.options), this.operator = ` ${e.operator}`, this.rightPrinter = C(e.right, e, this.options), this.noNewLineWrapping = (I(e.left) || ze(e.left)) && (J(e.right) || xe(e.right));
|
|
2607
2605
|
return;
|
|
2608
2606
|
case u.VariableDeclarator:
|
|
2609
|
-
this.leftPrinter =
|
|
2607
|
+
this.leftPrinter = C(e.id, e, this.options), e.init && (this.operator = " =", this.rightPrinter = C(e.init, e, this.options)), this.noNewLineWrapping = J(e.init) || xe(e.init);
|
|
2610
2608
|
return;
|
|
2611
2609
|
case u.ForInStatement:
|
|
2612
2610
|
case u.ForOfStatement:
|
|
2613
|
-
this.leftPrinter =
|
|
2611
|
+
this.leftPrinter = C(e.left, e, this.options), this.operator = e.type === "ForInStatement" ? " in" : " of", this.rightPrinter = C(e.right, e, this.options);
|
|
2614
2612
|
return;
|
|
2615
2613
|
case u.BinaryExpression:
|
|
2616
2614
|
case u.LogicalExpression:
|
|
2617
|
-
this.leftPrinter =
|
|
2615
|
+
this.leftPrinter = C(e.left, e, this.options), this.operator = ` ${e.operator}`, this.rightPrinter = C(e.right, e, this.options);
|
|
2618
2616
|
return;
|
|
2619
2617
|
}
|
|
2620
2618
|
}
|
|
@@ -2637,7 +2635,7 @@ class Bt extends L {
|
|
|
2637
2635
|
constructor(e, t, i) {
|
|
2638
2636
|
super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "TemplateLiteralPrinter", this.parts = [];
|
|
2639
2637
|
const r = e.expressions.map(
|
|
2640
|
-
(s) =>
|
|
2638
|
+
(s) => C(s, e, this.options)
|
|
2641
2639
|
);
|
|
2642
2640
|
this.parts.push("`"), e.quasis.forEach((s, a) => {
|
|
2643
2641
|
this.parts.push(s.value.raw), a < r.length && (this.parts.push("${"), this.parts.push(r[a]), this.parts.push("}"));
|
|
@@ -2653,7 +2651,7 @@ function St(n) {
|
|
|
2653
2651
|
const e = { ...n.leadingComments?.slice(0, 1)[0]?.loc.start ?? n.loc.start }, t = { ...n.trailingComments?.slice(-1)[0]?.loc.end ?? n.loc.end };
|
|
2654
2652
|
return { start: e, end: t };
|
|
2655
2653
|
}
|
|
2656
|
-
function
|
|
2654
|
+
function It(n) {
|
|
2657
2655
|
return n.trailingComments?.slice(-1)[0]?.type === u.LineComment;
|
|
2658
2656
|
}
|
|
2659
2657
|
class T {
|
|
@@ -2688,7 +2686,7 @@ class T {
|
|
|
2688
2686
|
case u.EmptyStatement:
|
|
2689
2687
|
case u.BreakStatement:
|
|
2690
2688
|
case u.ContinueStatement:
|
|
2691
|
-
return new
|
|
2689
|
+
return new bt(e, this.node, this.options);
|
|
2692
2690
|
default:
|
|
2693
2691
|
throw new Error(`unknown type: ${JSON.stringify(e)}`);
|
|
2694
2692
|
}
|
|
@@ -2771,7 +2769,7 @@ class T {
|
|
|
2771
2769
|
) ?? { formattedLines: s }).formattedLines;
|
|
2772
2770
|
}
|
|
2773
2771
|
formatInnerComments(e = 0) {
|
|
2774
|
-
if (!
|
|
2772
|
+
if (!b(this.node) || !Array.isArray(this.node.innerComments) || !this.node.innerComments.length)
|
|
2775
2773
|
return new D();
|
|
2776
2774
|
const t = this.getIndentation(e);
|
|
2777
2775
|
return this.node.innerComments.reduce(
|
|
@@ -2813,7 +2811,7 @@ class $ extends T {
|
|
|
2813
2811
|
format(e = 0) {
|
|
2814
2812
|
if (this.printers.length === 0)
|
|
2815
2813
|
return this.formatEmptyBlock(e);
|
|
2816
|
-
const t = [], i =
|
|
2814
|
+
const t = [], i = b(this.node);
|
|
2817
2815
|
i && t.push("{");
|
|
2818
2816
|
const r = i ? e + 1 : e;
|
|
2819
2817
|
let s;
|
|
@@ -2825,13 +2823,13 @@ class $ extends T {
|
|
|
2825
2823
|
}), i && t.push(`${this.getIndentation(e)}}`), this.addComments(D.appendLines(t), e);
|
|
2826
2824
|
}
|
|
2827
2825
|
formatEmptyBlock(e = 0) {
|
|
2828
|
-
if (!
|
|
2826
|
+
if (!b(this.node))
|
|
2829
2827
|
return this.addComments(D.fromString(""), e);
|
|
2830
2828
|
const t = this.formatInnerComments(e + 1), i = "{", r = `${this.getIndentation(e)}}`;
|
|
2831
2829
|
return t.isEmpty ? ae(this.parent) ? this.addComments(D.appendLines([i, r]), e) : this.addComments(D.fromString("{}"), e) : this.addComments(D.appendLines([i, t, r]), e);
|
|
2832
2830
|
}
|
|
2833
2831
|
}
|
|
2834
|
-
class
|
|
2832
|
+
class bt extends T {
|
|
2835
2833
|
constructor(e, t, i) {
|
|
2836
2834
|
switch (super(e, t, i), this.node = e, this.keyword = "", this.node.type) {
|
|
2837
2835
|
case u.ContinueStatement:
|
|
@@ -2868,9 +2866,9 @@ class Le extends T {
|
|
|
2868
2866
|
}
|
|
2869
2867
|
class Te extends T {
|
|
2870
2868
|
constructor(e, t, i) {
|
|
2871
|
-
if (super(e, t, i), this.node = e,
|
|
2869
|
+
if (super(e, t, i), this.node = e, ge(e))
|
|
2872
2870
|
this.header = U(e, t, i), this.body = new $(e.body, e, i);
|
|
2873
|
-
else if (
|
|
2871
|
+
else if (ge(e.declaration))
|
|
2874
2872
|
this.header = U(e.declaration, t, i), this.header.prefix = "export ", this.body = new $(e.declaration.body, e, i);
|
|
2875
2873
|
else
|
|
2876
2874
|
throw new Error(`invalid type: ${JSON.stringify(e)}`);
|
|
@@ -2894,12 +2892,12 @@ class wt extends T {
|
|
|
2894
2892
|
format(e = 0, t = "optimized") {
|
|
2895
2893
|
let i = !1, r;
|
|
2896
2894
|
if (t === "singleLine" || t === "optimized") {
|
|
2897
|
-
const c = this.header.format("singleLine", e), d =
|
|
2895
|
+
const c = this.header.format("singleLine", e), d = b(this.node.consequent) ? 2 : 0;
|
|
2898
2896
|
(t === "singleLine" || this.canFitSingleLine(c, e, d)) && (r = c);
|
|
2899
2897
|
}
|
|
2900
2898
|
r || (i = !0, r = this.header.format("multiline", e));
|
|
2901
2899
|
let s;
|
|
2902
|
-
if (
|
|
2900
|
+
if (b(this.node.consequent)) {
|
|
2903
2901
|
const c = this.consequent.format(e, "optimized");
|
|
2904
2902
|
s = D.joinLines([r, " ", c]);
|
|
2905
2903
|
} else if (i || ae(this.node.consequent)) {
|
|
@@ -2913,9 +2911,9 @@ class wt extends T {
|
|
|
2913
2911
|
}
|
|
2914
2912
|
if (!this.alternate)
|
|
2915
2913
|
return this.addComments(s, e);
|
|
2916
|
-
const a =
|
|
2914
|
+
const a = It(this.node.consequent) || !b(this.node.consequent);
|
|
2917
2915
|
let o;
|
|
2918
|
-
if (this.alternate.externalOffset = 0,
|
|
2916
|
+
if (this.alternate.externalOffset = 0, b(this.node.alternate) || ae(this.node.alternate))
|
|
2919
2917
|
this.alternate.indentStatementFirstLine = !1, this.alternate.externalOffset = a ? 5 : s.lastLineLength + 6, o = this.alternate.format(e, "optimized"), o = D.joinLines(["else ", o]);
|
|
2920
2918
|
else {
|
|
2921
2919
|
const c = a ? 4 : s.lastLineLength + 4;
|
|
@@ -2942,7 +2940,7 @@ class kt extends T {
|
|
|
2942
2940
|
}
|
|
2943
2941
|
class Lt extends T {
|
|
2944
2942
|
constructor(e, t, i) {
|
|
2945
|
-
super(e, t, i), this.node = e, this.expression =
|
|
2943
|
+
super(e, t, i), this.node = e, this.expression = C(e.expression, e, i);
|
|
2946
2944
|
}
|
|
2947
2945
|
format(e = 0, t = "optimized") {
|
|
2948
2946
|
if (t === "singleLine" || t === "optimized") {
|
|
@@ -2955,7 +2953,7 @@ class Lt extends T {
|
|
|
2955
2953
|
}
|
|
2956
2954
|
class Tt extends T {
|
|
2957
2955
|
constructor(e, t, i) {
|
|
2958
|
-
super(e, t, i), this.node = e, this.argument =
|
|
2956
|
+
super(e, t, i), this.node = e, this.argument = C(e.argument, e, i);
|
|
2959
2957
|
}
|
|
2960
2958
|
format(e = 0, t = "optimized") {
|
|
2961
2959
|
if (t === "singleLine" || t === "optimized") {
|
|
@@ -2973,7 +2971,7 @@ class Tt extends T {
|
|
|
2973
2971
|
}
|
|
2974
2972
|
class vt extends T {
|
|
2975
2973
|
constructor(e, t, i) {
|
|
2976
|
-
super(e, t, i), this.node = e, this.libraryNamePrinter =
|
|
2974
|
+
super(e, t, i), this.node = e, this.libraryNamePrinter = C(e.specifiers[0].local, e, i), this.librarySourcePrinter = C(e.source, e, i);
|
|
2977
2975
|
}
|
|
2978
2976
|
format(e = 0) {
|
|
2979
2977
|
return this.addComments(
|
|
@@ -3003,13 +3001,13 @@ function Nt(n, e) {
|
|
|
3003
3001
|
const t = de(e), i = Z.fromString(n, t), r = i.toString(), s = Re(r, {
|
|
3004
3002
|
tolerant: !0,
|
|
3005
3003
|
comments: !0
|
|
3006
|
-
}), a =
|
|
3004
|
+
}), a = lt(s, i);
|
|
3007
3005
|
return s.loc.start = a.start, s.loc.end = a.end, new $(s, null, t).format().toString();
|
|
3008
3006
|
}
|
|
3009
|
-
const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debugger", "switch", "try"], jt = Ut.map((n) => ({ label: n, kind:
|
|
3007
|
+
const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debugger", "switch", "try"], jt = Ut.map((n) => ({ label: n, kind: x.Constant })), zt = Mt.map((n) => ({ label: n, kind: x.Keyword })), Vt = [
|
|
3010
3008
|
{
|
|
3011
3009
|
label: "exportfunction",
|
|
3012
|
-
kind:
|
|
3010
|
+
kind: x.Snippet,
|
|
3013
3011
|
detail: "Export Function Statement",
|
|
3014
3012
|
insertText: `export function \${1:functionName} ($2) {
|
|
3015
3013
|
$0
|
|
@@ -3019,7 +3017,7 @@ const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debu
|
|
|
3019
3017
|
},
|
|
3020
3018
|
{
|
|
3021
3019
|
label: "exportvar",
|
|
3022
|
-
kind:
|
|
3020
|
+
kind: x.Snippet,
|
|
3023
3021
|
detail: "Export Variable Statement",
|
|
3024
3022
|
insertText: "export var ${0:variableName}\n",
|
|
3025
3023
|
insertTextMode: S.adjustIndentation,
|
|
@@ -3027,7 +3025,7 @@ const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debu
|
|
|
3027
3025
|
},
|
|
3028
3026
|
{
|
|
3029
3027
|
label: "for",
|
|
3030
|
-
kind:
|
|
3028
|
+
kind: x.Snippet,
|
|
3031
3029
|
detail: "For Loop Statement",
|
|
3032
3030
|
insertText: "for (var ${1:i} = 0; ${1:i} < ${2:array.length}; ${1:i}++) {\n $0\n}",
|
|
3033
3031
|
insertTextMode: S.adjustIndentation,
|
|
@@ -3035,7 +3033,7 @@ const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debu
|
|
|
3035
3033
|
},
|
|
3036
3034
|
{
|
|
3037
3035
|
label: "forin",
|
|
3038
|
-
kind:
|
|
3036
|
+
kind: x.Snippet,
|
|
3039
3037
|
detail: "For-In Loop Statement",
|
|
3040
3038
|
insertText: "for (var ${1:i} in ${2:arrayOrObject}) {\n $0\n}",
|
|
3041
3039
|
insertTextMode: S.adjustIndentation,
|
|
@@ -3043,7 +3041,7 @@ const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debu
|
|
|
3043
3041
|
},
|
|
3044
3042
|
{
|
|
3045
3043
|
label: "forof",
|
|
3046
|
-
kind:
|
|
3044
|
+
kind: x.Snippet,
|
|
3047
3045
|
detail: "For-Of Loop Statement",
|
|
3048
3046
|
insertText: "for (var ${1:i} of ${2:arrayOrObject}) {\n $0\n}",
|
|
3049
3047
|
insertTextMode: S.adjustIndentation,
|
|
@@ -3051,7 +3049,7 @@ const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debu
|
|
|
3051
3049
|
},
|
|
3052
3050
|
{
|
|
3053
3051
|
label: "function",
|
|
3054
|
-
kind:
|
|
3052
|
+
kind: x.Snippet,
|
|
3055
3053
|
detail: "Function Statement",
|
|
3056
3054
|
insertText: `function \${1:functionName} ($2) {
|
|
3057
3055
|
$0
|
|
@@ -3061,7 +3059,7 @@ const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debu
|
|
|
3061
3059
|
},
|
|
3062
3060
|
{
|
|
3063
3061
|
label: "if",
|
|
3064
|
-
kind:
|
|
3062
|
+
kind: x.Snippet,
|
|
3065
3063
|
detail: "If Statement",
|
|
3066
3064
|
insertText: `if (\${1:1==1}) {
|
|
3067
3065
|
$0
|
|
@@ -3071,7 +3069,7 @@ const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debu
|
|
|
3071
3069
|
},
|
|
3072
3070
|
{
|
|
3073
3071
|
label: "ifelse",
|
|
3074
|
-
kind:
|
|
3072
|
+
kind: x.Snippet,
|
|
3075
3073
|
detail: "If-Else Statement",
|
|
3076
3074
|
insertText: `if (\${1:1==1}) {
|
|
3077
3075
|
$0
|
|
@@ -3083,7 +3081,7 @@ const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debu
|
|
|
3083
3081
|
},
|
|
3084
3082
|
{
|
|
3085
3083
|
label: "else",
|
|
3086
|
-
kind:
|
|
3084
|
+
kind: x.Snippet,
|
|
3087
3085
|
detail: "Else Statement",
|
|
3088
3086
|
insertText: `else {
|
|
3089
3087
|
$0
|
|
@@ -3093,7 +3091,7 @@ const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debu
|
|
|
3093
3091
|
},
|
|
3094
3092
|
{
|
|
3095
3093
|
label: "import",
|
|
3096
|
-
kind:
|
|
3094
|
+
kind: x.Snippet,
|
|
3097
3095
|
detail: "Import Statement",
|
|
3098
3096
|
insertText: 'import ${1:namespace} from "${0:uri}"',
|
|
3099
3097
|
insertTextMode: S.adjustIndentation,
|
|
@@ -3101,7 +3099,7 @@ const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debu
|
|
|
3101
3099
|
},
|
|
3102
3100
|
{
|
|
3103
3101
|
label: "while",
|
|
3104
|
-
kind:
|
|
3102
|
+
kind: x.Snippet,
|
|
3105
3103
|
detail: "While Loop Statement",
|
|
3106
3104
|
insertText: `while (\${1:false}) {
|
|
3107
3105
|
$0
|
|
@@ -3120,10 +3118,10 @@ function $t(n, e) {
|
|
|
3120
3118
|
function Rt(n, e) {
|
|
3121
3119
|
return n.line < e.start.line;
|
|
3122
3120
|
}
|
|
3123
|
-
function
|
|
3121
|
+
function He(n, e) {
|
|
3124
3122
|
return !(Rt(n, e) || $t(n, e) || n.line === e.start.line && n.column < e.start.column || n.line === e.end.line && n.column > e.end.column);
|
|
3125
3123
|
}
|
|
3126
|
-
const
|
|
3124
|
+
const g = {
|
|
3127
3125
|
None: 0,
|
|
3128
3126
|
Keywords: 1,
|
|
3129
3127
|
All: 255,
|
|
@@ -3138,27 +3136,27 @@ const x = {
|
|
|
3138
3136
|
keywords: "c"
|
|
3139
3137
|
};
|
|
3140
3138
|
function Wt(n, e, t, i = {}) {
|
|
3141
|
-
const r = n.getText({ start: { line: 0, character: 0 }, end: e }), { tokens: s, errors: a = [] } =
|
|
3139
|
+
const r = n.getText({ start: { line: 0, character: 0 }, end: e }), { tokens: s, errors: a = [] } = ct(r, { loc: !0, tolerant: !0 });
|
|
3142
3140
|
if (a.length)
|
|
3143
3141
|
return { isIncomplete: !1, items: [] };
|
|
3144
3142
|
let o = s.at(s.length - 1), c = "";
|
|
3145
3143
|
const d = ni(e);
|
|
3146
|
-
o?.type === "Identifier" &&
|
|
3147
|
-
const
|
|
3144
|
+
o?.type === "Identifier" && He(d, o.loc) && (c = o.value, s.pop(), o = s[s.length - 1]);
|
|
3145
|
+
const E = {
|
|
3148
3146
|
variables: i.profile?.variables ?? [],
|
|
3149
3147
|
additionalCompletionItems: (i.snippets ?? []).map((F) => ({
|
|
3150
|
-
kind:
|
|
3148
|
+
kind: x.Snippet,
|
|
3151
3149
|
insertTextMode: S.adjustIndentation,
|
|
3152
3150
|
insertTextFormat: B.Snippet,
|
|
3153
3151
|
...F
|
|
3154
3152
|
})),
|
|
3155
3153
|
apiDatabase: t
|
|
3156
3154
|
};
|
|
3157
|
-
return o?.type === "Punctuator" && (o.value === "." || o.value === w) ? Ht(s, c,
|
|
3155
|
+
return o?.type === "Punctuator" && (o.value === "." || o.value === w) ? Ht(s, c, E) : Kt(s, c, d, E);
|
|
3158
3156
|
}
|
|
3159
3157
|
function Kt(n, e, t, i) {
|
|
3160
3158
|
const r = Jt(n, t);
|
|
3161
|
-
if (r ===
|
|
3159
|
+
if (r === g.None)
|
|
3162
3160
|
return { isIncomplete: !1, items: [] };
|
|
3163
3161
|
const s = Xt(n), a = [], o = new RegExp(e.replaceAll(Ce, "\\$&"), "i");
|
|
3164
3162
|
return s.forEach((c, d) => {
|
|
@@ -3176,8 +3174,8 @@ function Kt(n, e, t, i) {
|
|
|
3176
3174
|
}), i.apiDatabase.constantDefinitions.forEach((c, d) => {
|
|
3177
3175
|
c.type === "constant" && c.disableDocumentation === !0 || !o.test(d) || a.push({ ...c.completion, sortText: v.constants });
|
|
3178
3176
|
}), i.apiDatabase.functionDefinitions.forEach((c, d) => {
|
|
3179
|
-
o.test(d) && c.overloads.forEach((
|
|
3180
|
-
|
|
3177
|
+
o.test(d) && c.overloads.forEach((E) => {
|
|
3178
|
+
E.disableDocumentation || a.push({ ...E.completion, sortText: v.functions });
|
|
3181
3179
|
});
|
|
3182
3180
|
}), { isIncomplete: !1, items: a };
|
|
3183
3181
|
}
|
|
@@ -3211,8 +3209,8 @@ function Gt(n, e, t, i) {
|
|
|
3211
3209
|
return null;
|
|
3212
3210
|
let r = n.shift(), s = i.variables;
|
|
3213
3211
|
for (; r; ) {
|
|
3214
|
-
const d = s.find((
|
|
3215
|
-
if (!
|
|
3212
|
+
const d = s.find((E) => E.name.toLowerCase() === r);
|
|
3213
|
+
if (!Ge(d))
|
|
3216
3214
|
return null;
|
|
3217
3215
|
s = d.properties ?? [], r = n.shift();
|
|
3218
3216
|
}
|
|
@@ -3222,40 +3220,40 @@ function Gt(n, e, t, i) {
|
|
|
3222
3220
|
}), { isIncomplete: !1, items: a };
|
|
3223
3221
|
}
|
|
3224
3222
|
function ve(n) {
|
|
3225
|
-
return (n &
|
|
3223
|
+
return (n & g.Keywords) === g.Keywords;
|
|
3226
3224
|
}
|
|
3227
3225
|
function Jt(n, e) {
|
|
3228
3226
|
if (!n.length)
|
|
3229
|
-
return
|
|
3227
|
+
return g.All;
|
|
3230
3228
|
const t = n[n.length - 1];
|
|
3231
3229
|
switch (t.type) {
|
|
3232
3230
|
case "Identifier":
|
|
3233
|
-
return
|
|
3231
|
+
return g.All;
|
|
3234
3232
|
case "Keyword":
|
|
3235
|
-
return ["return", "in", "else"].includes(t.value) ?
|
|
3233
|
+
return ["return", "in", "else"].includes(t.value) ? g.NoKeywords : g.None;
|
|
3236
3234
|
case "Punctuator":
|
|
3237
3235
|
return Qt(n);
|
|
3238
3236
|
case "Template":
|
|
3239
|
-
return t.value.endsWith("${") ?
|
|
3237
|
+
return t.value.endsWith("${") ? g.NoKeywords : g.All;
|
|
3240
3238
|
default:
|
|
3241
|
-
return
|
|
3239
|
+
return He(e, t.loc) ? g.None : g.All;
|
|
3242
3240
|
}
|
|
3243
3241
|
}
|
|
3244
3242
|
function Qt(n) {
|
|
3245
3243
|
const e = [...n];
|
|
3246
3244
|
let t = e.pop();
|
|
3247
3245
|
if (!t)
|
|
3248
|
-
return
|
|
3246
|
+
return g.All;
|
|
3249
3247
|
if (t.type !== "Punctuator")
|
|
3250
|
-
return
|
|
3248
|
+
return g.None;
|
|
3251
3249
|
if (t.value !== "(" && t.value !== ",")
|
|
3252
|
-
return
|
|
3250
|
+
return g.All;
|
|
3253
3251
|
if (t.value === "(")
|
|
3254
3252
|
return Pe(e);
|
|
3255
3253
|
let i = 0;
|
|
3256
3254
|
for (t = e.pop(); t; ) {
|
|
3257
3255
|
if (t.type === "Keyword")
|
|
3258
|
-
return
|
|
3256
|
+
return g.None;
|
|
3259
3257
|
if (t.type !== "Punctuator") {
|
|
3260
3258
|
t = e.pop();
|
|
3261
3259
|
continue;
|
|
@@ -3266,7 +3264,7 @@ function Qt(n) {
|
|
|
3266
3264
|
}
|
|
3267
3265
|
if (t.value === "[") {
|
|
3268
3266
|
if (i === 0)
|
|
3269
|
-
return
|
|
3267
|
+
return g.NoKeywords;
|
|
3270
3268
|
i += 1, t = e.pop();
|
|
3271
3269
|
continue;
|
|
3272
3270
|
}
|
|
@@ -3278,12 +3276,12 @@ function Qt(n) {
|
|
|
3278
3276
|
}
|
|
3279
3277
|
t = e.pop();
|
|
3280
3278
|
}
|
|
3281
|
-
return
|
|
3279
|
+
return g.None;
|
|
3282
3280
|
}
|
|
3283
3281
|
function Pe(n) {
|
|
3284
3282
|
const e = [...n];
|
|
3285
3283
|
let t = e.pop();
|
|
3286
|
-
return t ? t.type === "Keyword" ? t.value.toLowerCase() === "for" ?
|
|
3284
|
+
return t ? t.type === "Keyword" ? t.value.toLowerCase() === "for" ? g.All : g.NoKeywords : t.type !== "Identifier" ? g.All : (t = e.pop(), t?.type === "Keyword" && t.value.toLowerCase() === "function" ? g.None : g.NoKeywords) : g.All;
|
|
3287
3285
|
}
|
|
3288
3286
|
class Zt {
|
|
3289
3287
|
constructor(e) {
|
|
@@ -3335,7 +3333,7 @@ function Yt(n, e) {
|
|
|
3335
3333
|
const t = n.current.value, i = t.toLowerCase();
|
|
3336
3334
|
e.set(i, {
|
|
3337
3335
|
label: t,
|
|
3338
|
-
kind:
|
|
3336
|
+
kind: x.Variable,
|
|
3339
3337
|
detail: _(H.variableFormat, { name: t })
|
|
3340
3338
|
});
|
|
3341
3339
|
const r = n.increment();
|
|
@@ -3357,7 +3355,7 @@ function ei(n, e) {
|
|
|
3357
3355
|
return;
|
|
3358
3356
|
const t = n.current.value, i = t.toLowerCase(), r = {
|
|
3359
3357
|
label: t,
|
|
3360
|
-
kind:
|
|
3358
|
+
kind: x.Function,
|
|
3361
3359
|
detail: _(H.functionFormat, { name: t, paramsDetail: "" }),
|
|
3362
3360
|
insertText: `${t}()`,
|
|
3363
3361
|
insertTextMode: S.adjustIndentation,
|
|
@@ -3376,7 +3374,7 @@ function ei(n, e) {
|
|
|
3376
3374
|
name: r.label,
|
|
3377
3375
|
paramsDetail: a.join(", ")
|
|
3378
3376
|
});
|
|
3379
|
-
const d = a.map((
|
|
3377
|
+
const d = a.map((E, F) => `\${${F + 1}:${E}}`).join(", ");
|
|
3380
3378
|
r.insertText = `${r.label}(${d})`;
|
|
3381
3379
|
}
|
|
3382
3380
|
if (!P(s, ")") || (s = n.increment(), !P(s, "{")))
|
|
@@ -3389,10 +3387,10 @@ function ei(n, e) {
|
|
|
3389
3387
|
if (c === 0)
|
|
3390
3388
|
return;
|
|
3391
3389
|
n.currentIndex = o, a.forEach((d) => {
|
|
3392
|
-
const
|
|
3393
|
-
e.set(
|
|
3390
|
+
const E = d.toLowerCase();
|
|
3391
|
+
e.set(E, {
|
|
3394
3392
|
label: d,
|
|
3395
|
-
kind:
|
|
3393
|
+
kind: x.Variable,
|
|
3396
3394
|
detail: _(H.parameterFormat, { name: d })
|
|
3397
3395
|
});
|
|
3398
3396
|
});
|
|
@@ -3592,7 +3590,7 @@ class si {
|
|
|
3592
3590
|
const i = {
|
|
3593
3591
|
severity: A.Error,
|
|
3594
3592
|
...t,
|
|
3595
|
-
message: _(
|
|
3593
|
+
message: _(ht[t.code], t.data),
|
|
3596
3594
|
range: {
|
|
3597
3595
|
start: { line: e.start.line - 1, character: e.start.column },
|
|
3598
3596
|
end: { line: e.end.line - 1, character: e.end.column }
|
|
@@ -3656,7 +3654,7 @@ class si {
|
|
|
3656
3654
|
}), this.inBlock(this.validateStatement, e.body);
|
|
3657
3655
|
}
|
|
3658
3656
|
validateForInOfStatement(e) {
|
|
3659
|
-
if (
|
|
3657
|
+
if (I(e.left)) {
|
|
3660
3658
|
const t = this._assignmentValidationMode;
|
|
3661
3659
|
this._assignmentValidationMode = "left", this._identifierBeingAssigned = e.left.name.toLowerCase(), this.validateExpression(e.left), this._assignmentValidationMode = t;
|
|
3662
3660
|
} else
|
|
@@ -3677,11 +3675,11 @@ class si {
|
|
|
3677
3675
|
}
|
|
3678
3676
|
validateAssignmentExpression(e) {
|
|
3679
3677
|
const t = this._identifierBeingAssigned, i = this._assignmentValidationMode;
|
|
3680
|
-
|
|
3678
|
+
I(e.left) && (this._identifierBeingAssigned = e.left.name.toLowerCase(), this._assignmentValidationMode = "left"), this.validateExpression(e.left), I(e.left) && (this._assignmentValidationMode = "right"), this.validateExpression(e.right), this._identifierBeingAssigned = t, this._assignmentValidationMode = i;
|
|
3681
3679
|
}
|
|
3682
3680
|
validateCallExpression(e) {
|
|
3683
3681
|
const t = this._isInCallExpression;
|
|
3684
|
-
if (this._isInCallExpression = !0, this.validateExpression(e.callee),
|
|
3682
|
+
if (this._isInCallExpression = !0, this.validateExpression(e.callee), I(e.callee)) {
|
|
3685
3683
|
const i = e.callee.name.toLowerCase(), r = this.getIdentifierInfo(i), s = this._apiDatabase?.functionDefinitions.get(i);
|
|
3686
3684
|
if (!r && s) {
|
|
3687
3685
|
const a = ai(s, e.arguments.length);
|
|
@@ -3765,13 +3763,13 @@ class si {
|
|
|
3765
3763
|
}
|
|
3766
3764
|
validateMemberExpression(e) {
|
|
3767
3765
|
const t = this.flattenMemberExpressionAndValidate(e), i = t[0].object;
|
|
3768
|
-
this.disableRecordIdentifierAssignment(this.validateExpression, i),
|
|
3766
|
+
this.disableRecordIdentifierAssignment(this.validateExpression, i), I(i) && (this.getIdentifierInfo(i.name.toLowerCase()) || this.validateMemberExpressionWithProfile(t) || this.validateConstantMemberExpression(t));
|
|
3769
3767
|
}
|
|
3770
3768
|
flattenMemberExpressionAndValidate(e) {
|
|
3771
3769
|
switch (e.type) {
|
|
3772
3770
|
case u.SafeMemberExpression:
|
|
3773
3771
|
case u.MemberExpression:
|
|
3774
|
-
return (!
|
|
3772
|
+
return (!I(e.property) || e.computed) && this.validateExpression(e.property), [...this.flattenMemberExpressionAndValidate(e.object), e];
|
|
3775
3773
|
default:
|
|
3776
3774
|
return [];
|
|
3777
3775
|
}
|
|
@@ -3788,7 +3786,7 @@ class si {
|
|
|
3788
3786
|
}
|
|
3789
3787
|
validateConstantMemberExpression(e) {
|
|
3790
3788
|
const t = e[0];
|
|
3791
|
-
if (!
|
|
3789
|
+
if (!I(t.object))
|
|
3792
3790
|
return !1;
|
|
3793
3791
|
const i = t.object.name.toLowerCase(), r = this._apiDatabase?.constantDefinitions.get(i);
|
|
3794
3792
|
if (!r)
|
|
@@ -3850,7 +3848,7 @@ class si {
|
|
|
3850
3848
|
);
|
|
3851
3849
|
if (!c) {
|
|
3852
3850
|
const d = s.properties.reduce(
|
|
3853
|
-
(
|
|
3851
|
+
(E, F) => `${E}${E ? " | " : ""}${F.name.split(".").pop()}`,
|
|
3854
3852
|
""
|
|
3855
3853
|
);
|
|
3856
3854
|
return this.logDiagnostic(e[a].property.loc, {
|
|
@@ -3943,7 +3941,7 @@ function ui(n) {
|
|
|
3943
3941
|
return !!n && n.name === "ParsingError";
|
|
3944
3942
|
}
|
|
3945
3943
|
function j(n) {
|
|
3946
|
-
return pe(n) ||
|
|
3944
|
+
return pe(n) || b(n) && !n.body.length;
|
|
3947
3945
|
}
|
|
3948
3946
|
function ai(n, e) {
|
|
3949
3947
|
const { min: t, max: i } = n.overloads.reduce(
|
|
@@ -3961,7 +3959,7 @@ function ci(n = "") {
|
|
|
3961
3959
|
}
|
|
3962
3960
|
class pi {
|
|
3963
3961
|
configure(e) {
|
|
3964
|
-
this.apiService = new
|
|
3962
|
+
this.apiService = new Je(e);
|
|
3965
3963
|
}
|
|
3966
3964
|
async doValidation(e, t) {
|
|
3967
3965
|
if (!this.apiService)
|
|
@@ -3981,7 +3979,7 @@ export {
|
|
|
3981
3979
|
pi as ArcadeLanguageService,
|
|
3982
3980
|
Ut as ArcadeLiterals,
|
|
3983
3981
|
Ot as ArcadeReservedKeywords,
|
|
3984
|
-
|
|
3982
|
+
ht as DiagnosticMessages,
|
|
3985
3983
|
fi as DiagnosticSeverity,
|
|
3986
3984
|
p as ValidationDiagnosticCodes,
|
|
3987
3985
|
Di as arcadeFormat,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/arcade-languageservice",
|
|
3
|
-
"version": "5.1.0-next.
|
|
3
|
+
"version": "5.1.0-next.90",
|
|
4
4
|
"description": "Arcade Language Service",
|
|
5
5
|
"homepage": "https://developers.arcgis.com/javascript/latest/",
|
|
6
6
|
"type": "module",
|
|
@@ -15,6 +15,6 @@
|
|
|
15
15
|
"tslib": "^2.8.1",
|
|
16
16
|
"vscode-languageserver-textdocument": "^1.0.11",
|
|
17
17
|
"vscode-languageserver-types": "^3.17.5",
|
|
18
|
-
"@arcgis/languages-api-utils": "5.1.0-next.
|
|
18
|
+
"@arcgis/languages-api-utils": "5.1.0-next.90"
|
|
19
19
|
}
|
|
20
20
|
}
|