@duet3d/monacotokens 3.7.0-alpha.12 → 3.7.0-alpha.13
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/gcodes/gcodes.json +48 -12
- package/dist/gcodes/index.d.ts +5 -2
- package/dist/providers.js +54 -11
- package/package.json +1 -1
package/dist/gcodes/gcodes.json
CHANGED
|
@@ -5394,51 +5394,87 @@
|
|
|
5394
5394
|
"description": "Kinematics type (name)",
|
|
5395
5395
|
"values": [
|
|
5396
5396
|
{
|
|
5397
|
-
"value":
|
|
5397
|
+
"value": [
|
|
5398
|
+
"cartesian",
|
|
5399
|
+
"0"
|
|
5400
|
+
],
|
|
5398
5401
|
"description": "Cartesian"
|
|
5399
5402
|
},
|
|
5400
5403
|
{
|
|
5401
|
-
"value":
|
|
5404
|
+
"value": [
|
|
5405
|
+
"coreXY",
|
|
5406
|
+
"1"
|
|
5407
|
+
],
|
|
5402
5408
|
"description": "CoreXY"
|
|
5403
5409
|
},
|
|
5404
5410
|
{
|
|
5405
|
-
"value":
|
|
5411
|
+
"value": [
|
|
5412
|
+
"coreXZ",
|
|
5413
|
+
"2"
|
|
5414
|
+
],
|
|
5406
5415
|
"description": "CoreXZ"
|
|
5407
5416
|
},
|
|
5408
5417
|
{
|
|
5409
|
-
"value":
|
|
5418
|
+
"value": [
|
|
5419
|
+
"linearDelta",
|
|
5420
|
+
"3"
|
|
5421
|
+
],
|
|
5410
5422
|
"description": "Linear delta"
|
|
5411
5423
|
},
|
|
5412
5424
|
{
|
|
5413
|
-
"value":
|
|
5425
|
+
"value": [
|
|
5426
|
+
"scara",
|
|
5427
|
+
"4"
|
|
5428
|
+
],
|
|
5414
5429
|
"description": "Serial SCARA"
|
|
5415
5430
|
},
|
|
5416
5431
|
{
|
|
5417
|
-
"value":
|
|
5432
|
+
"value": [
|
|
5433
|
+
"coreXYU",
|
|
5434
|
+
"5"
|
|
5435
|
+
],
|
|
5418
5436
|
"description": "CoreXYU"
|
|
5419
5437
|
},
|
|
5420
5438
|
{
|
|
5421
|
-
"value":
|
|
5439
|
+
"value": [
|
|
5440
|
+
"hangprinter",
|
|
5441
|
+
"6"
|
|
5442
|
+
],
|
|
5422
5443
|
"description": "Hangprinter"
|
|
5423
5444
|
},
|
|
5424
5445
|
{
|
|
5425
|
-
"value":
|
|
5446
|
+
"value": [
|
|
5447
|
+
"polar",
|
|
5448
|
+
"7"
|
|
5449
|
+
],
|
|
5426
5450
|
"description": "Polar"
|
|
5427
5451
|
},
|
|
5428
5452
|
{
|
|
5429
|
-
"value":
|
|
5453
|
+
"value": [
|
|
5454
|
+
"coreXYUV",
|
|
5455
|
+
"8"
|
|
5456
|
+
],
|
|
5430
5457
|
"description": "CoreXYUV"
|
|
5431
5458
|
},
|
|
5432
5459
|
{
|
|
5433
|
-
"value":
|
|
5460
|
+
"value": [
|
|
5461
|
+
"fiveBarScara",
|
|
5462
|
+
"9"
|
|
5463
|
+
],
|
|
5434
5464
|
"description": "Five-bar parallel SCARA"
|
|
5435
5465
|
},
|
|
5436
5466
|
{
|
|
5437
|
-
"value":
|
|
5467
|
+
"value": [
|
|
5468
|
+
"rotaryDelta",
|
|
5469
|
+
"10"
|
|
5470
|
+
],
|
|
5438
5471
|
"description": "Rotary delta"
|
|
5439
5472
|
},
|
|
5440
5473
|
{
|
|
5441
|
-
"value":
|
|
5474
|
+
"value": [
|
|
5475
|
+
"markForged",
|
|
5476
|
+
"11"
|
|
5477
|
+
],
|
|
5442
5478
|
"description": "Markforged"
|
|
5443
5479
|
}
|
|
5444
5480
|
]
|
package/dist/gcodes/index.d.ts
CHANGED
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
* One enumerated value of a parameter (e.g. "1" for G1 H meaning "Stop on endstop")
|
|
3
3
|
*/
|
|
4
4
|
export interface GcodeParameterValue {
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Literal value as it appears in source (e.g. "0", "1", "-1"). An array lists equivalent literals that mean
|
|
7
|
+
* the same thing, e.g. M669 K accepts both the kinematics name and its legacy number ("coreXY" and "1").
|
|
8
|
+
*/
|
|
9
|
+
value: string | string[];
|
|
7
10
|
/** Human-readable meaning */
|
|
8
11
|
description: string;
|
|
9
12
|
}
|
package/dist/providers.js
CHANGED
|
@@ -80,6 +80,54 @@ function lookupParameter(info, letter) {
|
|
|
80
80
|
const found = info.parameters.find(p => p.letter === letter);
|
|
81
81
|
return found ?? makeAxisParameter(info, letter);
|
|
82
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Collect the canonical parameter letters present at the top level of a code's argument segment, in order. Letters
|
|
85
|
+
* inside "..." strings or {...} expressions are skipped because they belong to a value, not to a parameter - e.g.
|
|
86
|
+
* the `g` in `M98 P"check-filament.g"` and any argument passed on to a macro must not be mistaken for parameters.
|
|
87
|
+
* A leading apostrophe is honoured so a lower-case axis (`'a`) stays distinct from the upper-case letter.
|
|
88
|
+
*/
|
|
89
|
+
function scanParameterLetters(segment) {
|
|
90
|
+
const letters = [];
|
|
91
|
+
let inString = false;
|
|
92
|
+
let braceDepth = 0;
|
|
93
|
+
for (let i = 0; i < segment.length; i++) {
|
|
94
|
+
const ch = segment[i];
|
|
95
|
+
if (inString) {
|
|
96
|
+
if (ch === "\"") {
|
|
97
|
+
inString = false;
|
|
98
|
+
}
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (ch === "\"") {
|
|
102
|
+
inString = true;
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (ch === "{") {
|
|
106
|
+
braceDepth++;
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (ch === "}") {
|
|
110
|
+
if (braceDepth > 0) {
|
|
111
|
+
braceDepth--;
|
|
112
|
+
}
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if (braceDepth > 0) {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (ch === ";") {
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
if (/[A-Za-z]/.test(ch)) {
|
|
122
|
+
const prev = i > 0 ? segment[i - 1] : "";
|
|
123
|
+
const next = i + 1 < segment.length ? segment[i + 1] : "";
|
|
124
|
+
if (!/[A-Za-z]/.test(prev) && !/[A-Za-z]/.test(next)) {
|
|
125
|
+
letters.push(canonicalAxisLetter(prev === "'" ? prev + ch : ch));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return letters;
|
|
130
|
+
}
|
|
83
131
|
/**
|
|
84
132
|
* Find the enclosing function call (if any) for the cursor position. Walks back from the end of `beforeCursor`
|
|
85
133
|
* keeping track of paren depth so that `max(a, min(b,|` correctly reports `min` with argIndex 1, not `max`.
|
|
@@ -676,7 +724,8 @@ function buildParameterDoc(info, p) {
|
|
|
676
724
|
if (p.values && p.values.length > 0) {
|
|
677
725
|
md += "\n\n**Values:**";
|
|
678
726
|
for (const v of p.values) {
|
|
679
|
-
|
|
727
|
+
const literals = (Array.isArray(v.value) ? v.value : [v.value]).map((x) => `\`${x}\``).join(" / ");
|
|
728
|
+
md += `\n- ${literals} - ${v.description}`;
|
|
680
729
|
}
|
|
681
730
|
}
|
|
682
731
|
const deprecationNote = p.deprecated ?? info.deprecated;
|
|
@@ -936,12 +985,7 @@ export function registerProvidersFor(monacoInstance, languageId) {
|
|
|
936
985
|
// just typed it, Monaco should show nothing (so the widget auto-closes) rather than list
|
|
937
986
|
// the very letter that was just typed as the only match
|
|
938
987
|
const fullTail = lineContent.substring(code.startColumn - 1 + code.code.length);
|
|
939
|
-
const used = new Set();
|
|
940
|
-
const re = /(?<![A-Za-z])'?[A-Za-z](?![A-Za-z])/g;
|
|
941
|
-
let m;
|
|
942
|
-
while ((m = re.exec(fullTail)) !== null) {
|
|
943
|
-
used.add(canonicalAxisLetter(m[0]));
|
|
944
|
-
}
|
|
988
|
+
const used = new Set(scanParameterLetters(fullTail));
|
|
945
989
|
const triggerHints = { id: "editor.action.triggerParameterHints", title: "Trigger Parameter Hints" };
|
|
946
990
|
const suggestions = info.parameters
|
|
947
991
|
.filter(p => !used.has(p.letter))
|
|
@@ -1087,11 +1131,10 @@ export function registerProvidersFor(monacoInstance, languageId) {
|
|
|
1087
1131
|
// for codes with a unprecedentedParameter, sit on slot 0 while the user is typing that value (no parameter letter typed yet)
|
|
1088
1132
|
const tail = tailForDismissal;
|
|
1089
1133
|
let activeParameter = -1;
|
|
1090
|
-
const seen = tail
|
|
1134
|
+
const seen = scanParameterLetters(tail);
|
|
1091
1135
|
const unprecedentedOffset = info.unprecedentedParameter ? 1 : 0;
|
|
1092
|
-
if (seen
|
|
1093
|
-
const
|
|
1094
|
-
const last = canonicalAxisLetter(rawLast);
|
|
1136
|
+
if (seen.length > 0) {
|
|
1137
|
+
const last = seen[seen.length - 1];
|
|
1095
1138
|
const idx = info.parameters.findIndex(p => p.letter === last);
|
|
1096
1139
|
if (idx >= 0) {
|
|
1097
1140
|
activeParameter = idx + unprecedentedOffset;
|
package/package.json
CHANGED