[Geany-Devel] Plugin Advice

Peter O'Malley ooomalley at xxxxx
Sat Jan 25 15:53:34 UTC 2014


On Fri, Jan 24, 2014 at 2:29 PM, Lex Trotman <elextr at gmail.com> wrote:
> ...
> 4) The folder would have to always count increases/decreases from the start
> of the file to actually get a level that counts correctly or save state on
> the file.  At the moment it starts from near the start of the visible range
> most of the time to make it faster, and saves no state so it only knows the
> actual indentation, not the level number.  You will have to keep count
> yourself as you go through the file clearing/setting the fold points.
>
> Cheers
> Lex
>

Let's say that I'm only interested in python code that's (close to)
PEP 8 and ignore stuff like triple-quoted strings for the moment.
"Keeping count myself" throughout the entire file is basically the
only idea I had come up with. I was thinking of something fairly
simple like this:
* User requested to fold level 2
* Check document for HEADERFLAG's at fold level 1; found some; increment counter
* Check level 2... none exist, level 3... none exist... (etc) found
some at level 5
* Counter now at 2, so fold all level 5

Obviously this wouldn't scale too well for large files. But in my
(limited) experience python files don't grow very large... and I
personally don't like large source files anyway ;-). (And I suppose
this functionality could be turned on/off with a setting, too.)

How does this sound?

And thanks for the pointers, too!

Best,
Peter


More information about the Devel mailing list