Home Download Buy Blog Forum Support

How can I create syntax highlighting packages in ST3?

How can I create syntax highlighting packages in ST3?

Postby tux. on Tue May 07, 2013 6:58 pm

AFAICS AAAPackageDev does not work on ST3 yet. Any ports available?
Image
tux.
 
Posts: 122
Joined: Thu Apr 14, 2011 11:04 am

Re: How can I create syntax highlighting packages in ST3?

Postby skuroda on Tue May 07, 2013 10:45 pm

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

Code: Select all
{ "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.
skuroda
 
Posts: 687
Joined: Fri Oct 05, 2012 8:11 am

Re: How can I create syntax highlighting packages in ST3?

Postby tux. on Tue May 07, 2013 11:00 pm

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...
Image
tux.
 
Posts: 122
Joined: Thu Apr 14, 2011 11:04 am

Re: How can I create syntax highlighting packages in ST3?

Postby skuroda on Tue May 07, 2013 11:42 pm

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 https://github.com/skuroda/PackageResourceViewer so you don't have to manually extract everything yourself.
skuroda
 
Posts: 687
Joined: Fri Oct 05, 2012 8:11 am

Re: How can I create syntax highlighting packages in ST3?

Postby tux. on Tue May 07, 2013 11:58 pm

Ah, I see. Thank you pretty much, I'll see if I can do something with this. :)
Image
tux.
 
Posts: 122
Joined: Thu Apr 14, 2011 11:04 am

Re: How can I create syntax highlighting packages in ST3?

Postby GeniusIsme on Fri May 17, 2013 12:59 pm

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++/).
GeniusIsme
 
Posts: 5
Joined: Tue Nov 13, 2012 12:25 pm

Re: How can I create syntax highlighting packages in ST3?

Postby skuroda on Fri May 17, 2013 4:31 pm

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.
skuroda
 
Posts: 687
Joined: Fri Oct 05, 2012 8:11 am


Return to Technical Support

Who is online

Users browsing this forum: Yahoo [Bot] and 16 guests