On Sun, Dec 15, 2013 at 10:02 PM, Edward K. Ream <[email protected]> wrote:
> True, parsing a file isn't everything: the import code must still create the 
> outline.  But the line-oriented parse greatly simplifies everything by 
> eliminating character-oriented complications.

This made me wonder how editors handle Python for code-folding. Not
something I used, but I was curious and found some stuff related to
vim.

>From http://www.vim.org/scripts/script.php?script_id=3723:
 "Because of its reliance on significant whitespace rather than
explicit block delimiters, properly folding Python code can be tricky.
"

So for folding it seems the significant whitespace makes it harder.

"...the simplest workaround is to `:set foldmethod=indent`, which
usually ends up folding a lot more than you really want it to."

I guess this is what the author of that plugin wants:

"...it properly folds class and function/method definitions, and
leaves your loops and conditional blocks untouched."

The code is just several pages long and seems fairly readable. Looks
like its parsing is also line-oriented:
https://github.com/tmhedberg/SimpylFold/blob/master/ftplugin/python/SimpylFold.vim.

Thought I'd share in case it sparks any parsing ideas.

Brian

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to