themachinist / gcode-syntax-highlighting

Syntax Definition for Sublime Text that provides highlighting for G code (ISO 6983, DIN 66025, RS-274)
17 stars 13 forks source link

Whole commented lines in green #2

Open fotomas opened 9 years ago

fotomas commented 9 years ago

It is a bit difficult to distinguish commented lines (starting with semicolon) from live lines. I suggest that the commented lines are in one one color that differs from all the other colors. Preferably green. The fact that M-commands are highlighted in in commented lines are bit confusing.

themachinist commented 9 years ago

Hi! Thanks for opening this issue. Could you share which color scheme you are using?

Manouchehri commented 9 years ago

Uploading a screenshot would also help a lot.

fotomas commented 9 years ago

sublime

Also Coloring G-Codes the same way as with M-Codes would be helpful for me. As of now the are to anonymous.

creyc commented 9 years ago

@fotomas it looks like you're using the Monokai color scheme, I get the same result here.

This syntax seems to work a lot better with the Cobalt color scheme.

themachinist commented 9 years ago

Hi guys. I apologize for the delay in getting out an update. Just wanted to state that I am aware of the issue and there are some updates in process that address the issue. My semester is over in May and I will have some free time then. In the mean time feel free to make a push request. Thanks for your patience.

digex commented 9 years ago

I adapted plugin for use with the theme Monokai extended 2015-05-28 13-32-26 Unpack zip in %appdata%\Sublime Text 3\Packages\ , then select View-Syntax-CNC

Work best with Fanuc Oi. For best use without file extensions, install plugin ApplySyntax and put this code in "default_syntaxes" section file ApplySyntax.sublime-settings ==> Preferences - Package settings - ApplySyntax - Settings-User

        {
            "name": "CNC/CNC",
            "match": "all",
            "rules": [
                {"contains": "(G0)|(M30)"},
                {"contains": "(O)"}
            ]
        },

ZIP - https://yadi.sk/d/VcV-Am7ogvMCp

ElectricRCAircraftGuy commented 2 years ago

Any update on this? I'd love to see comment syntax highlighting working too. Many thanks.

themachinist commented 2 years ago

I didn't realize anyone was still using this and I was surprised to find it in the package manager a few days ago. It's been years since I maintained this project, but I am using it again so I will take a look into this issue over the next couple of weeks.

ElectricRCAircraftGuy commented 2 years ago

@themachinist , yeah, people are definitely still using it. It's the only gcode syntax highlighter available in the Package Manager for Sublime Text. You've got 8000 downloads, with 2 to 6 new downloads per day, every day. See the graph here. I'm getting into 3D printers and using it now, for instance, to look at gcode files to print objects.

@digex 's zip file above works pretty well, by the way. Take a look at it for some pretty useful changes.

I installed it in Sublime Text 4 in Linux Ubuntu 20.04 like this:

  1. Install the G-code Syntax Highlighting plugin like normal using the Sublime Text package Manager
  2. In Sublime Go to Preferences --> "Browse Packages...". This opens up my GUI file manager in this dir: /home/gabriel/.config/sublime-text-3/Packages
  3. In this Packages dir, create another dir named G-code Syntax Highlighting.
  4. Extract @digex 's "cnc" zip into this dir.
  5. Now, in Sublime Text, I automatically see it as an option in the list of syntax highlighters: image

Comparison of the syntax highlighting:

This is a Marlin g-code file generated by the Cura 3D printer slicer engine.

The G-code syntax highlighting, provided by this repo in its current state, is on the left, and the syntax highlighting provided by @digex's zip file above is on the right. It looks much better. This is in Sublime Text 4 (build 4126), with Monokai, from Sublime Text 3, selected as the color theme:

image

ElectricRCAircraftGuy commented 2 years ago

I've completed my brand new gcode syntax highlighter. It adds highlighting for comments, and makes many other improvements too. I've opened a PR to add it to Sublime's Package Control package too. If anyone would like to use it meanwhile, manual installation instructions are in the main readme: https://github.com/ElectricRCAircraftGuy/sublime_gcode

Bit thanks to @themachinist for paving the way on this syntax highlighter. Without his work I would not have know where to begin with this, as it was a very large undertaking for me to figure out this past weekend and each evening up to now.

Screenshots: