Syntax highlighting for VS Code - updated for 4.8.2

[ look further down for the updated version ]

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)

8 Likes

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]

1 Like

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:

Here is a version of the syntax highlighting extension for VS Code, updated for 4.7.0.

You can install it using these steps:

  • 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 and remove .txt from the end
  • From the same directory as the extension run: code --install-extension gpscript-4.7.0.vsix
  • Restart VS Code

On Mac you can also simply drag and drop the renamed vsix file to the Extensions panel within VS Code.

On Windows you can probably 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 renamed vsix file.

If you have any issues or suggestions let me know!

gpscript-4.7.0.vsix.txt (54.5 KB)

7 Likes

Thanks. How can I verify that the update happened? The extension still shows v0.0.1 and the extension notes show a date of 2021-10-11.

I’ve fixed the version number now. Sorry about that! The date should be 2023-10-22, 17:31:38.

If you have the older version and you are in any doubt, just delete the old one and re-install the new one.

3 Likes

Here is a version of the syntax highlighting extension for VS Code, updated for 4.8.2.

You can install it using these steps:

  • 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 and remove .txt from the end
  • From the same directory as the extension run: code --install-extension gpscript-4.8.2.vsix
  • Restart VS Code

On Mac you can also simply drag and drop the renamed vsix file to the Extensions panel within VS Code.

On Windows you should be able to 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 renamed vsix file.

If you have any issues or suggestions let me know!

gpscript-4.8.2.vsix.txt (8.1 KB)

6 Likes

For a clean install of VS Code, do I need to install the v4.7.0 file first, and then the v4.8.2 file? The v4.7.0 file is 55 KB, and the v4.8.2 file is only 9 KB.

You just need the 4.8.2 version.

I have no idea why the previous one pumped up so much in size. I run the same command each time to build the extension.

2 Likes

Thanks for the clarification.

Just getting into some non trivial scripting, and this extension is the bomb!

Thanks so much for taking the time to put it together.

1 Like