@spyglassmc/java-edition 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/binder/index.d.ts +1 -1
- package/lib/binder/index.js +94 -19
- package/lib/common/index.js +10 -7
- package/lib/dependency/index.d.ts +1 -3
- package/lib/dependency/index.js +29 -21
- package/lib/dependency/mcmeta.d.ts +1 -1
- package/lib/dependency/mcmeta.js +27 -13
- package/lib/index.js +16 -7
- package/lib/json/checker/data/advancement.js +24 -13
- package/lib/json/checker/data/biome.js +3 -3
- package/lib/json/checker/data/common.js +15 -27
- package/lib/json/checker/data/dimension.js +7 -18
- package/lib/json/checker/data/feature.js +41 -27
- package/lib/json/checker/data/index.d.ts +1 -1
- package/lib/json/checker/data/index.js +3 -3
- package/lib/json/checker/data/loot_table.js +16 -17
- package/lib/json/checker/data/recipe.js +1 -1
- package/lib/json/checker/data/structure.js +20 -12
- package/lib/json/checker/data/tag.js +2 -2
- package/lib/json/checker/data/text_component.js +21 -12
- package/lib/json/checker/index.d.ts +10 -3
- package/lib/json/checker/index.js +230 -3
- package/lib/json/checker/util/advancement.js +3 -3
- package/lib/json/checker/util/block_states.d.ts +2 -2
- package/lib/json/checker/util/block_states.js +7 -5
- package/lib/json/checker/util/color.js +8 -2
- package/lib/json/checker/util/nbt.js +3 -2
- package/lib/json/checker/util/recipe.js +7 -6
- package/lib/json/checker/util/version.js +2 -2
- package/lib/mcfunction/checker/index.js +10 -7
- package/lib/mcfunction/colorizer/index.js +2 -4
- package/lib/mcfunction/common/index.js +46 -15
- package/lib/mcfunction/completer/argument.js +53 -24
- package/lib/mcfunction/inlayHintProvider.js +8 -3
- package/lib/mcfunction/node/argument.d.ts +3 -3
- package/lib/mcfunction/node/argument.js +57 -17
- package/lib/mcfunction/parser/argument.js +124 -52
- package/lib/mcfunction/signatureHelpProvider.js +6 -3
- package/lib/mcfunction/tree/patch.js +132 -126
- package/package.json +7 -7
|
@@ -5,8 +5,8 @@ import { localeQuote, localize } from '@spyglassmc/locales';
|
|
|
5
5
|
import * as mcf from '@spyglassmc/mcfunction';
|
|
6
6
|
import * as nbt from '@spyglassmc/nbt';
|
|
7
7
|
import { ReleaseVersion } from '../../dependency/index.js';
|
|
8
|
-
import { ColorArgumentValues, EntityAnchorArgumentValues, ItemSlotArgumentValues, OperationArgumentValues, ScoreboardSlotArgumentValues, SwizzleArgumentValues } from '../common/index.js';
|
|
9
|
-
import { BlockStatesNode, EntitySelectorArgumentsNode, EntitySelectorAtVariable, EntitySelectorAtVariables, EntitySelectorNode, ObjectiveCriteriaNode, TimeNode } from '../node/index.js';
|
|
8
|
+
import { ColorArgumentValues, EntityAnchorArgumentValues, ItemSlotArgumentValues, OperationArgumentValues, ScoreboardSlotArgumentValues, SwizzleArgumentValues, } from '../common/index.js';
|
|
9
|
+
import { BlockStatesNode, EntitySelectorArgumentsNode, EntitySelectorAtVariable, EntitySelectorAtVariables, EntitySelectorNode, ObjectiveCriteriaNode, TimeNode, } from '../node/index.js';
|
|
10
10
|
const IntegerPattern = /^-?\d+$/;
|
|
11
11
|
/**
|
|
12
12
|
* A combination of:
|
|
@@ -24,7 +24,7 @@ const IntegerPattern = /^-?\d+$/;
|
|
|
24
24
|
const FloatPattern = /^-?(?:\d+\.?\d*|\.\d+)$/;
|
|
25
25
|
const DoubleMax = Number.MAX_VALUE;
|
|
26
26
|
const DoubleMin = -DoubleMax;
|
|
27
|
-
const FloatMax = (2 -
|
|
27
|
+
const FloatMax = (2 - 2 ** -23) * 2 ** 127;
|
|
28
28
|
const FloatMin = -FloatMax;
|
|
29
29
|
const IntegerMax = 2 ** 31 - 1;
|
|
30
30
|
const IntegerMin = -(2 ** 31);
|
|
@@ -66,7 +66,7 @@ export const argument = (rawTreeNode) => {
|
|
|
66
66
|
return wrap(greedyString);
|
|
67
67
|
}
|
|
68
68
|
case 'minecraft:angle':
|
|
69
|
-
return wrap(core.validate(coordinate(), res => res.notation !== '^', localize('mcfunction.parser.vector.local-disallowed')));
|
|
69
|
+
return wrap(core.validate(coordinate(), (res) => res.notation !== '^', localize('mcfunction.parser.vector.local-disallowed')));
|
|
70
70
|
case 'minecraft:block_pos':
|
|
71
71
|
return wrap(vector({ dimension: 3, integersOnly: true }));
|
|
72
72
|
case 'minecraft:block_predicate':
|
|
@@ -74,7 +74,7 @@ export const argument = (rawTreeNode) => {
|
|
|
74
74
|
case 'minecraft:block_state':
|
|
75
75
|
return wrap(blockState);
|
|
76
76
|
case 'minecraft:color':
|
|
77
|
-
return wrap(core.map(core.literal(...ColorArgumentValues), res => ({
|
|
77
|
+
return wrap(core.map(core.literal(...ColorArgumentValues), (res) => ({
|
|
78
78
|
...res,
|
|
79
79
|
color: core.Color.NamedColors.has(res.value)
|
|
80
80
|
? core.Color.fromCompositeInt(core.Color.NamedColors.get(res.value))
|
|
@@ -198,12 +198,12 @@ function block(isPredicate) {
|
|
|
198
198
|
trailingEnd: true,
|
|
199
199
|
},
|
|
200
200
|
end: ']',
|
|
201
|
-
})), res => ({
|
|
201
|
+
})), (res) => ({
|
|
202
202
|
...res,
|
|
203
203
|
type: 'mcfunction:block/states',
|
|
204
204
|
}))),
|
|
205
205
|
core.optional(core.failOnEmpty(nbt.parser.compound)),
|
|
206
|
-
]), res => {
|
|
206
|
+
]), (res) => {
|
|
207
207
|
const ans = {
|
|
208
208
|
type: 'mcfunction:block',
|
|
209
209
|
range: res.range,
|
|
@@ -271,7 +271,7 @@ function coordinate(integerOnly = false) {
|
|
|
271
271
|
function entity(amount, type) {
|
|
272
272
|
return core.map(core.select([
|
|
273
273
|
{
|
|
274
|
-
predicate: src => EntitySelectorAtVariable.is(src.peek(2)),
|
|
274
|
+
predicate: (src) => EntitySelectorAtVariable.is(src.peek(2)),
|
|
275
275
|
parser: selector(),
|
|
276
276
|
},
|
|
277
277
|
{
|
|
@@ -298,7 +298,11 @@ function entity(amount, type) {
|
|
|
298
298
|
if (amount === 'single' && ans.selector && !ans.selector.single) {
|
|
299
299
|
ctx.err.report(localize('mcfunction.parser.entity-selector.multiple-disallowed'), ans);
|
|
300
300
|
}
|
|
301
|
-
if (type === 'players' &&
|
|
301
|
+
if (type === 'players' &&
|
|
302
|
+
(ans.uuid ||
|
|
303
|
+
(ans.selector &&
|
|
304
|
+
!ans.selector.playersOnly &&
|
|
305
|
+
!ans.selector.currentEntity))) {
|
|
302
306
|
ctx.err.report(localize('mcfunction.parser.entity-selector.entities-disallowed'), ans);
|
|
303
307
|
}
|
|
304
308
|
return ans;
|
|
@@ -311,7 +315,7 @@ function item(isPredicate) {
|
|
|
311
315
|
return core.map(core.sequence([
|
|
312
316
|
core.resourceLocation({ category: 'item', allowTag: isPredicate }),
|
|
313
317
|
core.optional(core.failOnEmpty(nbt.parser.compound)),
|
|
314
|
-
]), res => {
|
|
318
|
+
]), (res) => {
|
|
315
319
|
const ans = {
|
|
316
320
|
type: 'mcfunction:item',
|
|
317
321
|
range: res.range,
|
|
@@ -343,7 +347,7 @@ const message = (src, ctx) => {
|
|
|
343
347
|
export const particle = (() => {
|
|
344
348
|
const sep = core.map(mcf.sep, () => []);
|
|
345
349
|
const vec = vector({ dimension: 3 });
|
|
346
|
-
const color = core.map(vec, res => ({
|
|
350
|
+
const color = core.map(vec, (res) => ({
|
|
347
351
|
...res,
|
|
348
352
|
color: res.children.length === 3
|
|
349
353
|
? {
|
|
@@ -366,11 +370,11 @@ export const particle = (() => {
|
|
|
366
370
|
return core.map(sequence([
|
|
367
371
|
core.resourceLocation({ category: 'particle_type' }),
|
|
368
372
|
{
|
|
369
|
-
get: res => {
|
|
373
|
+
get: (res) => {
|
|
370
374
|
return map[core.ResourceLocationNode.toString(res.children[0], 'short')];
|
|
371
375
|
},
|
|
372
376
|
},
|
|
373
|
-
], sep), res => {
|
|
377
|
+
], sep), (res) => {
|
|
374
378
|
const ans = {
|
|
375
379
|
type: 'mcfunction:particle',
|
|
376
380
|
range: res.range,
|
|
@@ -407,7 +411,10 @@ function range(type, min, max, cycleable) {
|
|
|
407
411
|
: [undefined, valueNodes[0].value]
|
|
408
412
|
: [valueNodes[0].value, valueNodes[0].value],
|
|
409
413
|
};
|
|
410
|
-
if (!cycleable &&
|
|
414
|
+
if (!cycleable &&
|
|
415
|
+
ans.value[0] !== undefined &&
|
|
416
|
+
ans.value[1] !== undefined &&
|
|
417
|
+
ans.value[0] > ans.value[1]) {
|
|
411
418
|
ctx.err.report(localize('mcfunction.parser.range.min>max', ans.value[0], ans.value[1]), res);
|
|
412
419
|
}
|
|
413
420
|
return ans;
|
|
@@ -425,27 +432,39 @@ function selector() {
|
|
|
425
432
|
let single;
|
|
426
433
|
let typeLimited;
|
|
427
434
|
return core.map(core.sequence([
|
|
428
|
-
core.failOnEmpty(core.literal({
|
|
435
|
+
core.failOnEmpty(core.literal({
|
|
436
|
+
pool: EntitySelectorAtVariables,
|
|
437
|
+
colorTokenType: 'keyword',
|
|
438
|
+
})),
|
|
429
439
|
{
|
|
430
|
-
get: res => {
|
|
431
|
-
const variable = core.LiteralNode.is(res.children?.[0])
|
|
440
|
+
get: (res) => {
|
|
441
|
+
const variable = core.LiteralNode.is(res.children?.[0])
|
|
442
|
+
? res.children[0].value
|
|
443
|
+
: undefined;
|
|
432
444
|
currentEntity = variable ? variable === '@s' : undefined;
|
|
433
|
-
playersOnly = variable
|
|
445
|
+
playersOnly = variable
|
|
446
|
+
? variable === '@p' || variable === '@a' || variable === '@r'
|
|
447
|
+
: undefined;
|
|
434
448
|
predicates = variable === '@e' ? ['Entity::isAlive'] : undefined;
|
|
435
|
-
single = variable
|
|
449
|
+
single = variable
|
|
450
|
+
? variable === '@p' || variable === '@r' || variable === '@s'
|
|
451
|
+
: undefined;
|
|
436
452
|
typeLimited = playersOnly;
|
|
437
453
|
function invertable(parser) {
|
|
438
454
|
return core.map(core.sequence([
|
|
439
455
|
core.optional(core.failOnEmpty(core.literal({ pool: ['!'], colorTokenType: 'keyword' }))),
|
|
440
|
-
src => {
|
|
456
|
+
(src) => {
|
|
457
|
+
src.skipSpace();
|
|
458
|
+
return undefined;
|
|
459
|
+
},
|
|
441
460
|
parser,
|
|
442
|
-
]), res => {
|
|
461
|
+
]), (res) => {
|
|
443
462
|
const ans = {
|
|
444
463
|
type: 'mcfunction:entity_selector/arguments/value/invertable',
|
|
445
464
|
range: res.range,
|
|
446
465
|
children: res.children,
|
|
447
|
-
inverted: !!res.children.find(n => core.LiteralNode.is(n) && n.value === '!'),
|
|
448
|
-
value: res.children.find(n => !core.LiteralNode.is(n) || n.value !== '!'),
|
|
466
|
+
inverted: !!res.children.find((n) => core.LiteralNode.is(n) && n.value === '!'),
|
|
467
|
+
value: res.children.find((n) => !core.LiteralNode.is(n) || n.value !== '!'),
|
|
449
468
|
};
|
|
450
469
|
return ans;
|
|
451
470
|
});
|
|
@@ -456,25 +475,31 @@ function selector() {
|
|
|
456
475
|
key: core.string({
|
|
457
476
|
...core.BrigadierStringOptions,
|
|
458
477
|
value: {
|
|
459
|
-
parser: core.literal({
|
|
478
|
+
parser: core.literal({
|
|
479
|
+
pool: [...EntitySelectorNode.ArgumentKeys],
|
|
480
|
+
colorTokenType: 'property',
|
|
481
|
+
}),
|
|
460
482
|
type: 'literal',
|
|
461
483
|
},
|
|
462
484
|
}),
|
|
463
485
|
sep: '=',
|
|
464
486
|
value: {
|
|
465
487
|
get: (record, key) => {
|
|
466
|
-
const hasKey = (key) => !!record.children.find(p => p.key?.value === key);
|
|
467
|
-
const hasNonInvertedKey = (key) => !!record.children.find(p => p.key?.value === key &&
|
|
488
|
+
const hasKey = (key) => !!record.children.find((p) => p.key?.value === key);
|
|
489
|
+
const hasNonInvertedKey = (key) => !!record.children.find((p) => p.key?.value === key &&
|
|
490
|
+
!p.value?.inverted);
|
|
468
491
|
switch (key?.value) {
|
|
469
492
|
case 'advancements':
|
|
470
493
|
return core.map(core.record({
|
|
471
494
|
start: '{',
|
|
472
495
|
pair: {
|
|
473
|
-
key: core.resourceLocation({
|
|
496
|
+
key: core.resourceLocation({
|
|
497
|
+
category: 'advancement',
|
|
498
|
+
}),
|
|
474
499
|
sep: '=',
|
|
475
500
|
value: core.select([
|
|
476
501
|
{
|
|
477
|
-
predicate: src => src.peek() === '{',
|
|
502
|
+
predicate: (src) => src.peek() === '{',
|
|
478
503
|
parser: core.map(core.record({
|
|
479
504
|
start: '{',
|
|
480
505
|
pair: {
|
|
@@ -485,7 +510,7 @@ function selector() {
|
|
|
485
510
|
trailingEnd: true,
|
|
486
511
|
},
|
|
487
512
|
end: '}',
|
|
488
|
-
}), res => {
|
|
513
|
+
}), (res) => {
|
|
489
514
|
const ans = {
|
|
490
515
|
...res,
|
|
491
516
|
type: 'mcfunction:entity_selector/arguments/advancements/criteria',
|
|
@@ -515,7 +540,8 @@ function selector() {
|
|
|
515
540
|
return core.map(range('float', 0), (res, _, ctx) => {
|
|
516
541
|
dimensionLimited = true;
|
|
517
542
|
// x, y, z, dx, dy, dz take precedence over distance, so we use ??= instead of = to ensure it won't override the result.
|
|
518
|
-
chunkLimited ??=
|
|
543
|
+
chunkLimited ??=
|
|
544
|
+
!playersOnly && res.value[1] !== undefined;
|
|
519
545
|
if (hasKey(key.value)) {
|
|
520
546
|
ctx.err.report(localize('duplicate-key', localeQuote(key.value)), key);
|
|
521
547
|
}
|
|
@@ -530,7 +556,9 @@ function selector() {
|
|
|
530
556
|
},
|
|
531
557
|
})), (res, _, ctx) => {
|
|
532
558
|
playersOnly = true;
|
|
533
|
-
if (res.inverted
|
|
559
|
+
if (res.inverted
|
|
560
|
+
? hasNonInvertedKey(key.value)
|
|
561
|
+
: hasKey(key.value)) {
|
|
534
562
|
ctx.err.report(localize('duplicate-key', localeQuote(key.value)), key);
|
|
535
563
|
}
|
|
536
564
|
return res;
|
|
@@ -556,7 +584,9 @@ function selector() {
|
|
|
556
584
|
});
|
|
557
585
|
case 'name':
|
|
558
586
|
return core.map(invertable(core.brigadierString), (res, _, ctx) => {
|
|
559
|
-
if (res.inverted
|
|
587
|
+
if (res.inverted
|
|
588
|
+
? hasNonInvertedKey(key.value)
|
|
589
|
+
: hasKey(key.value)) {
|
|
560
590
|
ctx.err.report(localize('duplicate-key', localeQuote(key.value)), key);
|
|
561
591
|
}
|
|
562
592
|
return res;
|
|
@@ -569,7 +599,14 @@ function selector() {
|
|
|
569
599
|
return core.map(core.record({
|
|
570
600
|
start: '{',
|
|
571
601
|
pair: {
|
|
572
|
-
key: objective('reference', [
|
|
602
|
+
key: objective('reference', [
|
|
603
|
+
'[',
|
|
604
|
+
'=',
|
|
605
|
+
',',
|
|
606
|
+
']',
|
|
607
|
+
'{',
|
|
608
|
+
'}',
|
|
609
|
+
]),
|
|
573
610
|
sep: '=',
|
|
574
611
|
value: range('integer'),
|
|
575
612
|
end: ',',
|
|
@@ -605,14 +642,26 @@ function selector() {
|
|
|
605
642
|
case 'tag':
|
|
606
643
|
return invertable(tag(['[', '=', ',', ']', '{', '}']));
|
|
607
644
|
case 'team':
|
|
608
|
-
return core.map(invertable(team('reference', [
|
|
609
|
-
|
|
645
|
+
return core.map(invertable(team('reference', [
|
|
646
|
+
'[',
|
|
647
|
+
'=',
|
|
648
|
+
',',
|
|
649
|
+
']',
|
|
650
|
+
'{',
|
|
651
|
+
'}',
|
|
652
|
+
])), (res, _, ctx) => {
|
|
653
|
+
if (res.inverted
|
|
654
|
+
? hasNonInvertedKey(key.value)
|
|
655
|
+
: hasKey(key.value)) {
|
|
610
656
|
ctx.err.report(localize('duplicate-key', localeQuote(key.value)), key);
|
|
611
657
|
}
|
|
612
658
|
return res;
|
|
613
659
|
});
|
|
614
660
|
case 'type':
|
|
615
|
-
return core.map(invertable(core.resourceLocation({
|
|
661
|
+
return core.map(invertable(core.resourceLocation({
|
|
662
|
+
category: 'entity_type',
|
|
663
|
+
allowTag: true,
|
|
664
|
+
})), (res, _, ctx) => {
|
|
616
665
|
if (typeLimited) {
|
|
617
666
|
if (hasKey(key.value)) {
|
|
618
667
|
ctx.err.report(localize('duplicate-key', localeQuote(key.value)), key);
|
|
@@ -674,7 +723,7 @@ function selector() {
|
|
|
674
723
|
trailingEnd: true,
|
|
675
724
|
},
|
|
676
725
|
end: ']',
|
|
677
|
-
})), res => {
|
|
726
|
+
})), (res) => {
|
|
678
727
|
const ans = {
|
|
679
728
|
...res,
|
|
680
729
|
type: 'mcfunction:entity_selector/arguments',
|
|
@@ -683,12 +732,14 @@ function selector() {
|
|
|
683
732
|
}));
|
|
684
733
|
},
|
|
685
734
|
},
|
|
686
|
-
]), res => {
|
|
735
|
+
]), (res) => {
|
|
687
736
|
const ans = {
|
|
688
737
|
type: 'mcfunction:entity_selector',
|
|
689
738
|
range: res.range,
|
|
690
739
|
children: res.children,
|
|
691
|
-
variable: res.children
|
|
740
|
+
variable: res.children
|
|
741
|
+
.find(core.LiteralNode.is)
|
|
742
|
+
.value.slice(1),
|
|
692
743
|
arguments: res.children.find(EntitySelectorArgumentsNode.is),
|
|
693
744
|
chunkLimited,
|
|
694
745
|
currentEntity,
|
|
@@ -718,7 +769,12 @@ function getEntitySelectorHover(node) {
|
|
|
718
769
|
- \`currentEntity\`: \`${node.currentEntity}\``;
|
|
719
770
|
}
|
|
720
771
|
else {
|
|
721
|
-
const amountOfTrue = [
|
|
772
|
+
const amountOfTrue = [
|
|
773
|
+
node.chunkLimited,
|
|
774
|
+
node.dimensionLimited,
|
|
775
|
+
node.playersOnly,
|
|
776
|
+
node.typeLimited,
|
|
777
|
+
].filter((v) => v).length;
|
|
722
778
|
ans = `**Performance**: ${grades.get(amountOfTrue)}
|
|
723
779
|
- \`chunkLimited\`: \`${!!node.chunkLimited}\`
|
|
724
780
|
- \`dimensionLimited\`: \`${!!node.dimensionLimited}\`
|
|
@@ -730,7 +786,7 @@ function getEntitySelectorHover(node) {
|
|
|
730
786
|
|
|
731
787
|
------
|
|
732
788
|
**Predicates**:
|
|
733
|
-
${node.predicates.map(p => `- \`${p}\``).join('\n')}`;
|
|
789
|
+
${node.predicates.map((p) => `- \`${p}\``).join('\n')}`;
|
|
734
790
|
}
|
|
735
791
|
return ans;
|
|
736
792
|
}
|
|
@@ -738,7 +794,7 @@ export const scoreHolderFakeName = validateLength(symbol('score_holder'), FakeNa
|
|
|
738
794
|
function scoreHolder(amount) {
|
|
739
795
|
return core.map(core.select([
|
|
740
796
|
{
|
|
741
|
-
predicate: src => EntitySelectorAtVariable.is(src.peek(2)),
|
|
797
|
+
predicate: (src) => EntitySelectorAtVariable.is(src.peek(2)),
|
|
742
798
|
parser: selector(),
|
|
743
799
|
},
|
|
744
800
|
{
|
|
@@ -770,22 +826,32 @@ function objective(usageType, terminators = []) {
|
|
|
770
826
|
}
|
|
771
827
|
const objectiveCriteria = core.map(core.any([
|
|
772
828
|
core.sequence([
|
|
773
|
-
core.stopBefore(core.resourceLocation({
|
|
829
|
+
core.stopBefore(core.resourceLocation({
|
|
830
|
+
category: 'stat_type',
|
|
831
|
+
namespacePathSep: '.',
|
|
832
|
+
}), ':'),
|
|
774
833
|
core.failOnEmpty(core.literal(':')),
|
|
775
834
|
{
|
|
776
|
-
get: res => {
|
|
835
|
+
get: (res) => {
|
|
777
836
|
if (core.ResourceLocationNode.is(res.children[0])) {
|
|
778
837
|
const category = ObjectiveCriteriaNode.ComplexCategories.get(core.ResourceLocationNode.toString(res.children[0], 'short'));
|
|
779
838
|
if (category) {
|
|
780
|
-
return core.resourceLocation({
|
|
839
|
+
return core.resourceLocation({
|
|
840
|
+
category,
|
|
841
|
+
namespacePathSep: '.',
|
|
842
|
+
});
|
|
781
843
|
}
|
|
782
844
|
}
|
|
783
|
-
return core.resourceLocation({
|
|
845
|
+
return core.resourceLocation({
|
|
846
|
+
pool: [],
|
|
847
|
+
allowUnknown: true,
|
|
848
|
+
namespacePathSep: '.',
|
|
849
|
+
});
|
|
784
850
|
},
|
|
785
851
|
},
|
|
786
852
|
]),
|
|
787
853
|
core.literal(...ObjectiveCriteriaNode.SimpleValues),
|
|
788
|
-
]), res => {
|
|
854
|
+
]), (res) => {
|
|
789
855
|
const ans = {
|
|
790
856
|
type: 'mcfunction:objective_criteria',
|
|
791
857
|
range: res.range,
|
|
@@ -807,7 +873,10 @@ export function team(usageType, terminators = []) {
|
|
|
807
873
|
function unquotableSymbol(options, terminators) {
|
|
808
874
|
return validateUnquotable(symbol(options, terminators));
|
|
809
875
|
}
|
|
810
|
-
const time = core.map(core.sequence([
|
|
876
|
+
const time = core.map(core.sequence([
|
|
877
|
+
float(0, undefined),
|
|
878
|
+
core.optional(core.failOnEmpty(core.literal(...TimeNode.Units))),
|
|
879
|
+
]), (res) => {
|
|
811
880
|
const valueNode = res.children.find(core.FloatNode.is);
|
|
812
881
|
const unitNode = res.children.find(core.LiteralNode.is);
|
|
813
882
|
const ans = {
|
|
@@ -840,8 +909,8 @@ const uuid = (src, ctx) => {
|
|
|
840
909
|
let isLegal = false;
|
|
841
910
|
if (raw.match(UuidPattern)) {
|
|
842
911
|
try {
|
|
843
|
-
const parts = raw.split('-').map(p => BigInt(`0x${p}`));
|
|
844
|
-
if (parts.every(p => p <= LongMax)) {
|
|
912
|
+
const parts = raw.split('-').map((p) => BigInt(`0x${p}`));
|
|
913
|
+
if (parts.every((p) => p <= LongMax)) {
|
|
845
914
|
isLegal = true;
|
|
846
915
|
ans.bits[0] = BigInt.asIntN(64, (parts[0] << 32n) | (parts[1] << 16n) | parts[2]);
|
|
847
916
|
ans.bits[1] = BigInt.asIntN(64, (parts[3] << 48n) | parts[4]);
|
|
@@ -894,9 +963,12 @@ function vector(options) {
|
|
|
894
963
|
if (i > 0) {
|
|
895
964
|
mcf.sep(src, ctx);
|
|
896
965
|
}
|
|
897
|
-
const coord = options.integersOnly
|
|
966
|
+
const coord = options.integersOnly
|
|
967
|
+
? coordinate(options.integersOnly)(src, ctx)
|
|
968
|
+
: coordinate(options.integersOnly)(src, ctx);
|
|
898
969
|
ans.children.push(coord);
|
|
899
|
-
if ((ans.system === 1 /* CoordinateSystem.Local */) !==
|
|
970
|
+
if ((ans.system === 1 /* CoordinateSystem.Local */) !==
|
|
971
|
+
(coord.notation === '^')) {
|
|
900
972
|
ctx.err.report(localize('mcfunction.parser.vector.mixed'), coord);
|
|
901
973
|
}
|
|
902
974
|
}
|
|
@@ -35,7 +35,7 @@ export function signatureHelpProvider(commandTreeName) {
|
|
|
35
35
|
activeSignature: 0,
|
|
36
36
|
signatures: [],
|
|
37
37
|
};
|
|
38
|
-
ans.signatures = options.map(v => {
|
|
38
|
+
ans.signatures = options.map((v) => {
|
|
39
39
|
const part1 = v[selectedIndex];
|
|
40
40
|
const part2 = selectedIndex + 1 < v.length ? ` ${v[selectedIndex + 1]}` : '';
|
|
41
41
|
const label = `${part1}${part2}`;
|
|
@@ -63,7 +63,8 @@ function getOptions(rootTreeNode, argumentNodes) {
|
|
|
63
63
|
if (!name) {
|
|
64
64
|
break;
|
|
65
65
|
}
|
|
66
|
-
treeNode = mcf.resolveParentTreeNode(treeNode, rootTreeNode).treeNode
|
|
66
|
+
treeNode = mcf.resolveParentTreeNode(treeNode, rootTreeNode).treeNode
|
|
67
|
+
?.children?.[name];
|
|
67
68
|
if (!treeNode) {
|
|
68
69
|
break;
|
|
69
70
|
}
|
|
@@ -72,7 +73,9 @@ function getOptions(rootTreeNode, argumentNodes) {
|
|
|
72
73
|
if (treeNode) {
|
|
73
74
|
treeNode = mcf.resolveParentTreeNode(treeNode, rootTreeNode).treeNode;
|
|
74
75
|
if (treeNode?.children) {
|
|
75
|
-
return mcf
|
|
76
|
+
return mcf
|
|
77
|
+
.treeNodeChildrenToStringArray(treeNode.children, treeNode.executable)
|
|
78
|
+
.map((v) => [...current, v]);
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
81
|
return current.length ? [current] : [];
|