Home Download Buy Blog Forum Support

Enabling 'Goto Anything' in custom packages eg powershell

Enabling 'Goto Anything' in custom packages eg powershell

Postby SteveCooperOrg on Fri Feb 04, 2011 11:45 am

If you want to enable 'Goto Anything' in Sublime Text 2 for custom languages, it's fairly easy. You need to add a file called 'Symbol List.tmPreferences' to the package. This needs to be configured to contain the scopes you want to see in the symbol list. Here's the Symbol List.tmPreferences file for python;

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</string>
   <key>scope</key>
   <!-- CHANGE HERE -->
   <string>source.python meta.function.python, source.python meta.class.python</string>
   <key>settings</key>
   <dict>
      <key>showInSymbolList</key>
      <integer>1</integer>
      <key>symbolTransformation</key>
      <string>
      s/class\s+([A-Za-z_][A-Za-z0-9_]*.+?\)?)(\:|$)/$1/g;
      s/def\s+([A-Za-z_][A-Za-z0-9_]*\()(?:(.{0,40}?\))|((.{40}).+?\)))(\:)/$1(?2:$2)(?3:$4…\))/g;
   </string>
   </dict>
   <key>uuid</key>
   <string>005BE156-8D74-4036-AF38-283708645115</string>
</dict>
</plist>


Note the list of scopes. For you own language, just change this.

I've updated the powershell package in the community packages repo, and you can now do '.ps1@my-function' to select function definitions in powershell files.
Maybe what you're looking for is at the http://www.sublimetextwiki.com
SteveCooperOrg
 
Posts: 193
Joined: Thu Mar 20, 2008 9:53 am

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 1 guest