Sublime Forum

Define a symbol in new syntax definition

#1

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

0 Likes

#2

I guess it should be possible, because for instance in Java all class and method definitions is shown as a symbol

0 Likes

#3

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.

0 Likes

#4

I will look into it, thanks for telling me where to look:)

0 Likes