Home Download Buy Blog Forum Support

Define a symbol in new syntax definition

Define a symbol in new syntax definition

Postby Adagioklez on Fri Mar 11, 2011 10:04 pm

I will just post it as a clean question:

How can I define a symbol in a syntax definition?

For instance I would like a variable to be a symbol, right now my definition is as follows:

{ "match": "(dcl)(\\s*)([A-Za-z0-9_]*)(\\s*)(.*)",
"name": "variable.parameter.pli",
"captures": {
"1": { "name": "variable.parameter.pli" },
"3": { "name": "entity.name.function.pli" },
"5": { "name": "string.pli" }
},
"comment": "Markup of dcl statements"
}

And I would like "3" to be marked as a symbol.

Really hoping people can help.

Regards Stefan
Adagioklez
 
Posts: 15
Joined: Fri Feb 25, 2011 1:03 pm

Re: Define a symbol in new syntax definition

Postby Adagioklez on Sat Mar 12, 2011 11:34 am

I guess it should be possible, because for instance in Java all class and method definitions is shown as a symbol
Adagioklez
 
Posts: 15
Joined: Fri Feb 25, 2011 1:03 pm

Re: Define a symbol in new syntax definition

Postby jps on Sat Mar 12, 2011 12:14 pm

This is done via .tmPreferences files that identify specific scope names as defining symbols. For a simple example, take a look at Packages/Java/Symbol List Classes.tmPreferences. This declares that any scopes matching the "source.java meta.class meta.class.identifier" selector should appear in the symbol list.

The name of the .tmPreferences file isn't important, they'll all be scanned based on extension.
jps
Site Admin
 
Posts: 3062
Joined: Wed Mar 19, 2008 12:33 pm

Re: Define a symbol in new syntax definition

Postby Adagioklez on Sat Mar 12, 2011 12:55 pm

I will look into it, thanks for telling me where to look:)
Adagioklez
 
Posts: 15
Joined: Fri Feb 25, 2011 1:03 pm


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 24 guests