Sublime Forum

Symbol definition help is needed

#1

on 20091023 beta there is support for symbol definition, well, i have tried to implement one for erlang functions.

i get trouble with the following issue, on erlang a function name and its arguments can be defined several times (it acts like switch-case on C/C++). the symbol definition i use is:

[code]<?xml version="1.0" encoding="UTF-8"?>

name Symbol List Function scope source.erlang entity.name.function.definition.erlang, source.erlang meta.expression.parenthesized settings showInSymbolList 1 symbolTransformation s/^\s*\(/"" \(/g; # repeat function head s/^/• /g; # bullets uuid 3CEA49B2-A5C5-405C-82E2-B8B668877C39 [/code]

look at the 1st transformation (repeat function head). it partially solves what i try to describe here, but here it goes. see an example for function definition:

where({key, 1}) -> here; where({key, 2}) -> there; where({key, _}) -> here.

the scope definition starts with ‘source.erlang entity.name.function.definition.erlang’ but it hits only once on the first, the other ‘where’ are not defined as ‘entity.name.function.definition.erlang’. atm, i get the following result on ctrl+R:

• where({key, 1}) • "" ({key, 2}) • "" ({key, _})

hmmf, too long to describe, but, is there i way i can use value of one of the previous used symbols for the current?

0 Likes

#2

i guess that was too much…

anyway i found this: svn.textmate.org/trunk/Bundles/E … eferences/

and in it, this:

[code]<?xml version="1.0" encoding="UTF-8"?>

name Symbol Overrides scope source.erlang entity.name.function, source.erlang entity.name.type.class settings showInSymbolList 0 uuid AE84FFDF-2D5A-4331-A301-6CF34CF26CD8 [/code]

do you know what the showInSymbolList=0 means? because it seems not to work (if i add this file to sublime all the symbols are gone)

0 Likes

#3

Using this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>name</key>
	<string>Function Symbols</string>
	<key>scope</key>
	<string>source.erlang entity.name.function.definition</string>
	<key>settings</key>
	<dict>
		<key>showInSymbolList</key>
		<integer>1</integer>
		<key>symbolTransformation</key>
		<string>s,$,/,</string>
	</dict>
	<key>uuid</key>
	<string>7D7FE91B-0543-4F95-8D99-AF393226415C</string>
</dict>
</plist>

Then at least for the snippet you provided, only the first line appears. You’re getting the other lines because of the “source.erlang meta.expression.parenthesized” part of the scope selector in your version.

showInSymbolList=0 simply prevents the names scopes from appearing in the symbol list.

0 Likes