@duet3d/monacotokens 3.7.0-rc.2 → 3.7.0-rc.4
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 +12 -12
- package/dist/providers.js +28 -27
- package/package.json +1 -1
package/dist/gcodes/gcodes.json
CHANGED
|
@@ -1700,7 +1700,7 @@
|
|
|
1700
1700
|
},
|
|
1701
1701
|
{
|
|
1702
1702
|
"letter": "T",
|
|
1703
|
-
"description": "Acceleration
|
|
1703
|
+
"description": "Acceleration time for third-order motion control (s)"
|
|
1704
1704
|
}
|
|
1705
1705
|
],
|
|
1706
1706
|
"axisParameter": {
|
|
@@ -2568,10 +2568,18 @@
|
|
|
2568
2568
|
},
|
|
2569
2569
|
{
|
|
2570
2570
|
"value": "mcu-temp",
|
|
2571
|
-
"description": "
|
|
2571
|
+
"description": "MCU temperature"
|
|
2572
2572
|
},
|
|
2573
2573
|
{
|
|
2574
|
-
"value": "
|
|
2574
|
+
"value": "board-temp",
|
|
2575
|
+
"description": "Embedded board thermistor (expansion boards)"
|
|
2576
|
+
},
|
|
2577
|
+
{
|
|
2578
|
+
"value": "current",
|
|
2579
|
+
"description": "Heater current (INDX tool board)"
|
|
2580
|
+
},
|
|
2581
|
+
{
|
|
2582
|
+
"value": "current-loop",
|
|
2575
2583
|
"description": "4-20mA current-loop sensor"
|
|
2576
2584
|
},
|
|
2577
2585
|
{
|
|
@@ -6166,7 +6174,7 @@
|
|
|
6166
6174
|
},
|
|
6167
6175
|
{
|
|
6168
6176
|
"letter": "C",
|
|
6169
|
-
"description": "CAN address plus CS and INT pin names, or CAN address plus I2C info (toolboards)"
|
|
6177
|
+
"description": "CAN address plus CS and INT pin names, or CAN address plus I2C info (toolboards); nil = remove"
|
|
6170
6178
|
},
|
|
6171
6179
|
{
|
|
6172
6180
|
"letter": "Q",
|
|
@@ -6205,14 +6213,6 @@
|
|
|
6205
6213
|
{
|
|
6206
6214
|
"value": "0",
|
|
6207
6215
|
"description": "Activate immediately"
|
|
6208
|
-
},
|
|
6209
|
-
{
|
|
6210
|
-
"value": "1",
|
|
6211
|
-
"description": "Activate just before the start of the next move"
|
|
6212
|
-
},
|
|
6213
|
-
{
|
|
6214
|
-
"value": "2",
|
|
6215
|
-
"description": "Activate just before the start of the deceleration segment of the next move"
|
|
6216
6216
|
}
|
|
6217
6217
|
]
|
|
6218
6218
|
},
|
package/dist/providers.js
CHANGED
|
@@ -304,25 +304,24 @@ function isInsideStringLiteral(beforeCursor) {
|
|
|
304
304
|
}
|
|
305
305
|
return inString;
|
|
306
306
|
}
|
|
307
|
-
/**
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
else if (ch === ";") {
|
|
322
|
-
return true;
|
|
307
|
+
/**
|
|
308
|
+
* Report whether the character at zero-based `offset` of a line is part of a comment, as classified by the
|
|
309
|
+
* language's own tokenizer - so `;` comments and the CNC-only `(...)` comments are both covered. Lines are
|
|
310
|
+
* tokenized in isolation, which is safe because every tokenizer state pops at end-of-line.
|
|
311
|
+
*/
|
|
312
|
+
function isCommentAt(monacoInstance, model, lineNumber, offset) {
|
|
313
|
+
if (offset < 0) {
|
|
314
|
+
return false;
|
|
315
|
+
}
|
|
316
|
+
const tokens = monacoInstance.editor.tokenize(model.getLineContent(lineNumber), model.getLanguageId())[0] ?? [];
|
|
317
|
+
let type = "";
|
|
318
|
+
for (const token of tokens) {
|
|
319
|
+
if (token.offset > offset) {
|
|
320
|
+
break;
|
|
323
321
|
}
|
|
322
|
+
type = token.type;
|
|
324
323
|
}
|
|
325
|
-
return
|
|
324
|
+
return type.startsWith("comment");
|
|
326
325
|
}
|
|
327
326
|
/**
|
|
328
327
|
* Detect whether the cursor sits inside an RRF expression context:
|
|
@@ -810,6 +809,10 @@ export function registerProvidersFor(monacoInstance, languageId) {
|
|
|
810
809
|
disposables.push(monacoInstance.languages.registerCompletionItemProvider(languageId, {
|
|
811
810
|
triggerCharacters: ["G", "M", "T", "g", "m", "t", " ", "{", ".", "=", "!", "\""],
|
|
812
811
|
provideCompletionItems: (model, position, context) => {
|
|
812
|
+
// Trigger characters bypass Monaco's quickSuggestions.comments gate, so check the token ourselves
|
|
813
|
+
if (isCommentAt(monacoInstance, model, position.lineNumber, position.column - 2)) {
|
|
814
|
+
return { suggestions: [] };
|
|
815
|
+
}
|
|
813
816
|
const lineContent = model.getLineContent(position.lineNumber);
|
|
814
817
|
const beforeCursor = lineContent.substring(0, position.column - 1);
|
|
815
818
|
// A manual Ctrl+Space (Invoke) always shows the list; an auto-trigger (TriggerCharacter or
|
|
@@ -1036,10 +1039,10 @@ export function registerProvidersFor(monacoInstance, languageId) {
|
|
|
1036
1039
|
if (isInsideStringLiteral(beforeCursor)) {
|
|
1037
1040
|
return null;
|
|
1038
1041
|
}
|
|
1039
|
-
// Cursor
|
|
1040
|
-
//
|
|
1041
|
-
//
|
|
1042
|
-
if (
|
|
1042
|
+
// Cursor inside a comment (e.g. after bksp joins a line onto a previous commented line like
|
|
1043
|
+
// "M106 P1 S255 ; note"). No signature help applies there, and without this guard Monaco would
|
|
1044
|
+
// keep the previous parameter's tooltip floating over prose.
|
|
1045
|
+
if (isCommentAt(monacoInstance, model, position.lineNumber, position.column - 2)) {
|
|
1043
1046
|
return null;
|
|
1044
1047
|
}
|
|
1045
1048
|
// In an expression context the only meaningful signature help is the enclosing function call -
|
|
@@ -1231,6 +1234,10 @@ export function registerProvidersFor(monacoInstance, languageId) {
|
|
|
1231
1234
|
provideHover: async (model, position) => {
|
|
1232
1235
|
const lineContent = model.getLineContent(position.lineNumber);
|
|
1233
1236
|
const word = model.getWordAtPosition(position);
|
|
1237
|
+
// Comment text may contain G/M-code letters that would otherwise match
|
|
1238
|
+
if (isCommentAt(monacoInstance, model, position.lineNumber, (word ? word.startColumn : position.column) - 1)) {
|
|
1239
|
+
return null;
|
|
1240
|
+
}
|
|
1234
1241
|
if (!word) {
|
|
1235
1242
|
// No identifier-shaped word under the cursor (e.g. cursor on `*` in `M586 C"*"`, on `?` etc.).
|
|
1236
1243
|
// Try to resolve the cursor as a parameter value position via findParameterAtCursor; if it
|
|
@@ -1258,12 +1265,6 @@ export function registerProvidersFor(monacoInstance, languageId) {
|
|
|
1258
1265
|
// prevents `"M104 done"` style false matches lives down at the wordIsCode branch
|
|
1259
1266
|
const beforeWordForString = lineContent.substring(0, word.startColumn - 1);
|
|
1260
1267
|
const insideString = isInsideStringLiteral(beforeWordForString);
|
|
1261
|
-
// Suppress hover inside `;` line-comments - the tokeniser colours them as comments but the hover
|
|
1262
|
-
// provider runs independently and would otherwise match G/M-code letters that appear in comment text
|
|
1263
|
-
const semi = lineContent.indexOf(";");
|
|
1264
|
-
if (semi >= 0 && word.startColumn - 1 >= semi) {
|
|
1265
|
-
return null;
|
|
1266
|
-
}
|
|
1267
1268
|
// Determine up-front whether the word sits inside an expression context - used to route hover between
|
|
1268
1269
|
// the gcode-parameter flavour (outside expressions) and the function/constant flavour (inside)
|
|
1269
1270
|
const beforeWord = lineContent.substring(0, word.startColumn - 1);
|