SteinWipe SWMC Gcode - VS Code Extension
[{"type":"heading","level":2,"children":[{"t":"text","v":"Overview","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"If youve ever opened a SWMC gcode file in VS Code and watched half your macro logic turn comment-grey, you know the problem this solves. Mainstream gcode extensions were built for plain motion gcode. They dont understand the SWMC macro language, so they paint leading-semicolon lines as comments even when those lines are live variable declarations. That miscoloring has caused real editing mistakes, code that looks inert but isnt.","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"The SteinWipe SWMC Gcode extension is a syntax highlighter built specifically for the way SWMC code actually works. It understands macro blocks, SWUD variables, SSD detection regex, the firmware conditional constructs, and the difference between a comment and a statement separator. It ships with a bundled color theme, SteinWipe SWMC Dark, so everyone sees the exact same colors. That last part matters more than it sounds; when you post a screenshot in Discord for help, it looks identical to what everyone else sees, so there is no confusion about what a given color means.","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"The highlighting you see in the code examples on this page is the same theme. What you see here is what youll get in your editor.","b":false,"i":false}]},{"type":"heading","level":2,"children":[{"t":"text","v":"What It Highlights","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"The theme assigns a distinct color to each kind of token so the structure of your code reads at a glance. The difference is easiest to see side by side; on the left is SWMC code in a standard gcode extension, on the right is the same code with this extension and theme active.","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"% Before and after\nswmc_before_after | scale=100% | max_width=900 | caption=bottom\nLeft: a mainstream gcode highlighter treats the leading-semicolon SWUD lines as comments. Right: the SteinWipe theme reads them as live declarations, with values in orange, variables in teal, and the macro structure intact.\n\/%","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"Here is a typical block with everything in play:","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"\u0026amp; General machine settings\n{\n;global rapid_travel = 400\n;global enable_abl = true\n;global steinwipe_xoffset = 0.90\n}\n\/\u0026amp;","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"User values like integers [[400]], booleans declared in SWUDS [[{global var = true}]], and float values [[0.90]] all render in bright orange, so the editable numbers and booleans jump out. The [[global]] declaration is blue, and the variable names are teal. The leading semicolons inside the block read as separators, not comments, which is exactly how the macro engine treats them.","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"Motion commands and axis moves follow the standard convention youre already used to from the slicer:","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"\u0026amp; Homing move\nG0 X230 Y15 Z0.4 ; move to homing area\n\/\u0026amp;","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"The [[G0]] command is gold, and the axis coordinates take the familiar red, green, and blue for X, Y, and Z. When an axis value is a live macro instead of a fixed number, only the axis letter is colored so the macro keeps its own internal highlighting:","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"\u0026amp; Tracked position move\nG0 X{x_pos = 230; x_pos} Y{y_pos = 15; y_pos}\n\/\u0026amp;","b":false,"i":false}]},{"type":"heading","level":2,"children":[{"t":"text","v":"Firmware Constructs","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"One of the things generic highlighters completely miss is that some gcode commands are actually flow control that runs on the printer, not the slicer. SWMC uses these constantly. The extension colors them as control flow, cyan, the same as the slicer if and endif keywords, so all your conditional logic reads as one family.","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"\u0026amp; AMS material check\nM1002 judge_flag extrude_cali_flag\nM622 J1\nG0 X{x_pos = x_pos + 5; 5} E0.31181 F{cali_feed}\nM623\n\/\u0026amp;","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"Here [[M1002 judge_flag]] sets up the condition which acts like an [[if]] argument for [[M622 J1]] which is the then-do-this branch, and [[M623]] closes it like an [[endif]]. The flag name after judge_flag renders in light blue as a variable reference. The toolchange guard pair [[M620 S]] and [[M621 S[next_tool] ]] gets the same treatment.","b":false,"i":false}]},{"type":"heading","level":2,"children":[{"t":"text","v":"\nTheme Colors","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"Every token type has its own color, and theyre consistent across the extension and this website; a code sample looks the same wherever you see it. Heres the full palette the SteinWipe SWMC Dark theme uses. If you ever want to know what a color means when reading someones screenshot, this is the reference.","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"% csv SteinWipe SWMC Dark palette\n\nUser values (int\/float\/bool) | #FF8C00\n\nSlicer control flow, macro braces, firmware constructs | #4FC1FF\n\nUser variables \/ SWUD \/ SSD names | #17B8B8\n\nglobal \/ local declarations | #569CD6\n\nComments | #6A9955\n\nStrings and regex literals | #CE9178\n\nSSD keyword capture group | #D7BA7D\n\nStock placeholders and judge_flag argument | #9CDCFE\n\nGcode motion commands (G\/M\/T) | #DCDCAA\n\nX axis | #F14C4C\n\nY axis | #5FD75F\n\nZ axis | #5C8CFF\n\nOperators | #D4D4D4\n\nEditor background | #1A1A1A\n\n\/%","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"A few notes on how the colors group. Anything you can edit - numbers, toggles, offsets - is orange, so the values you actually change are the easiest to spot. Conditional logic is cyan whether it runs in the slicer or on the printer, so the branching in your code reads as one family. Motion follows the convention youre used to from the slicer: gold commands with red, green, and blue for the X, Y, and Z axes. Variables are teal, and anything the slicer provides rather than you (stock placeholders, firmware flags) is light blue.","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"To see this palette live, use the theme shortcut and select SteinWipe SWMC Dark: Ctrl+K then Ctrl+T on Windows or Linux, Cmd+K then Cmd+T on Mac.\n","b":false,"i":false}]},{"type":"heading","level":2,"children":[{"t":"text","v":"Installation","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"The extension is distributed as a .vsix file, which installs directly into VS Code without needing the marketplace.","b":false,"i":false}]},{"type":"heading","level":3,"children":[{"t":"text","v":"Step 1 - Download the extension","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"","b":false,"i":false},{"t":"link","v":"Download","url":"https:\/\/leckiestein.com\/pages\/swmc-releases\/orca-slicer-vs-code-swmc-theme-steinwipe-gcode-1-0-0-vsix","target":"_blank"},{"t":"text","v":" and save the file somewhere you can find it. The filename looks like [[steinwipe-gcode-0.2.6.vsix]].","b":false,"i":false}]},{"type":"heading","level":3,"children":[{"t":"text","v":"Step 2 - Install from VSIX","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"Open VS Code, and head to the extensions icon in the left toolbar then at the top right of the extensions window, use the 3 dots to find the Install from VSIX option or open the Command Palette with Ctrl+Shift+P on Windows or Cmd+Shift+P on Mac. Type \u0026quot;Install from VSIX\u0026quot; and select the command ","b":false,"i":false},{"t":"text","v":"Extensions: Install from VSIX","b":true,"i":false},{"t":"text","v":". Pick the file you downloaded.","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"% Install from VSIX\nswmc_install_from_vsix | scale=100% | max_width=800 | caption=bottom\nYou may also install the extension from the extension icon which can be accessed from the side toolbar.\n\/%","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"If VS Code asks you to reload after installing, do it.","b":false,"i":false}]},{"type":"heading","level":3,"children":[{"t":"text","v":"Step 3 - Activate the color theme","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"The extension bundles the SteinWipe SWMC Dark theme, but you need to select it once. The quickest way is the theme shortcut: press Ctrl+K then Ctrl+T on Windows or Linux, or Cmd+K then Cmd+T on Mac. Use the arrow keys to preview the themes in the list, find ","b":false,"i":false},{"t":"text","v":"SteinWipe SWMC Dark","b":true,"i":false},{"t":"text","v":", and press Enter to apply it.","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"% Select the theme\nswmc_theme_picker | scale=100% | max_width=800 | caption=bottom\nUse the theme shortcut, then arrow down to SteinWipe SWMC Dark and press Enter.\n\/%","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"This step is what guarantees your colors match everyone elses. If you skip it, the code will still highlight, but it will fall back to whatever theme you had, and the colors wont match the project standard. For sharing screenshots and following along with documentation, use the bundled theme.","b":false,"i":false}]},{"type":"heading","level":2,"children":[{"t":"text","v":"Using It On Your Files","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"The extension claims the file extensions [[.swmc]], [[.swmc.gcode]], and [[.swmc.md]]. If your working files use one of those, highlighting applies automatically.","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"Most SWMC source files are saved as plain [[.gcode]], though, and you dont want to force every gcode file on your system into SWMC gcode mode. For those, click the language indicator in the bottom-right corner of the VS Code status bar and choose ","b":false,"i":false},{"t":"text","v":"SteinWipe Gcode","b":true,"i":false},{"t":"text","v":" for that file. The choice sticks per file.","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"% Set the language mode\nswmc_language_mode | scale=100% | max_width=800 | caption=bottom\nClick the language indicator in the bottom-right status bar and choose SteinWipe Gcode to apply highlighting to a .md file.\n\/%","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"If you want a set of files to always open in SWMC mode, you can add a scoped association in your workspace settings that maps a filename pattern to the language, without affecting your other markdown files.","b":false,"i":false}]},{"type":"heading","level":2,"children":[{"t":"text","v":"Troubleshooting","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"The code highlights, but the colors dont match the examples on this page.","b":true,"i":false},{"t":"text","v":" You likely havent selected the bundled theme yet, or youre on a different theme. Use the theme shortcut (Ctrl+K then Ctrl+T, or Cmd+K then Cmd+T on Mac) and choose SteinWipe SWMC Dark.","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"Nothing is highlighted at all.","b":true,"i":false},{"t":"text","v":" VS Code probably hasnt recognized the file as SWMC. If your file is a [[.md]], set the language mode manually using the status bar indicator in the bottom-right, and choose SteinWipe Gcode.","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"I installed an update but the colors or highlighting didnt fully change.","b":true,"i":false},{"t":"text","v":" VS Code caches the active theme and grammar, so a new version doesnt always apply everything right away. Reload the window with ","b":false,"i":false},{"t":"text","v":"Developer: Reload Window","b":true,"i":false},{"t":"text","v":" from the Command Palette. If that doesnt do it, fully close and restart VS Code; that clears anything the reload missed.","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"A line inside a comment is showing colored code.","b":true,"i":false},{"t":"text","v":" That is intended. The macro engine evaluates macro blocks even inside comment lines, so anything inside curly braces in a comment is highlighted as live code while the rest of the comment stays green.","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"Something still looks wrong.","b":true,"i":false},{"t":"text","v":" Highlighting edge cases are easier to fix when I can see them. Drop a screenshot in the Discord with the line that looks off, and Ill take a look.","b":false,"i":false}]},{"type":"heading","level":2,"children":[{"t":"text","v":"A Note On What This Is","b":false,"i":false}]},{"type":"paragraph","children":[{"t":"text","v":"This is a first tool in what I hope becomes a proper SWMC development kit. Right now it is highlighting only, which already removes a whole category of editing mistakes. Down the road the plan is variable tracking, jump-to-definition for your SWUD globals, and warnings for the known macro-language traps before they reach your printer. This release is the foundation for that.","b":false,"i":false}]}]
[{"base":"swmc_before_after","url":"https:\/\/leckiestein.com\/cdn\/shop\/files\/swmc_before_after.jpg?v=1782949067\u0026width=2400","width":2000,"height":1000},{"base":"swmc_install_from_vsix","url":"https:\/\/leckiestein.com\/cdn\/shop\/files\/swmc_install_from_vsix.png?v=1782964490\u0026width=2400","width":1890,"height":844},{"base":"swmc_theme_picker","url":"https:\/\/leckiestein.com\/cdn\/shop\/files\/swmc_theme_picker.png?v=1782965178\u0026width=2400","width":2120,"height":1232},{"base":"swmc_language_mode","url":"https:\/\/leckiestein.com\/cdn\/shop\/files\/swmc_language_mode.png?v=1782965562\u0026width=2400","width":1460,"height":468}]
[]
[]
[]
[]