Home Download Buy Blog Forum Support

Symbol definition help is needed

Symbol definition help is needed

Postby vim on Fri Oct 23, 2009 3:15 pm

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: Select all
<?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>Symbol List Function</string>
   <key>scope</key>
   <string>source.erlang entity.name.function.definition.erlang, source.erlang meta.expression.parenthesized</string>
   <key>settings</key>
   <dict>
      <key>showInSymbolList</key>
      <string>1</string>
      <key>symbolTransformation</key>
      <string>
      s/^\s*\(/"" \(/g; # repeat function head
      s/^/• /g; # bullets</string>   
   </dict>
   <key>uuid</key>
   <string>3CEA49B2-A5C5-405C-82E2-B8B668877C39</string>
</dict>
</plist>


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:
Code: Select all
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:
Code: Select all
• 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?
vim
 
Posts: 298
Joined: Tue May 27, 2008 6:51 pm

Re: Symbol definition help is needed

Postby vim on Fri Oct 23, 2009 9:57 pm

i guess that was too much...

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

and in it, this:
Code: Select all
<?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>Symbol Overrides</string>
   <key>scope</key>
   <string>source.erlang entity.name.function, source.erlang entity.name.type.class</string>
   <key>settings</key>
   <dict>
      <key>showInSymbolList</key>
      <string>0</string>
   </dict>
   <key>uuid</key>
   <string>AE84FFDF-2D5A-4331-A301-6CF34CF26CD8</string>
</dict>
</plist>


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)
vim
 
Posts: 298
Joined: Tue May 27, 2008 6:51 pm

Re: Symbol definition help is needed

Postby jps on Sat Oct 24, 2009 12:49 pm

Using this:

Code: Select all
<?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.
jps
Site Admin
 
Posts: 3058
Joined: Wed Mar 19, 2008 12:33 pm


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 25 guests

cron