2

If I have a function definition which spans multiple lines to keep in with PEP8 such as this:

def compile_time_table(daily_id=999, weekly_id=999, yearly_id=999, user=None,
                      zone_id=None, zone_name=None):

Sublime Text looses its ability to fold the definition:

Sublime Text 3 not folding

Is there some way to fix this?

Andy Grey
  • 79
  • 5
  • Try `ctrl-shift-[` on the first function body line (i.e. immediately after the definition). Seems to work for me with US keyboard layout (but I prefer different layout). Link: https://stackoverflow.com/questions/41558450/sublime-text-3-multiline-method-folding – VPfB Jul 17 '20 at 12:47
  • I'm in Germany so most standard shortcuts involving [ ] / \ < > are inaccessible – Andy Grey Jul 20 '20 at 10:19
  • Yes, I know the problem with national layouts.... Anyway, shortcuts can be edited in `Preferences -> KeyBindings` if you want. – VPfB Jul 20 '20 at 12:17

1 Answers1

1

For Sublime Text 3, there is a Code Folding option in the menu where EDIT resides. Click on it and choose Code Folding. Here you can see the folding methods and shortcut keys. Use the keybord shortcuts Ctrl + K and Ctrl + 1 to fold all your functions, unless you changed the default shortcuts.

Gustav Rasmussen
  • 3,720
  • 4
  • 23
  • 53