Sublime Forum

Enabling 'Goto Anything' in custom packages eg powershell

#1

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]<?xml version="1.0" encoding="UTF-8"?>

name Symbol List scope source.python meta.function.python, source.python meta.class.python settings showInSymbolList 1 symbolTransformation 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; uuid 005BE156-8D74-4036-AF38-283708645115 [/code]

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.

0 Likes