Home Download Buy Blog Forum Support

How to create indentation and commenting rules for syntax

How to create indentation and commenting rules for syntax

Postby Zinders on Wed May 07, 2014 12:16 am

I've successfully created a custom syntax definition which does color highlighting of specific keywords. Now I'd like to make specific indentation rules and commenting rules.

For instance, if you hit "cntrl-/" it is supposed to comment that line out. Well in my custom definition it doesn't. So how do I explain that command should put a "!" at the beginning of the selected line to make it a comment?

Also, there are certain keywords that when I type them I want the cursor to automatically indent on the next line. Similar to how and "if" statement auto indents the next line on a built in programming language syntax. How can I accomplish that?
Zinders
 
Posts: 3
Joined: Wed May 07, 2014 12:12 am

Re: How to create indentation and commenting rules for syntax

Postby Zinders on Thu May 08, 2014 11:26 pm

Since I'm a paying user and aren't getting a response on this, is there a better way to get help?
Zinders
 
Posts: 3
Joined: Wed May 07, 2014 12:12 am

Re: How to create indentation and commenting rules for syntax

Postby facelessuser on Thu May 08, 2014 11:35 pm

Since I'm a paying user and aren't getting a response on this, is there a better way to get help?

Reverse engineer how the syntax packages work. That is the way most have done it here. The other way is to get lucky when the right person sees your thread and has time to answer.

For instance, if you hit "cntrl-/" it is supposed to comment that line out. Well in my custom definition it doesn't. So how do I explain that command should put a "!" at the beginning of the selected line to make it a comment?

This I can help with. Comment rules are found in Comment.tmPreferences files. So here is an example where I wanted to use the "::" commenting conventions in batch files: https://github.com/facelessuser/sublime ... references.

Take a look at other packages to see more examples. Hope that helps.
facelessuser
 
Posts: 1576
Joined: Tue Apr 05, 2011 7:38 pm

Re: How to create indentation and commenting rules for syntax

Postby Zinders on Fri May 09, 2014 12:48 am

Faceless, thanks. I was able to reverse engineer your file to get a comment going the way I wanted. For some reason I was expecting to create a json file and do the whole build system thing. I didn't realize you can modify XML files and just change a few things. I have no idea what the UUID needs to be set to. I just made up something and it seems to work.

SublimeText support, Please document how I'm really supposed to do this. Thank you.
Zinders
 
Posts: 3
Joined: Wed May 07, 2014 12:12 am


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot], Yahoo [Bot] and 24 guests