I use the Goto Symbol panel often, but I’d love to be able to filter out certain items from the result set (particularly lambda functions in Python). Is there an easy way to do that?
Can I filter items from the Goto Symbol panel?
Python lambda functions don’t appear in Goto Symbol by default as far as I can see (on Build 3118) - are you using a non-standard Python syntax definition? or maybe you have overridden the Symbol List.tmPreferences
file in the Python package or something?
The only package that has a Symbol List.tmPreferences
file in my install is PlainTasks, and it doesn’t appear to be Python specific. How would I know if I’m using a non-standard Python syntax definition?
I should probably mention that I’m on build 3114.
Ah yeah, I can see that 3114 indexes lambda functions. To change this functionality:
- Install PackageResourceViewer from Package Control, if it isn’t installed already
- Open the Command Palette
- Type
PRV: O
and selectPackageResourceViewer: Open Resource
- Navigate to
Python
Symbol List.tmPreferences
- Change
<string>source.python meta.function - meta.function.decorator, source.python meta.class</string>
to<string>source.python meta.function - meta.function.decorator - meta.function.inline, source.python meta.class</string>
- Save the file
and lambda functions will no longer show in Goto Symbol
Note: when you upgrade to a newer version of ST3, I recommend deleting the override file you just created, so that you will use the official version of the file, which will contain this change. To do this:
-
Tools
->Browse Packages
-
Python
folder - Delete
Symbol List.tmPreferences
You mention that the official package will contain this change going forward. Are you filing a bug against the package repo for that, or should I?
There is no need to file a bug report - it is already fixed and available in build 3118: https://github.com/sublimehq/Packages/commit/d180a788d77ba418d5b8a91fb49a53bfce73ee02