Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    G-code Syntax Highlighting in Text Edit Windows

    Scheduled Pinned Locked Moved
    Duet Web Control wishlist
    6
    16
    2.0k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Phaedruxundefined
      Phaedrux Moderator
      last edited by

      For example:

      0_1552414426470_Screenshot 2019-03-12 12.12.45.png

      This is a screen shot of Atom on MacOS. It's not the greatest color scheme, but you get the idea.

      Line numbering would be nice as well.

      Z-Bot CoreXY Build | Thingiverse Profile

      1 Reply Last reply Reply Quote 0
      • Snimaxundefined
        Snimax
        last edited by Snimax

        Im using Visual Studio Code, there is an extension nc-gcode which brings syntax highlighting in a similar fashion.

        Example

        1 Reply Last reply Reply Quote 0
        • snoozerundefined
          snoozer
          last edited by

          There is also Notepad++ which has a few definitions for syntax highlighting here.

          http://docs.notepad-plus-plus.org/index.php/User_Defined_Language_Files

          Jan

          Regards Jan

          --
          My Printers:
          #1 Prusa i3 MK3 kit all stock (Retired)
          #2 Rat Rig V-Core Core-XY (Almost finished but fully usable)

          My Experiments:
          https://www.thingiverse.com/snoozer17/designs

          1 Reply Last reply Reply Quote 0
          • Phaedruxundefined
            Phaedrux Moderator
            last edited by

            Atom is using nc-gcode as well.

            NotePad++ doesn't have a Mac version sadly. Hence using Atom.

            But it would be nice to get the highlighting in the browser without having to download it.

            I had tried using FTP to interface with the Duet since it will launch your local editor to edit the files, but I was having problems with FTP uploads not actually completing even though they claimed they had. It would just result in a correctly named empty file.

            Z-Bot CoreXY Build | Thingiverse Profile

            1 Reply Last reply Reply Quote 0
            • snoozerundefined
              snoozer
              last edited by

              On a Mac you should be able to use vim/vi in a terminal, there is syntax definitions for that as well.

              Jan

              Regards Jan

              --
              My Printers:
              #1 Prusa i3 MK3 kit all stock (Retired)
              #2 Rat Rig V-Core Core-XY (Almost finished but fully usable)

              My Experiments:
              https://www.thingiverse.com/snoozer17/designs

              1 Reply Last reply Reply Quote 0
              • Phaedruxundefined
                Phaedrux Moderator
                last edited by

                Right. I have Atom for that on the Mac side. It's fine. But I'd like highlighting when I'm editing a macro live on the Duet in the DWC.

                Z-Bot CoreXY Build | Thingiverse Profile

                1 Reply Last reply Reply Quote 0
                • snoozerundefined
                  snoozer
                  last edited by

                  Oh I see, I guess that is a server side application which would require the highlighting to be implemented on the DWC end. I have not used ftp on the Duet before, just tried but have not been able to DL or UL files. Not done any troubleshooting yet.

                  Jan

                  Regards Jan

                  --
                  My Printers:
                  #1 Prusa i3 MK3 kit all stock (Retired)
                  #2 Rat Rig V-Core Core-XY (Almost finished but fully usable)

                  My Experiments:
                  https://www.thingiverse.com/snoozer17/designs

                  Phaedruxundefined 1 Reply Last reply Reply Quote 0
                  • Phaedruxundefined
                    Phaedrux Moderator @snoozer
                    last edited by

                    @snoozer You'll need to ensure the FTP client is set to only use a single concurrent connection.

                    Z-Bot CoreXY Build | Thingiverse Profile

                    1 Reply Last reply Reply Quote 0
                    • Snimaxundefined
                      Snimax
                      last edited by

                      Ah, I interperated your question as you were looking for a replacement for Atom in ms windows. Some highlighting in the web editor would be a nice feature.

                      dc42undefined 1 Reply Last reply Reply Quote 0
                      • dc42undefined
                        dc42 administrators @Snimax
                        last edited by

                        @snimax said in G-code Syntax Highlighting in Text Edit Windows:

                        Ah, I interperated your question as you were looking for a replacement for Atom in ms windows. Some highlighting in the web editor would be a nice feature.

                        This is for chrishamm to answer; however, implementing syntax highlighting is I think much harder in HTML/CSS/javascript than it is in a normal program or an app.

                        Duet WiFi hardware designer and firmware engineer
                        Please do not ask me for Duet support via PM or email, use the forum
                        http://www.escher3d.com, https://miscsolutions.wordpress.com

                        Phaedruxundefined 1 Reply Last reply Reply Quote 0
                        • snoozerundefined
                          snoozer
                          last edited by

                          I am unable to put or get files with FTP. I can log in but put and get fails with the "PORT failed" error. Usually a sign that the client needs to use passive mode or NAT is an issue yet I am in the same subnet without firewall. I am sure its off topic just here now, I have a look through the forum what I find.

                          Jan

                          Regards Jan

                          --
                          My Printers:
                          #1 Prusa i3 MK3 kit all stock (Retired)
                          #2 Rat Rig V-Core Core-XY (Almost finished but fully usable)

                          My Experiments:
                          https://www.thingiverse.com/snoozer17/designs

                          dc42undefined 1 Reply Last reply Reply Quote 0
                          • Phaedruxundefined
                            Phaedrux Moderator @dc42
                            last edited by

                            @dc42 a quick google for in browser syntax highlighting brought up a few promising options.

                            https://prismjs.com

                            Z-Bot CoreXY Build | Thingiverse Profile

                            wilrikerundefined 1 Reply Last reply Reply Quote 1
                            • dc42undefined
                              dc42 administrators @snoozer
                              last edited by

                              @snoozer said in G-code Syntax Highlighting in Text Edit Windows:

                              I am unable to put or get files with FTP. I can log in but put and get fails with the "PORT failed" error. Usually a sign that the client needs to use passive mode or NAT is an issue yet I am in the same subnet without firewall. I am sure its off topic just here now, I have a look through the forum what I find.

                              Jan

                              The FTP server in RRF only supports one connection. If your FTP client defaults to opening 2 connections, reconfigure it to use just one.

                              Duet WiFi hardware designer and firmware engineer
                              Please do not ask me for Duet support via PM or email, use the forum
                              http://www.escher3d.com, https://miscsolutions.wordpress.com

                              1 Reply Last reply Reply Quote 0
                              • wilrikerundefined
                                wilriker @Phaedrux
                                last edited by

                                @phaedrux said in G-code Syntax Highlighting in Text Edit Windows:

                                @dc42 a quick google for in browser syntax highlighting brought up a few promising options.

                                https://prismjs.com

                                Just found the same thing. It does have GCode listed as supported language and there also exists Vue Prism Editor to integrate it into the new UI based on Vue.

                                Manuel
                                Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
                                with probably always latest firmware/DWC (incl. betas or self-compiled)
                                My Tool Collection

                                1 Reply Last reply Reply Quote 1
                                • bbergerundefined
                                  bberger
                                  last edited by bberger

                                  I just created a pull request..
                                  https://github.com/chrishamm/DuetWebControl/pull/226

                                  Based on PrismJS. The only one I could find that reliably highlights gcode. Also is pretty lightweight.

                                  Needs some testing though and I also propose a UI setting to turn it on/off, but I don't have the means to translate it to all the supported languages.

                                  Doesn't do much besides syntax highlighting based on file extensions, but at least to me it's already a great help to have comments greyed out and commands/params highlighted..

                                  If there's a full tree of (maintained) RRF gcodes acailable then maybe CodeMirror could be an option for a more polished WebIDE.

                                  I also think a slight rework of the FileEditor would be helpful (custom Route instead of the Dialog so a page refresh or the back button doesn't break the Dialog), but that's a topic for another day..

                                  If there's interest I'm open to do some slight refactoring of that feature to make it work.

                                  bernhardberger opened this pull request in chrishamm/DuetWebControl

                                  closed Feature/prism #226

                                  Phaedruxundefined 1 Reply Last reply Reply Quote 1
                                  • Phaedruxundefined
                                    Phaedrux Moderator @bberger
                                    last edited by

                                    @bberger Awesome!!

                                    Z-Bot CoreXY Build | Thingiverse Profile

                                    1 Reply Last reply Reply Quote 1
                                    • First post
                                      Last post
                                    Unless otherwise noted, all forum content is licensed under CC-BY-SA