Sublime Forum

How can I create syntax highlighting packages in ST3?

#1

AFAICS AAAPackageDev does not work on ST3 yet. Any ports available?

0 Likes

SublimeTodoTxt: Todo.txt Syntax Highlighting
Creating new syntax not working STE 3
#2

You can just take the snippet they use for syntax definitions.

{ "name": "Syntax Name", "scopeName": "source.syntax_name", "fileTypes": ""], "patterns": ], "uuid": "f42f37ee-69d8-4b5b-9778-7c4b14c2f638" }

The only part that I believe is programmatically generated is the uuid. You can generate that yourself (uuid.uuid4() in the console). I use PlistJsonConverter to convert between JSON and Plist. I don’t know what else the AAAPackageDev plugin gives you, but this should at least get you started.

0 Likes

#3

Well; how can I make a package out of it then?

I’m not sure what else is needed, I never tried it. Actually I wanted to learn writing syntax files “by doing” without having to fiddle too much around Sublime Text itself, sigh…

0 Likes

#4

A “Package” is basically a directory in the Packages folder with “stuff” in it. What “stuff” is depends on the package. It can contain snippets, key bindings, python files, syntax definitions, etc. For a syntax file, you would save the plist version of the file as <name>.tmLanguage. As a simple example, toke a look at the “Text” package. It contains two files, a syntax file and a snippet. From what you are saying, it seems like the syntax file is all you really care about right now. To view files, you can use github.com/skuroda/PackageResourceViewer so you don’t have to manually extract everything yourself.

0 Likes

#5

Ah, I see. Thank you pretty much, I’ll see if I can do something with this. :smile:

0 Likes

#6

Hello.

I have tried to change existing *.tmLanguage files in ST3.
Documentation says that files from packages folder will override ones in default package, though it is not true for build 3033. Is there a workaround or am I just doing something wrong? (I create C++.tmLanguage file in Packages/C++/).

0 Likes

#7

Create a bug report about that. I would copy the contents of the C++ package to say… “My C++” or something. Then add “C++” to the ignored packages list. You can then modify the contents of “My C++” package as you would like. Not the best workaround, but you will get the behavior you want.

0 Likes