[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Editor: Folding sections?


I did this quick thing.
It opens a window with a list of all the procedures,  (see pic)
you can simply and quickly collapse/expand single subs or collapse
all/expand all, invert all

https://gitlab.com/bsteers4/gambas/-/commits/fold-procs?ref_type=heads
https://gitlab.com/bsteers4/gambas/-/blob/fold-procs/app/src/gambas3/.src/Editor/Code/FFoldProcs.class

Here's a clip of it working...
https://youtu.be/NSG58OxrZzU

It uses existing TextEditor functions
.FindNextLimit(Y)
._IsRowExpanded(Y)
._CollapseRow(Y)
._ExpandRow(Y)
.CollapseAll()
.ExpandAll()

Respects
BruceS

On Tue, 18 Jun 2024 at 11:19, Rolf-Werner Eilert <rwe-sse@xxxxxxxxxx> wrote:

> Am 17.06.24 um 13:24 schrieb Benoît Minisini:
> > Le 17/06/2024 à 09:13, Rolf-Werner Eilert a écrit :
> >> Am 16.06.24 um 01:13 schrieb KKing:
> >>> Re: Editor: Folding sections?
> >>>
> >>> +1
> >>>
> >>> I resorted to using Geany and even notepad++ for some work I had to
> >>> do on some very large projects.
> >>>
> >>> This was Benoit's response to my enquiry in 2019
> >>>> Le 09/09/2019 à 18:50, KKing a écrit :
> >>>> > Is there support for regions and within the IDE code folding?
> >>>> >
> >>>> > If not is it on a wishlist / roadmap ?
> >>>> >
> >>>> > K.
> >>>> >
> >>>>
> >>>> No and no.
> >>>>
> >>>> --
> >>>> Benoît Minisini
> >>>
> >>> Maybe we can find a GSOC candidate :---?
> >>>
> >>> K.
> >>>
> >>>
> >>
> >> As to folding code: As far as I know (never checked the sources), the
> >> IDE and the editor is written in Gambas. If so, it should be
> >> relatively easy to re-use the existing folding procedures, combine it
> >> with comment recognition and add section folding to it.
> >>
> >> I have been thinking this over, and if you guys could point me to the
> >> entry points for procedure folding and comments, I will take a look at
> >> it. At least I could give it a try...
> >>
> >> Regards
> >> Rolf
> >>
> >>
> >
> > (1) The TextEditor aims at being syntax highlighting agnostic, so
> > knowing if a piece of text (it's not necessary full lines) can be
> > collapsed or expanded should be described by the syntax highlighting
> file.
>
> This is roundabout what I was thinking of.
>
> >
> > (2) As for the folding implementation code by itself, you should write
> > it indepently of the current code. It should be a black box code the
> > editor tells to fold / unfold between two cursor positions, and that
> > tells the editor the conversion between editor positions and visible
> > positions, folding taken into account.
>
> Oh yes, editor positions... But there should be such code for folding
> subs and functions. So there is kinda example code.
>
>
> >
> > You should work on (2), and let me handle (1) later. But it's not an
> > easy task. This is why I understood "no / no".
>
> Thank you for the warning :) Soon I will be in holidays, maybe I'll find
> some time to look into it then...
>
> Regards
> Rolf
>
>
>

Attachment: Untitled.jpg
Description: JPEG image