Forum Archive

How to fold blocks of code?

alec_djinn

Hi there,

I am using Pythonista since a while and now that my scripts are getting longer I really need to collapse/fold blocks of code -- like entire functions or long loops...
Unfortunately I cannot figure out how to do that? Does Pythonista have this feature or not? Using other usually, in other IDE, it is enough to click on the arrows close to the line marks, but in Pythonista this is not an option.

Does anyone solved this issue?

omz

Code folding is currently not supported in Pythonista.

abedholme

Gee I wish it was. Any plans to support?

ccc

Not code folding but... Click the down arrow to the right of the title of the file that you are editing and you will see all the functions in that file and you can jump directly to any one of them.

JonB

https://github.com/omz/Pythonista-Issues/issues/206

You can create wrench shortcuts to fold, or enable manual folding via the context menu. Obviously, not supported or even reccommended, and is probably more manual than you'd like.