@duet3d/monacotokens 3.7.0-alpha.2 → 3.7.0-alpha.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.
@@ -0,0 +1,594 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.showGcodeSearch = showGcodeSearch;
4
+ exports.showObjectModelSearch = showObjectModelSearch;
5
+ exports.addGcodeSearchAction = addGcodeSearchAction;
6
+ const _1 = require(".");
7
+ const machine_context_1 = require("../objectmodel/machine-context");
8
+ const local_variables_1 = require("./local-variables");
9
+ const deprecations_1 = require("../objectmodel/deprecations");
10
+ const providers_1 = require("../providers");
11
+ const widgetId = "duet.gcodeSearchWidget";
12
+ let activeWidget = null;
13
+ /**
14
+ * Open the gcode search overlay anchored to the current cursor position, styled like the F2 rename widget.
15
+ */
16
+ function showGcodeSearch(monacoInstance, editor) {
17
+ if (activeWidget) {
18
+ activeWidget.dispose();
19
+ }
20
+ const root = document.createElement("div");
21
+ root.style.cssText = [
22
+ "width: min(600px, 90vw)",
23
+ "background: var(--vscode-editorWidget-background, #252526)",
24
+ "color: var(--vscode-editorWidget-foreground, #cccccc)",
25
+ "border: 1px solid var(--vscode-editorWidget-border, #454545)",
26
+ "box-shadow: 0 2px 8px rgba(0,0,0,0.4)",
27
+ "font-family: var(--monaco-monospace-font)",
28
+ "font-size: 13px"
29
+ ].join("; ");
30
+ const input = document.createElement("input");
31
+ input.type = "text";
32
+ input.placeholder = "Search G/M-code by description";
33
+ input.style.cssText = [
34
+ "display: block",
35
+ "width: 100%",
36
+ "box-sizing: border-box",
37
+ "padding: 4px 6px",
38
+ "background: var(--vscode-input-background, #3c3c3c)",
39
+ "color: var(--vscode-input-foreground, #cccccc)",
40
+ "border: none",
41
+ "border-bottom: 1px solid var(--vscode-editorWidget-border, #454545)",
42
+ "outline: none",
43
+ "font: inherit"
44
+ ].join("; ");
45
+ const listAndDetails = document.createElement("div");
46
+ listAndDetails.style.cssText = "display: flex; max-height: 240px";
47
+ const list = document.createElement("div");
48
+ list.style.cssText = [
49
+ "flex: 1",
50
+ "overflow-y: auto",
51
+ "min-width: 0"
52
+ ].join("; ");
53
+ const details = document.createElement("div");
54
+ details.style.cssText = [
55
+ "display: none",
56
+ "flex: 1",
57
+ "overflow-y: auto",
58
+ "padding: 6px 8px",
59
+ "border-left: 1px solid var(--vscode-editorWidget-border, #454545)",
60
+ "white-space: pre-wrap",
61
+ "line-height: 1.4"
62
+ ].join("; ");
63
+ listAndDetails.appendChild(list);
64
+ listAndDetails.appendChild(details);
65
+ root.appendChild(input);
66
+ root.appendChild(listAndDetails);
67
+ // Detect the active Monaco theme and pick the matching keyword blue
68
+ const editorEl = editor.getDomNode();
69
+ const isDarkTheme = !!(editorEl && (editorEl.classList.contains("vs-dark") || editorEl.classList.contains("hc-black")));
70
+ const codeColor = isDarkTheme ? "#569cd6" : "#0000ff";
71
+ let entries = [];
72
+ let selectedIndex = 0;
73
+ let rowEls = [];
74
+ let detailsVisible = false;
75
+ function renderDetails() {
76
+ if (!detailsVisible) {
77
+ details.style.display = "none";
78
+ return;
79
+ }
80
+ details.style.display = "block";
81
+ details.innerHTML = "";
82
+ const info = entries[selectedIndex];
83
+ if (!info) {
84
+ details.textContent = "No entry selected.";
85
+ return;
86
+ }
87
+ const header = document.createElement("div");
88
+ header.style.cssText = `font-weight: bold; color: ${codeColor}; margin-bottom: 4px`;
89
+ header.textContent = `${info.code} - ${info.summary}`;
90
+ details.appendChild(header);
91
+ if (info.deprecated) {
92
+ const dep = document.createElement("div");
93
+ dep.style.cssText = "color: #cca700; margin-bottom: 4px";
94
+ dep.textContent = `⚠ Deprecated: ${info.deprecated}`;
95
+ details.appendChild(dep);
96
+ }
97
+ if (info.description) {
98
+ const desc = document.createElement("div");
99
+ desc.style.cssText = "margin-bottom: 4px; opacity: 0.9";
100
+ desc.textContent = info.description;
101
+ details.appendChild(desc);
102
+ }
103
+ if (info.parameters.length > 0) {
104
+ const p = document.createElement("div");
105
+ p.style.cssText = "margin-top: 4px";
106
+ const heading = document.createElement("div");
107
+ heading.style.fontWeight = "bold";
108
+ heading.textContent = "Parameters:";
109
+ p.appendChild(heading);
110
+ for (const param of info.parameters) {
111
+ const row = document.createElement("div");
112
+ row.style.cssText = "margin-left: 8px";
113
+ const letter = document.createElement("span");
114
+ letter.style.fontWeight = "bold";
115
+ letter.textContent = param.letter;
116
+ row.appendChild(letter);
117
+ row.appendChild(document.createTextNode(` - ${param.description}`));
118
+ if (param.deprecated) {
119
+ const tag = document.createElement("span");
120
+ tag.style.cssText = "color: #cca700; margin-left: 4px";
121
+ tag.textContent = "(deprecated)";
122
+ row.appendChild(tag);
123
+ }
124
+ p.appendChild(row);
125
+ }
126
+ details.appendChild(p);
127
+ }
128
+ }
129
+ function highlight() {
130
+ for (let i = 0; i < rowEls.length; i++) {
131
+ const active = i === selectedIndex;
132
+ rowEls[i].style.background = active
133
+ ? "var(--vscode-list-activeSelectionBackground, #094771)"
134
+ : "transparent";
135
+ rowEls[i].style.color = active
136
+ ? "var(--vscode-list-activeSelectionForeground, #ffffff)"
137
+ : "inherit";
138
+ }
139
+ if (rowEls[selectedIndex]) {
140
+ rowEls[selectedIndex].scrollIntoView({ block: "nearest" });
141
+ }
142
+ renderDetails();
143
+ }
144
+ function render(query) {
145
+ const q = query.trim().toLowerCase();
146
+ entries = q.length === 0
147
+ ? _1.gcodeData.slice()
148
+ : _1.gcodeData.filter(g => g.code.toLowerCase().includes(q) || g.summary.toLowerCase().includes(q));
149
+ selectedIndex = 0;
150
+ list.innerHTML = "";
151
+ rowEls = [];
152
+ for (const info of entries) {
153
+ const row = document.createElement("div");
154
+ row.style.cssText = "padding: 3px 8px; cursor: pointer; display: flex; gap: 8px; white-space: nowrap";
155
+ const code = document.createElement("span");
156
+ code.textContent = info.code;
157
+ code.style.cssText = `min-width: 48px; font-weight: bold; color: ${codeColor}`;
158
+ const desc = document.createElement("span");
159
+ desc.textContent = info.summary;
160
+ desc.style.cssText = "flex: 1; opacity: 0.85; overflow: hidden; text-overflow: ellipsis";
161
+ row.appendChild(code);
162
+ row.appendChild(desc);
163
+ row.addEventListener("mouseenter", () => {
164
+ selectedIndex = rowEls.indexOf(row);
165
+ highlight();
166
+ });
167
+ row.addEventListener("mousedown", (e) => {
168
+ // mousedown so the input doesn't lose focus before we can read selection
169
+ e.preventDefault();
170
+ accept();
171
+ });
172
+ list.appendChild(row);
173
+ rowEls.push(row);
174
+ }
175
+ highlight();
176
+ }
177
+ function accept() {
178
+ const choice = entries[selectedIndex];
179
+ if (choice) {
180
+ const selection = editor.getSelection();
181
+ if (selection) {
182
+ editor.executeEdits("duet-gcode-search", [{
183
+ range: selection,
184
+ text: choice.code,
185
+ forceMoveMarkers: true
186
+ }]);
187
+ editor.pushUndoStop();
188
+ }
189
+ }
190
+ close();
191
+ }
192
+ function close() {
193
+ if (activeWidget && activeWidget.editor === editor) {
194
+ activeWidget.dispose();
195
+ }
196
+ editor.focus();
197
+ }
198
+ input.addEventListener("input", (e) => {
199
+ e.stopPropagation();
200
+ render(input.value);
201
+ });
202
+ // Stop key events from bubbling to Monaco so it doesn't run its own auto-complete / typing handlers
203
+ const stopKey = (e) => e.stopPropagation();
204
+ input.addEventListener("keypress", stopKey);
205
+ input.addEventListener("keyup", stopKey);
206
+ const pageStep = 8;
207
+ input.addEventListener("keydown", (e) => {
208
+ e.stopPropagation();
209
+ if (e.key === "ArrowDown") {
210
+ e.preventDefault();
211
+ selectedIndex = Math.min(selectedIndex + 1, rowEls.length - 1);
212
+ highlight();
213
+ }
214
+ else if (e.key === "ArrowUp") {
215
+ e.preventDefault();
216
+ selectedIndex = Math.max(selectedIndex - 1, 0);
217
+ highlight();
218
+ }
219
+ else if (e.key === "PageDown") {
220
+ e.preventDefault();
221
+ selectedIndex = Math.min(selectedIndex + pageStep, rowEls.length - 1);
222
+ highlight();
223
+ }
224
+ else if (e.key === "PageUp") {
225
+ e.preventDefault();
226
+ selectedIndex = Math.max(selectedIndex - pageStep, 0);
227
+ highlight();
228
+ }
229
+ else if (e.key === "Home") {
230
+ e.preventDefault();
231
+ selectedIndex = 0;
232
+ highlight();
233
+ }
234
+ else if (e.key === "End") {
235
+ e.preventDefault();
236
+ selectedIndex = Math.max(0, rowEls.length - 1);
237
+ highlight();
238
+ }
239
+ else if (e.key === "Enter") {
240
+ e.preventDefault();
241
+ accept();
242
+ }
243
+ else if (e.key === "Escape") {
244
+ e.preventDefault();
245
+ close();
246
+ }
247
+ else if ((e.ctrlKey || e.metaKey) && (e.key === " " || e.code === "Space")) {
248
+ // Toggle the details panel, matching Monaco's suggest-widget behaviour
249
+ e.preventDefault();
250
+ detailsVisible = !detailsVisible;
251
+ renderDetails();
252
+ }
253
+ });
254
+ // Use an overlay widget (not a content widget) so the editor's scroll/layout aren't touched at all
255
+ // We position it manually near the cursor by absolute-positioning `root` inside the editor overlay container
256
+ root.style.position = "absolute";
257
+ function positionNearCursor() {
258
+ const cursorPos = editor.getPosition();
259
+ if (!cursorPos) {
260
+ return;
261
+ }
262
+ const coord = editor.getScrolledVisiblePosition(cursorPos);
263
+ const layout = editor.getLayoutInfo();
264
+ if (!coord) {
265
+ return;
266
+ }
267
+ const widgetWidth = root.offsetWidth || 600;
268
+ const widgetHeight = root.offsetHeight || 280;
269
+ const lineHeight = editor.getOption(monacoInstance.editor.EditorOption.lineHeight);
270
+ // Prefer below the cursor, flip above if it would overflow the editor viewport
271
+ let top = coord.top + lineHeight;
272
+ if (top + widgetHeight > layout.height) {
273
+ top = Math.max(0, coord.top - widgetHeight);
274
+ }
275
+ let left = coord.left;
276
+ if (left + widgetWidth > layout.width) {
277
+ left = Math.max(0, layout.width - widgetWidth - 8);
278
+ }
279
+ root.style.top = `${top}px`;
280
+ root.style.left = `${left}px`;
281
+ }
282
+ const widget = {
283
+ getId: () => widgetId,
284
+ getDomNode: () => root,
285
+ getPosition: () => null
286
+ };
287
+ editor.addOverlayWidget(widget);
288
+ positionNearCursor();
289
+ // Re-position once the DOM has actually measured the widget (offsetWidth/Height are 0 at first paint)
290
+ requestAnimationFrame(positionNearCursor);
291
+ // Close on Esc anywhere in the document (even when focus has drifted to the editor)
292
+ const onDocKeyDown = (e) => {
293
+ if (e.key === "Escape") {
294
+ e.preventDefault();
295
+ e.stopPropagation();
296
+ close();
297
+ }
298
+ };
299
+ // Close on mousedown outside the widget
300
+ const onDocMouseDown = (e) => {
301
+ if (!root.contains(e.target)) {
302
+ close();
303
+ }
304
+ };
305
+ document.addEventListener("keydown", onDocKeyDown, true);
306
+ document.addEventListener("mousedown", onDocMouseDown, true);
307
+ render("");
308
+ // preventScroll: stops the browser auto-scrolling the page when the cursor is low in the editor
309
+ setTimeout(() => input.focus({ preventScroll: true }), 0);
310
+ activeWidget = {
311
+ editor,
312
+ dispose: () => {
313
+ document.removeEventListener("keydown", onDocKeyDown, true);
314
+ document.removeEventListener("mousedown", onDocMouseDown, true);
315
+ editor.removeOverlayWidget(widget);
316
+ activeWidget = null;
317
+ }
318
+ };
319
+ }
320
+ /**
321
+ * Open a variant of the search overlay that lists object-model paths instead of G/M-codes. The model is
322
+ * flattened once on open (up to depth 3) and cached in the widget for the duration of the session; arrays
323
+ * are represented by their first element with an `[0]` placeholder. Local `var` / `global` declarations
324
+ * scanned from the current editor model are folded in as `var.<name>` / `global.<name>` entries.
325
+ */
326
+ function showObjectModelSearch(monacoInstance, editor) {
327
+ if (activeWidget) {
328
+ activeWidget.dispose();
329
+ }
330
+ const root = document.createElement("div");
331
+ root.style.cssText = [
332
+ "width: min(600px, 90vw)",
333
+ "background: var(--vscode-editorWidget-background, #252526)",
334
+ "color: var(--vscode-editorWidget-foreground, #cccccc)",
335
+ "border: 1px solid var(--vscode-editorWidget-border, #454545)",
336
+ "box-shadow: 0 2px 8px rgba(0,0,0,0.4)",
337
+ "font-family: var(--monaco-monospace-font)",
338
+ "font-size: 13px"
339
+ ].join("; ");
340
+ const input = document.createElement("input");
341
+ input.type = "text";
342
+ input.placeholder = "Search object-model path...";
343
+ input.style.cssText = [
344
+ "display: block",
345
+ "width: 100%",
346
+ "box-sizing: border-box",
347
+ "padding: 4px 6px",
348
+ "background: var(--vscode-input-background, #3c3c3c)",
349
+ "color: var(--vscode-input-foreground, #cccccc)",
350
+ "border: none",
351
+ "border-bottom: 1px solid var(--vscode-editorWidget-border, #454545)",
352
+ "outline: none",
353
+ "font: inherit"
354
+ ].join("; ");
355
+ const list = document.createElement("div");
356
+ list.style.cssText = "display: block; max-height: 240px; overflow-y: auto";
357
+ root.appendChild(input);
358
+ root.appendChild(list);
359
+ const editorEl = editor.getDomNode();
360
+ const isDarkTheme = !!(editorEl && (editorEl.classList.contains("vs-dark") || editorEl.classList.contains("hc-black")));
361
+ const pathColor = isDarkTheme ? "#9CDCFE" : "#001080";
362
+ // Collect all paths once - model-derived paths plus the local scanner's var/global declarations
363
+ const allPaths = new Set();
364
+ const ctx = (0, machine_context_1.getMachineContext)();
365
+ if (ctx?.model) {
366
+ for (const p of (0, providers_1.flattenObjectModel)(ctx.model)) {
367
+ allPaths.add(p);
368
+ }
369
+ }
370
+ const model = editor.getModel();
371
+ if (model) {
372
+ const locals = (0, local_variables_1.getLocalVariables)(model);
373
+ for (const n of locals.vars) {
374
+ allPaths.add(`var.${n}`);
375
+ }
376
+ for (const n of locals.globals) {
377
+ allPaths.add(`global.${n}`);
378
+ }
379
+ }
380
+ const flatPaths = Array.from(allPaths).sort();
381
+ let entries = [];
382
+ let selectedIndex = 0;
383
+ let rowEls = [];
384
+ function highlight() {
385
+ for (let i = 0; i < rowEls.length; i++) {
386
+ const active = i === selectedIndex;
387
+ rowEls[i].style.background = active
388
+ ? "var(--vscode-list-activeSelectionBackground, #094771)"
389
+ : "transparent";
390
+ rowEls[i].style.color = active
391
+ ? "var(--vscode-list-activeSelectionForeground, #ffffff)"
392
+ : "inherit";
393
+ }
394
+ if (rowEls[selectedIndex]) {
395
+ rowEls[selectedIndex].scrollIntoView({ block: "nearest" });
396
+ }
397
+ }
398
+ function render(query) {
399
+ const q = query.trim().toLowerCase();
400
+ entries = q.length === 0 ? flatPaths.slice() : flatPaths.filter(p => p.toLowerCase().includes(q));
401
+ selectedIndex = 0;
402
+ list.innerHTML = "";
403
+ rowEls = [];
404
+ const ctxModel = ctx?.model ?? null;
405
+ for (const path of entries) {
406
+ const row = document.createElement("div");
407
+ row.style.cssText = "padding: 3px 8px; cursor: pointer; white-space: nowrap; overflow: hidden; display: flex; gap: 8px; align-items: baseline";
408
+ const pathSpan = document.createElement("span");
409
+ pathSpan.textContent = path;
410
+ pathSpan.style.cssText = `color: ${pathColor}; flex: 1; overflow: hidden; text-overflow: ellipsis`;
411
+ const deprecation = ctxModel ? (0, deprecations_1.getPathDeprecation)(path) : null;
412
+ if (deprecation !== null) {
413
+ pathSpan.style.textDecoration = "line-through";
414
+ pathSpan.style.opacity = "0.7";
415
+ const tag = document.createElement("span");
416
+ tag.textContent = deprecation ? `deprecated - ${deprecation}` : "deprecated";
417
+ tag.style.cssText = "color: #cca700; font-style: italic; flex-shrink: 1; overflow: hidden; text-overflow: ellipsis";
418
+ row.title = `Deprecated${deprecation ? ": " + deprecation : ""}`;
419
+ row.appendChild(pathSpan);
420
+ row.appendChild(tag);
421
+ }
422
+ else {
423
+ row.appendChild(pathSpan);
424
+ }
425
+ row.addEventListener("mouseenter", () => {
426
+ selectedIndex = rowEls.indexOf(row);
427
+ highlight();
428
+ });
429
+ row.addEventListener("mousedown", (e) => {
430
+ e.preventDefault();
431
+ accept();
432
+ });
433
+ list.appendChild(row);
434
+ rowEls.push(row);
435
+ }
436
+ highlight();
437
+ }
438
+ function accept() {
439
+ const choice = entries[selectedIndex];
440
+ if (choice) {
441
+ const selection = editor.getSelection();
442
+ if (selection) {
443
+ editor.executeEdits("duet-om-search", [{
444
+ range: selection,
445
+ text: choice,
446
+ forceMoveMarkers: true
447
+ }]);
448
+ editor.pushUndoStop();
449
+ }
450
+ }
451
+ close();
452
+ }
453
+ function close() {
454
+ if (activeWidget && activeWidget.editor === editor) {
455
+ activeWidget.dispose();
456
+ }
457
+ editor.focus();
458
+ }
459
+ input.addEventListener("input", (e) => {
460
+ e.stopPropagation();
461
+ render(input.value);
462
+ });
463
+ const stopKey = (e) => e.stopPropagation();
464
+ input.addEventListener("keypress", stopKey);
465
+ input.addEventListener("keyup", stopKey);
466
+ const pageStep = 8;
467
+ input.addEventListener("keydown", (e) => {
468
+ e.stopPropagation();
469
+ if (e.key === "ArrowDown") {
470
+ e.preventDefault();
471
+ selectedIndex = Math.min(selectedIndex + 1, rowEls.length - 1);
472
+ highlight();
473
+ }
474
+ else if (e.key === "ArrowUp") {
475
+ e.preventDefault();
476
+ selectedIndex = Math.max(selectedIndex - 1, 0);
477
+ highlight();
478
+ }
479
+ else if (e.key === "PageDown") {
480
+ e.preventDefault();
481
+ selectedIndex = Math.min(selectedIndex + pageStep, rowEls.length - 1);
482
+ highlight();
483
+ }
484
+ else if (e.key === "PageUp") {
485
+ e.preventDefault();
486
+ selectedIndex = Math.max(selectedIndex - pageStep, 0);
487
+ highlight();
488
+ }
489
+ else if (e.key === "Home") {
490
+ e.preventDefault();
491
+ selectedIndex = 0;
492
+ highlight();
493
+ }
494
+ else if (e.key === "End") {
495
+ e.preventDefault();
496
+ selectedIndex = Math.max(0, rowEls.length - 1);
497
+ highlight();
498
+ }
499
+ else if (e.key === "Enter") {
500
+ e.preventDefault();
501
+ accept();
502
+ }
503
+ else if (e.key === "Escape") {
504
+ e.preventDefault();
505
+ close();
506
+ }
507
+ });
508
+ root.style.position = "absolute";
509
+ function positionNearCursor() {
510
+ const cursorPos = editor.getPosition();
511
+ if (!cursorPos) {
512
+ return;
513
+ }
514
+ const coord = editor.getScrolledVisiblePosition(cursorPos);
515
+ const layout = editor.getLayoutInfo();
516
+ if (!coord) {
517
+ return;
518
+ }
519
+ const widgetWidth = root.offsetWidth || 600;
520
+ const widgetHeight = root.offsetHeight || 280;
521
+ const lineHeight = editor.getOption(monacoInstance.editor.EditorOption.lineHeight);
522
+ let top = coord.top + lineHeight;
523
+ if (top + widgetHeight > layout.height) {
524
+ top = Math.max(0, coord.top - widgetHeight);
525
+ }
526
+ let left = coord.left;
527
+ if (left + widgetWidth > layout.width) {
528
+ left = Math.max(0, layout.width - widgetWidth - 8);
529
+ }
530
+ root.style.top = `${top}px`;
531
+ root.style.left = `${left}px`;
532
+ }
533
+ const widget = {
534
+ getId: () => widgetId,
535
+ getDomNode: () => root,
536
+ getPosition: () => null
537
+ };
538
+ editor.addOverlayWidget(widget);
539
+ positionNearCursor();
540
+ requestAnimationFrame(positionNearCursor);
541
+ const onDocKeyDown = (e) => {
542
+ if (e.key === "Escape") {
543
+ e.preventDefault();
544
+ e.stopPropagation();
545
+ close();
546
+ }
547
+ };
548
+ const onDocMouseDown = (e) => {
549
+ if (!root.contains(e.target)) {
550
+ close();
551
+ }
552
+ };
553
+ document.addEventListener("keydown", onDocKeyDown, true);
554
+ document.addEventListener("mousedown", onDocMouseDown, true);
555
+ render("");
556
+ setTimeout(() => input.focus({ preventScroll: true }), 0);
557
+ activeWidget = {
558
+ editor,
559
+ dispose: () => {
560
+ document.removeEventListener("keydown", onDocKeyDown, true);
561
+ document.removeEventListener("mousedown", onDocMouseDown, true);
562
+ editor.removeOverlayWidget(widget);
563
+ activeWidget = null;
564
+ }
565
+ };
566
+ }
567
+ /**
568
+ * Register the F4 search action on a freshly created editor instance.
569
+ * Call this once per editor right after `monaco.editor.create(...)`.
570
+ */
571
+ function addGcodeSearchAction(monacoInstance, editor) {
572
+ return editor.addAction({
573
+ id: "duet.searchGcode",
574
+ label: "Search G/M-code or object-model path",
575
+ keybindings: [monacoInstance.KeyCode.F4],
576
+ run: () => {
577
+ // Hide the suggest widget and parameter-hints tooltip so our overlay doesn't visually compete with them
578
+ editor.trigger("gcode-search", "hideSuggestWidget", null);
579
+ editor.trigger("gcode-search", "closeParameterHints", null);
580
+ // Switch to object-model search when the cursor is inside an expression context
581
+ const model = editor.getModel();
582
+ const position = editor.getPosition();
583
+ if (model && position) {
584
+ const lineContent = model.getLineContent(position.lineNumber);
585
+ const beforeCursor = lineContent.substring(0, position.column - 1);
586
+ if ((0, providers_1.isInsideExpression)(beforeCursor)) {
587
+ showObjectModelSearch(monacoInstance, editor);
588
+ return;
589
+ }
590
+ }
591
+ showGcodeSearch(monacoInstance, editor);
592
+ }
593
+ });
594
+ }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,12 @@
1
1
  export * from "./monaco-gcode";
2
2
  export * from "./monaco-stm32";
3
3
  export * from "./monaco-menu";
4
+ export * from "./gcodes";
5
+ export * from "./expressions";
6
+ export * from "./objectmodel/machine-context";
7
+ export * from "./gcodes/local-variables";
8
+ export * from "./objectmodel/deprecations";
9
+ export * from "./objectmodel/enums";
10
+ export * from "./providers";
11
+ export * from "./gcodes/search";
4
12
  export * from "./register";
package/dist/index.js CHANGED
@@ -17,4 +17,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./monaco-gcode"), exports);
18
18
  __exportStar(require("./monaco-stm32"), exports);
19
19
  __exportStar(require("./monaco-menu"), exports);
20
+ __exportStar(require("./gcodes"), exports);
21
+ __exportStar(require("./expressions"), exports);
22
+ __exportStar(require("./objectmodel/machine-context"), exports);
23
+ __exportStar(require("./gcodes/local-variables"), exports);
24
+ __exportStar(require("./objectmodel/deprecations"), exports);
25
+ __exportStar(require("./objectmodel/enums"), exports);
26
+ __exportStar(require("./providers"), exports);
27
+ __exportStar(require("./gcodes/search"), exports);
20
28
  __exportStar(require("./register"), exports);