Skip to content

Syntax highlighting fails with 'less than' symbol #75

Description

@WORMSS

Describe the bug
If there is an if statement with a less than < or less than or equals <= then for everything that follows just a flat colour.

To Reproduce
Steps to reproduce the behavior:

  1. type '{if first_layer_bed_temperature[initial_tool]<=60}'
  2. Observe everything afterwards is green

Expected behavior
Syntax be correct colour

Screenshots
Image

Environment / Version:

  • OS Version: Windows 10
  • VSCode Version: 1.119.0
  • Extension Version: 0.7.7

Additional context
The extension was set to "3D printer" machine type.

Activity

  1. github-actions commented on May 13, 2026

    @github-actions

    Hello and welcome! Thanks for creating your first issue! Someone from our community will get back to you soon!

  2. added theissue type on Sep 9, 2026
  3. added this to the v0.8 milestone on Sep 9, 2026
  4. mikecentola commented on Sep 9, 2026

    @mikecentola
    Member

    Interesting. I also noticed some weird syntax highlighting in some of the gcode files I have been working with lately as well. I need to go through the syntax highlighting an see if I can reproduce some of this as well.

    Can you paste some actual code from this or attach a text file so I can diagnose?

  5. WORMSS commented on Sep 10, 2026

    @WORMSS
    Author
    M17 ; enable steppers
    M862.1 P[nozzle_diameter] A{(filament_abrasive[0] ? 1 : 0)} F{(nozzle_high_flow[0] ? 1 : 0)} ; nozzle check
    M862.3 P "COREONE" ; printer model check
    M862.5 P2 ; g-code level check
    M862.6 P"Input shaper" ; FW feature check
    M115 U6.8.1+16182
    
    M555 X{(min(print_bed_max[0], first_layer_print_min[0] + 32) - 32)} Y{(max(0, first_layer_print_min[1]) - 4)} W{((min(print_bed_max[0], max(first_layer_print_min[0] + 32, first_layer_print_max[0])))) - ((min(print_bed_max[0], first_layer_print_min[0] + 32) - 32))} H{((first_layer_print_max[1])) - ((max(0, first_layer_print_min[1]) - 4))}
    
    G90 ; use absolute coordinates
    M83 ; extruder relative mode
    
    {if chamber_minimal_temperature[initial_tool]!=0}
    M140 S115 ; set bed temp for chamber heating
    {else}
    M140 S[first_layer_bed_temperature] ; set bed temp
    {endif}
    
    M109 R{((filament_notes[0]=~/.*MBL160.*/) ? 160 : (filament_notes[0]=~/.*HT_MBL10.*/) ? (first_layer_temperature[0] - 10) : (filament_type[0] == "PC" or filament_type[0] == "PA") ? (first_layer_temperature[0] - 25) : (filament_type[0] == "FLEX") ? 210 : 170)} ; wait for temp
    
    M84 E ; turn off E motor
    
    G28 ; home all without mesh bed level
    
    {if chamber_minimal_temperature[initial_tool]!=0}
    ; Min chamber temp section
    M104 S{idle_temperature[initial_tool]} ; set idle temp
    G1 Z10 F720 ; set bed position
    G1 X242 Y-9 F4800 ; set print head position
    M191 S{chamber_minimal_temperature[initial_tool]} ; wait for minimal chamber temp
    M141 S{chamber_temperature[initial_tool]} ; set nominal chamber temp
    M107
    M140 S[first_layer_bed_temperature] ; set bed temp
    {else}
    M141 S{chamber_temperature[initial_tool]} ; set nominal chamber temp
    {endif}
    
    {if first_layer_bed_temperature[initial_tool]<=60}
    M106 S70
    {endif}
    G0 Z40 F10000
    M104 T{initial_tool} S{if is_nil(idle_temperature[initial_tool])}100{else}{idle_temperature[initial_tool]}{endif}
    M190 R[first_layer_bed_temperature] ; wait for bed temp
    M107
    
    G29 G ; absorb heat
    
    M109 R{((filament_notes[0]=~/.*MBL160.*/) ? 160 : (filament_notes[0]=~/.*HT_MBL10.*/) ? (first_layer_temperature[0] - 10) : (filament_type[0] == "PC" or filament_type[0] == "PA") ? (first_layer_temperature[0] - 25) : (filament_type[0] == "FLEX") ? 210 : 170)} ; wait for MBL temp
    
    M302 S155 ; lower cold extrusion limit to 155C
    
    {if filament_type[initial_tool]=="FLEX"}
    G1 E-4 F2400 ; retraction
    {else}
    G1 E-2 F2400 ; retraction
    {endif}
    
    M84 E ; turn off E motor
    
    G29 P9 X208 Y-2.5 W32 H4
    
    ;
    ; MBL
    ;
    M84 E ; turn off E motor
    G29 P1 ; invalidate mbl & probe print area
    G29 P1 X150 Y0 W100 H20 C ; probe near purge place
    G29 P3.2 ; interpolate mbl probes
    G29 P3.13 ; extrapolate mbl outside probe area
    G29 A ; activate mbl
    
    ; prepare for purge
    M104 S{first_layer_temperature[0]}
    G0 X249 Y-2.5 Z15 F4800 ; move away and ready for the purge
    M109 S{first_layer_temperature[0]}
    
    G92 E0
    M569 S0 E ; set spreadcycle mode for extruder
    
    M591 S0 ; disable stuck detection
    
    ;
    ; Extrude purge line
    ;
    G92 E0 ; reset extruder position
    G1 E{(filament_type[0] == "FLEX" ? 4 : 2)} F2400 ; deretraction after the initial one
    G0 E5 X235 Z0.2 F500 ; purge
    G0 X225 E4 F500 ; purge
    G0 X215 E4 F650 ; purge
    G0 X205 E4 F800 ; purge
    G0 X202 Z0.05 F8000 ; wipe, move close to the bed
    G0 X199 Z0.2 F8000 ; wipe, move quickly away from the bed
    
    M591 R ; restore stuck detection
    
    G92 E0
    M221 S100 ; set flow to 100%

    This is just some of the startup gcode coming out of Prusa Slicer.
    It seems even the github code highlighter has the same issue. But I have been using novy.vsc-gcode extension and that doesn't seem to have the same issue.

  6. mikecentola commented on Sep 10, 2026

    @mikecentola
    Member

    Ok thanks. I'll take a look at their code too and see if there's anything I can notice.

    I think once I can get the machine type selection working it'll make it a little easier since code is so vastly different from CNC machine tools and 3D printers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions