Syntax highlighting for VS Code

This is a syntax highlighting extension for VS Code.

You can install it thusly:

  • Make sure you can run code from the command line
  • For Mac users you may need to look here: Running Visual Studio Code on macOS
  • Download the extension, remove .txt from the end, and from the same directory run code --install-extension gpscript-0.0.1.vsix
  • Restart VS Code

If you have any issues or suggestions let me know!

gpscript-0.0.1.vsix.txt (7.5 KB)


Working well, thanks for doing this :+1:
On Mac I could just drag and drop the vsix file onto the Extensions left pane to install it.

My wish list is for the functions to be listed in the ‘Outline’ panel. Any ideas how/if this could work?

I don’t use VS Code myself so I’ll have to explore that bit some more!

I’ll see what I can do.

1 Like

On Win10, delete the “.txt” filetype, open VSCode, click on the Extensions icon to open the Extensions pane, then click on the 3 dots in the upper right corner of the pane and select “Install from VSIX”, then select the gpscript vsix file.

EDIT: When I paste a GPScript copied from the User scripts subforum, I’m getting no highlighting at all. [sigh]

Sorry to hear you are having issues. VS Code seems to be smart enough to detect the language even of a pasted in bit of code. It certainly does for me with GP Script, JavaScript and Ruby. I’m not a VS Code and I wasn’t expecting it to do that but it’s cool that it does.

Can you try either selecting GP Script from the list at the bottom right of the screen? Or saving it as a file with the extension .gpscript?

Does that work?

Did you restart the VS Code first?

That should kick in the syntax highlighting for you.

Once I selected GPScript as the language, the syntax highlighting worked great. I shouldn’t be trying new things before sunrise. Thanks. At least I can now confirm that VS Code doesn’t read minds. :nerd_face: