Giter Club home page Giter Club logo

vscode-gcode's Introduction


icon


The premier Visual Studio Code extension for G-Code


Visual Studio Marketplace Version Visual Studio Marketplace Installs Visual Studio Marketplace Rating

โœจ Features

Adaptive Syntax Highlighting

Ctrl+Shift+P >G-Code: Adapt to current theme

icon

CAD/CAM packages typically show the X-axis in red, the Y-axis in green, and the Z-Axis in blue. The G-Code extension follows that pattern. The adaptive syntax feature allows you to choose any of the supproted themes and get that familiar colorization. G-Code supports all of the themes that ship with VS Code, plus the GitHub theme and OneDark-Pro.

  • When VS Code starts and the extension activates, it will check the active theme and if the extension's syntax highlighting isn't already tailored to that theme, you will be prompted to allow the extension to rewrite the files that style the code.

  • Should you miss the prompt, you can use the G-Code: Adapt to current theme command to force the extension to adapt to the theme you're using (as long as it's supported).

Build your own dictionary

icon

You no longer need to memorize dozens of obscure G and M codes! The G-Code extension includes a mechanism for you to provide your own definitions for any number of codes. Definitions can even be provided inline with the code.

Using VS Code settings

Share definitions across multiple programs using VS Code's settings files. Take a look at VS Code Docs - User and Workspace Settings if you're not familiar VS Code configuration.

You need to add a gcode.definitions key to your settings.json file (user settings, workspace settings, or both). Here's an example of what it might look like:

"gcode.definitions": {
    "G90": "Positioning, absolute (modal)",
    "G91": "Positioning, relative (modal)",
    "M8": "Coolant On, External to Spindle",
    "M9": "Coolant Off",
    "M51": "Coolant On, Internal to Spindle",
}

Using inline definitions

An inline definition is a comment in your code that matches the following format. An inline definition has a code and a meaning seperated by : or =. There may be whitespace on either side of the seperator. The text on the right side of the seperator will show up as hover text in that file. See some examples of inline definitions below.

Note that after you add inline definitions to a file, they won't show up in a hover until the file is saved. This prevents the extension from needing to continuously scan your file for definitions.

Examples of inline definitions:

(G4:DWELL)
(G4: THIS IS A DWELL)
(G4 = DWELL, USE P TO SPECIFY TIME)

A word on leading zeros

When providing definitions, regardless of which method you use, don't use leading zeros. Provide a definition for G1 not G01. When you hover over a code like G01 the extension ignores the leading zero and returns a definition for G1.

Using the dictionary

Ctrl+Shift+P >G-Code: Show the dictionary

icon

You can use the command, G-Code: Show the dictionary, to get the definitions on screen, so you can see them alongside your code as you work. You can also see the definition for a particular code just by hovering over it.

Line Numbering

Ctrl+Shift+P >G-Code: Line Numbers (Add/Update)

Ctrl+Shift+P >G-Code: Line Numbers (Remove)

icon

Addding, updating, or removing line numbers are not tasks you should ever need to do manually. A robust G-Code editor should make this easy as possible so you can focus on more important things. The G-Code extension provides commands to carry out these tasks on the active file. Don't forget that you can map commands to a keyboard shortcut of your choice. See Key Bindings for Visual Studio Code.

Toggle Comments

Ctrl+Shift+P >G-Code: Toggle Comment

icon

VS Code ships with the ability to toggle comments. The built-in feature works by modifying one or more characters at the beginning of each selected line. Since it only affects the beginning of the line, it doesn't work for G-Code comments that need to be (in parentheses). The G-Code extension provides a command that will toggle parentheses at the start and end of each selected line.

๐Ÿ““ Release Notes

Documentation pertaining to a specific release can be found under releases, or in the project's changelog.

๐Ÿ’ป Developers

VS Code Token Styles

Early on I realized I needed a way to see how each VS Code theme styles the various language tokens. My approach was to get data for each theme by using the Developer: Generate Color Theme From Current Settings command then use that data to render HTML. Since that work may be intersting outside of this project, I chose to save it in this gist.

Automated Deployment

Maintainers, here's how to publish the extension to the marketplace:

  1. Put the new version number in package.json. The version number must be higher than the version shown in the marketplace. Reference semver.org.
  2. Create an entry in the changelog. Reference keepachangelog.com.
  3. Push a new tag with the version number. The tag must start with a 'v', like this: v1.2.3.

As long as these requirements are met, the CD workflow should go smoothly. A release will be created, and the new version of the extension will be published to the marketplace (see ./github/workflows).

vscode-gcode's People

Contributors

scottmwyant avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

vscode-gcode's Issues

M-Code-Definitions with "="

Hello,

first I want to thank you for the time, you spent making this awesome VS-Code Extension. I really like it.
My Problem is, that my CNC-machine has some M-Codes, that i can't process normally.
For example, M4=3 means "spindle start, Main spindle, clockwise" whereas M3=3 means "spindle start, counterspindle, clockwise"
There is a whole bunch of these special M-Codes my machine ist using.
At the moment i am not able to use these definitions, even if i write them into the settings.json-file, because i think he stops at the "="-symbol and doesn't read further. It seems it is all just M4 or M3 for the program.
Unfortunately I am not a programmer, so I would like to ask you for your help. Is there a solution to this problem.
Thank you very much in advance and have a nice day.

Best regards

Ben

Feature request: Allow permanent display of on-hover information

I'm very new to g-code, and the on-hover information is fantastic and indispensable. It would be even better if we could always display the information on the same line after the line ends. I'm not sure if you've used IntelliJ, but that IDE presents information in that way often. I think it would make this plugin even better.

Thanks so much for the excellent plugin!

Line Number Commands

I'm getting an error trying to use the line number commands. both .addlinenumbers and .removelinenumbers produces an error and no changes are made. not sure if this is enough information for you, let me know if i can be more specific.

Hover Not Working

I recently added the G-code extension to Visual Studio code and see that it has the capability for G and M-code descriptions with a cursor hover. I am not able to get that to work. I am using v0.2.1. Please advise.

I tried adding the g-code definitions into the settings.json file as instructed. That did not change the result. See image below.
image

I would also like some guidance on how to add to the G-code Dictionary.
image

saving files as .TXT .TAP or .NC

How do we get this to save the files as .txt or .Tap and maintain all teh benefits of this wonderful G code viewer and editor. Whenever I enter the file in a format that my mach4 accepts it doesn't give me color coding or any of the benefits of using this extension. Thanks for this extension. Will save me a ton of time numbering the lines when I have to edit visually looking for a color to find things like Z X or Y also a tremendous time saver. THANKS.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.