Syntax highlighting for Sublime Text 4

Hey people,

I’ve put together a syntax definition file for Sublime and GP Script. Hope it’s of use to some of you!

These are the steps to install it:

  • in Sublime Text, pull down the main app menu and move down to Preferences. In the flyout menu, select Browse packages…
  • a Finder window should appear
  • if it’s not already there, create a folder called ‘User’ at this location
  • remove the .txt extension from the filename (it’s only there to allow me to upload it here) then
  • drop the attached .sublime-syntax file in the User folder

GP Script files should now automatically get highlighted correctly.

Let me know if you have any issues - or if you want to suggest changes. Note that the colours you see are driven by your selected colour theme and not by the syntax definition itself.

I’m going to start work on a VS Code version next.

gpscript.sublime-syntax.txt (11.2 KB)

5 Likes

@alucid, thanks, it wolud be a good extensions, but it did not work for me.
Cannot change in the lower left corner to gpscript, because there is no itme “gpscript”.

Do you mean bottom right where you can select the syntax highlighting to use?

Firstly, Sublime should automatically apply it to a file with a .gpscript extension.

Secondly, it should be listed as ‘GP Script’.

If you are not seeing it there can I get you to confirm that you removed the .txt extenstion and perhaps also indicate which folder you put it in? On my system it is in /Users/username/Library/Application Support/Sublime Text 3/Packages/User

Ah, you’re going to force me to have to buy this now :wink:

I’ve been using vs code for most things.

EDIT: maybe I should read the whole post before replying! Looking forward to it!

1 Like

yes

removed .txt, yes
…folder:
~/Library/Application Support/Sublime Text\ 3/Packages/User/gpscript.sublime-syntax

That’s puzzling. I got a friend to install it with the same instructions before I posted it and it worked fine. He knows nothing about GP or GP Script - nor has he ever developed a syntax definition file. He probably has Package Control installed and he’s probably on a similar version to me Sublime Text 4, Build 4113).

Wait, are you on version 4?

I notice that the folder is still called Sublime Text 3 even for version 4.

I had no issues installing it on MacOS with Sublime Text 4 using the instructions (going via Preferences > Browse Packages).

The folder path for me was ~/Library/Application Support/Sublime Text/Packages/User

Hmm, I just tried it — I was able to select GP Script as the syntax but when I typed in a simple GP Script, the only thing that got highlighted was the word “integer”
See attached

screenshot_5265

Did you try switching colour scheme to see if that highlights other things?

I tried a couple of built in ones and they worked ok.

Odd this doesn’t Just Work™️

image

image

Yeah, it worked with some of the dark schemes but I never use those — I use light backgrounds.
Your second example does not really highlight some of the keywords but it may very well be a function of the color scheme.

In any case, thanks so much for doing this

screenshot_5266

I’ll have another go with lighter colour schemes. I’m the opposite! I only use dark ones these days so I didn’t even try any lighter ones.

By the way, VS Code’s syntax stuff was harder to get started with but is actually a better implementation. Ah, well. I’m a confirmed Sublime user still…

I use sublime for quick/n/dirty edits but I’ve moved totally to VS Code for anything more serious.