Re: [Lazarus] user defined code folding regions using $REGION comments
Martin Friebe wrote: > Gerard N/A wrote: >> I have a rough implementation that seems to work Ok (I'm cautious >> because the synedit highlighter is a scary piece of code). >> If there is interest, I can post a patch to the bug tracker or here. >> >> > > Hi Gerard, > > I saw the patch you uploaded to the bug system. > > As indicated the user-token must not interfere with real compiler > directives. This should still be easy to solve. Instead of looking for a > directive named $REGION, you would look for a comment with special content. > > The 2nd issue requires more work. > > consider this: > > [EMAIL PROTECTED] 'for relesae builds' fold } >If IsRelease then begin > [EMAIL PROTECTED] >a:= foo(b); >writeln(a); > [EMAIL PROTECTED] 'for relesae builds' fold } >end; > [EMAIL PROTECTED] For IDE "directives" we use {%somedirective} Better use them in this case too. Marc ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] user defined code folding regions using $REGION comments
Gerard N/A wrote: > I have a rough implementation that seems to work Ok (I'm cautious > because the synedit highlighter is a scary piece of code). > If there is interest, I can post a patch to the bug tracker or here. > > Hi Gerard, I saw the patch you uploaded to the bug system. As indicated the user-token must not interfere with real compiler directives. This should still be easy to solve. Instead of looking for a directive named $REGION, you would look for a comment with special content. The 2nd issue requires more work. consider this: [EMAIL PROTECTED] 'for relesae builds' fold } If IsRelease then begin [EMAIL PROTECTED] a:= foo(b); writeln(a); [EMAIL PROTECTED] 'for relesae builds' fold } end; [EMAIL PROTECTED] This should work. The "begin" should still match the "end" FoldedView has *some* (but completely untested) preparation for this. The big task is, that this kind of fold info can not be stared in a single combined list of the current type (FoldMinLevel / FoldEndLevel ) - The Highlighter needs to keep/calculate the info independent of the current FoldLevel - Current folds, have some info at *every* line in SynEditTextBuffer. User folds are likely to be less in count. So I would suggest *not* to add info to every line. SynEditTextBuffer could have a TAVLTree storing info about each known userfold. - SynEdit.ScanFrom => would need to update the additional fold info - TFoldedView would have to obey the additional FoldInfo If you have a different idea, how the problem could be solved, please feel free to explain, and we can discuss it. Best Regards Martin ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] user defined code folding regions using $REGION comments
Hi, On Wed, Nov 26, 2008 at 10:08 AM, Paul Ishenin <[EMAIL PROTECTED]> wrote: > > there. He also has plans to implement this feature: > http://wiki.lazarus.freepascal.org/User:Martin > I have a rough implementation that seems to work Ok (I'm cautious because the synedit highlighter is a scary piece of code). If there is interest, I can post a patch to the bug tracker or here. Regards, Gerard. ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] user defined code folding regions using $REGION comments
Graeme Geldenhuys wrote: > I added a new feature request for user defined code folding regions. I > think such an addition to Lazarus editor would be very useful. I > especially think the "folded by default" option would be very handy. > That way the editor can hide certain code by default, while the rest > of the unit is expanded. Very handy for things like "auto generated" > code from a Form Designer or something else, which the developer > normally doesn't need to tamper with. > > http://bugs.freepascal.org/view.php?id=12718 > > Any thoughts on the above? Anybody code folding code experience > willing to take up the challenge in implementing something like this? I answered you to the bug-tracker. But I will answer here to. Yes, this is known feature and once it will be implemented. Marin is working on synedit folding last few weeks and he made a big progress in bug fixing there. He also has plans to implement this feature: http://wiki.lazarus.freepascal.org/User:Martin Best regards, Paul Ishenin. ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] user defined code folding regions using $REGION comments
On Wed, Nov 26, 2008 at 10:20 AM, Graeme Geldenhuys <[EMAIL PROTECTED]> wrote: > > Any thoughts on the above? Anybody code folding code experience > willing to take up the challenge in implementing something like this? Another use for user defined code folding regions I found this hint on some Delphi website. -- Like you I don't use cold folding however I recently found a use for it. Create a LiveTemplate something along these lines. {$REGION 'Assert'}Assert(Condition, 'Message');{$ENDREGION} Use it every time you write an assertion and fold it up straight away. Your distracting full length Assert statement is reduced to a single word, Assert, and because the region starts and ends on the same line you don't have line numbers jumping unexpectedly. I also change my editor colours so that the collapsed region label is less prominent than the regular code lines. That could be handy for hiding all kinds of debug code... I could see a use for this in my code. Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] user defined code folding regions using $REGION comments
Hi, I added a new feature request for user defined code folding regions. I think such an addition to Lazarus editor would be very useful. I especially think the "folded by default" option would be very handy. That way the editor can hide certain code by default, while the rest of the unit is expanded. Very handy for things like "auto generated" code from a Form Designer or something else, which the developer normally doesn't need to tamper with. http://bugs.freepascal.org/view.php?id=12718 Any thoughts on the above? Anybody code folding code experience willing to take up the challenge in implementing something like this? Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus