Using VS Code
SysCAD provides an extension package that can be used within Microsoft VS Code Editor for syntax highlight and automatic code snippets. Both SysCAD Control Program files - PGM and MP are supported in this extension. This is an alternative to Notepad++. Available from Build 139.32530.
VS Code is a rich and versatile code editor (see https://code.visualstudio.com/) offering many features and extensions supporting a large number of code languages, themes, add-ons, git integration, etc. SysCAD PGM files can now be edited and managed directly from VS Code.
- The following instructions are valid for VS Code version 1.72.0 or newer
- Please download the latest version of VS Code from https://code.visualstudio.com/Download
SysCAD PGM VS Code Extension Features
VS Code is a feature rich editor, highly customisable and always adding more functionality thanks to its modular extension-based and community driven architecture. It would be impossible to list all the features and benefits of using VS Code as editor for SysCAD PGM language. However, some specific features included in the SysCAD-PGM extension are:
- Language grammar syntax highlight: automatic colouring of recognised tokens: variable types, functions, comments, etc.
- Code snippets for multiple functions: if, if-else, while statements, etc.
- Auto-complete for SysCAD keywords and functions
- Selectable colouring theme and overall look and feel, typical Light and Dark themes but many more are available to be added.
For example, the default Dark+ and Light+ Themes are shown below:
Syntax Highlighting and Themes
Installing SysCAD PGM VSCode Extension
Step 1: Install MS Visual Studio Code
If you have not installed VSCode already, please download and install from: https://code.visualstudio.com/Download.
Step 2: Install SysCAD PGM language VS Code Extension
SysCAD PGM language extension is included with SysCAD distribution as a compiled vsix file: syscad-pgm-X.X.X.vsix
The default location of the installation script for the VSCode extension is here: C:\SysCADxxx\Setup\VSCode_PGM_Extension\
This might vary depending on where your local copy of SysCAD was installed, therefore look for the \Setup\VSCode_PGM_Extension\ folder in your local installation.
- Double click on the SysCAD PGM extension installation script: syscad-pgm.cmd
- Open VSCode and verify that the extension has been installed successfully
Alternatively, the extension can be installed manually by:
- Opening a windows command prompt (Start / Command)
- Navigating to the folder where the extension (vsix file) is saved. For example by typing: cd C:\SysCAD139\Setup\Setup\VSCode_PGM_Extension
- Run the following command: code --install-extension syscad-pgm-1.0.0.vsix
Note: This assumes the name of the extension is for version 1.0.0, replace the correct name as needed.
Step 3: Set VSCode as default editor in SysCAD
- Open SysCAD General Options and set VSCode as the default PGM editor:
Note: VS Code is normally installed in your local user account. Make sure to specify the correct user name.
- Click on Select, next to the path for PGM or Text editors and select the default (Code) or your preferred editor. SysCAD will attempt to autodetect the correct path for editors that are installed in your system.
Customising SysCAD PGM VSCode Extension
Changing Colouring Theme
Change VS Code theme colouring by selecting: File / Preferences / Theme / Color Theme or type Ctrl+K Ctrl+T and select the Theme of your choice. We recommend use of "Dark+".
Enabling / Disable Code Snippets
To disable/enable code snippets
- Open a SysCAD-PGM file
- Open the command palette: View / Command Palette or press F1
- Type: Insert Snippet and press enter
- Select a snippet from the list or start typing the name of the snippet
- Click on the eye icon next to the snippet to make it hidden.
Problems installing SysCAD-PGM Extension
Depending on your environment or previously installed version of VSCode or even previously installed SysCAD-PGM extensions, there might be situations where the extension is not automatically installed.
To view the detailed log and result of the installation script, do the following:
- Make sure you have the latest Syscad-PGM extension distribution file
- In a Windows File Explorer window, navigate to the folder where the extension and the installation script are saved. For example: 'C:\SysCAD139\Setup\Setup\VSCode_PGM_Extension
- Run the verbose installation script by double click on: syscad-pgm-verbose.cmd
You will see the output of the script, finalising with and Exit code, as shown above.
If the Exit code is different from 0, then the SysCAD-PGM extension was not installed. Here is a list of exit codes and the reason why the installation did not proceeded:
|VS Code is not installed
|Check if VS Code is installed. if not, please install
|VS Code version incompatible
|Minimum VS Code required is 1.72.0, please update
|VS Code version could not be determined
|Check minimum VS Code version and update if necessary
|SysCAD-PGM extension file (.vsix) not found
|Make sure extension file is saved in the same folder as installation script
|SysCAD-PGM extension could not be installed by VS Code
|Try to install extension manually and look at the error messages
|An earlier or equal version of SysCAD-PGM extension already installed
|This is a warning only. If necessary to install an older version of the SysCAD-PGM extension, please install it manually
|VS Code is not installed
|This is a warning only. This exit code is issued when --help option is used and only usage options are displayed
For more options using the installation script, do the following:
- Open a Windos Command Line Terminal (Start menu and type cmd) and navigate to the folder where the extension and the installation script are saved. For example: 'cd C:\SysCAD139\Setup\Setup\VSCode_PGM_Extension
- Run the installation script with the following option: syscad-pgm.cmd --help