Re: [Lazarus] Code Folding mess and Code Divider feature
On Sat, Mar 14, 2009 at 8:11 AM, Hans-Peter Diettrich wrote: > The next logical step is unfolding include directives, so that the > included files can be inlined in the editor. This is what Delphi users > will need urgently, and every user will appreciate the capability of > searching and find-and-replace in the entire resulting text. > An important feature and not only to ex Delphians, would be nice to see the content of include files within the main source file possibly with a slightly different background so it shows that the content is not really inside the main file, as an extra feature it would be interesting to allow the user to select from the list of available includes on all platforms, if he wants to alter code in more than one file, usually the programmer only needs to see the include file for his current platform. As for multiple platforms, you still need to at least compile and briefly test the compiled application on all platforms, so the switching feature is not as important, one can still edit those includes separately. Razvan ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Folding mess and Code Divider feature
On Sat, Mar 14, 2009 at 5:51 PM, Hans-Peter Diettrich wrote: >> You have the same >> include name, but different implementations depending on the platform. >> How do you inline something like that, or search across such includes? > > Exactly as the IDE does it, in the navigation between a class definition > and method implementation. OK, but my point is as follows... Say you have a common interface section and 15 different implementation sections using include files. Now under Windows you do a search-and-replace which changes the interface section and 1 out of 15 possible include files. That means your have 14 other include files still remaining with the old identifier names. This is definitely not ideal - hence why I said I have not found a solution for this yet. 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
Re: [Lazarus] Code Folding mess and Code Divider feature
Graeme Geldenhuys schrieb: > I was thinking about 'find' and 'find-and-replace' to work for include > files as well, but I could get my head around a solution. Think about > FPC code where includes are based on platforms. Yes, I know that. This practice is almost the only argument for using include files at all. > You have the same > include name, but different implementations depending on the platform. > How do you inline something like that, or search across such includes? Exactly as the IDE does it, in the navigation between a class definition and method implementation. DoDi ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Folding mess and Code Divider feature
On Sat, Mar 14, 2009 at 8:11 AM, Hans-Peter Diettrich wrote: > > will need urgently, and every user will appreciate the capability of > searching and find-and-replace in the entire resulting text. I was thinking about 'find' and 'find-and-replace' to work for include files as well, but I could get my head around a solution. Think about FPC code where includes are based on platforms. You have the same include name, but different implementations depending on the platform. How do you inline something like that, or search across such includes? You can't expect a search-and-replace, only finding include files for one platform, but ignoring the other 14 supported platforms. :-( 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
Re: [Lazarus] Code Folding mess and Code Divider feature
On Fri, Mar 13, 2009 at 5:52 PM, Martin Friebe wrote: >> > In a "program" it differs from a "unit", because you do not have the > implementation/interface section. > Include files may differ again. OK, thanks... >> I then played with the levels to see how they differ. After changing >> the level, i did a Lazarus restart. It seems at Level = 2, I again get >> the same behaviour as the bug report. Even with a restart. So that >> seems to be another bug. >> > Are all 3 files units? with unit keyword at the start, and > implementation/interface sections OK, this might have something to do with it. The file 'calendartest.lpr' is a 'program' file. The other two are standard 'unit' files. This probably explains what I saw. The 'program' file is handled differently even though I was looking at methods of a class. Two files had an implementation section and one didn't. 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
Re: [Lazarus] Code Folding mess and Code Divider feature
Graeme Geldenhuys schrieb: >> - Folding at "procedure" in addition to the begin => arguable, if it >> should be instead of the begin? > > I'm not sure about this one either. I would have thought the first > 'begin' after a procedure or function should be ok. Procedures can have large parameter lists, type, var and const sections, in addition to the code body. When a procedure is of no (visual) interest, all that should go out of the way at once. Folding should recognize two tree structures: 1) sequential sections, like case labels or above type/var sections 2) nested blocks, like arbitrary begin/end pairs Type 1 sections only have an "label", and extend until the next sibling. Type 2 blocks have both head and tail delimiters. DoDi ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Folding mess and Code Divider feature
Martin Friebe schrieb: > Are all 3 files units? with unit keyword at the start, and > implementation/interface sections > if you have an include file, with no "unit", no "interface" / > "implementation" => then "procedure" is the top level fold (divider > level = 1) The next logical step is unfolding include directives, so that the included files can be inlined in the editor. This is what Delphi users will need urgently, and every user will appreciate the capability of searching and find-and-replace in the entire resulting text. DoDi ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Folding mess and Code Divider feature
On Fri, 13 Mar 2009, Martin Friebe wrote: > Graeme Geldenhuys wrote: > > Hi, > > > > This relates to the new bug report: > > http://bugs.freepascal.org/view.php?id=13322 > > > > Code Folding seems to have gone way overboard! It simply makes the > > editor look like a mess at the moment (Lazarus svn trunk revision). > > What is the end goal of code folding? Maybe is in the middle of the > > overall goal and I am simply acting to quickly. Either way, I will > > voice my concerns... > > > There is a general plan/idea to add some configuration (have to see how > much) to define what you want to have foldable and what not. It wasn't > seen as urgent yet (at least not by me...) > > Most (if not all) of the places that allow folding now, do so in Delphi > as well. this is part of why they have been added, to make it easier for > (ex-) Delphi users. > > IMHO most of the new ones are reasonable? > - Except maybe for: "Program" / "Unit" and "Implementation" / > "interface"; but they don't occur very often in a normal unit. > - Maybe discussable are "var" "Canost" "type" blocks? Think is they can > be very useful for bigger "var" sections (but I agree they can be > irritating with just on line in it) > - Folding at class / private / public => IMHO should be ok? > - Folding at "procedure" in addition to the begin => arguable, if it > should be instead of the begin? > > Will be interested to see, if other people will voice opinions, which of > the new foldings they like, which not As long as it can be switched off, you won't hear me complaining :-) Michael. ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Folding mess and Code Divider feature
On Sat, Mar 14, 2009 at 02:03, Martin Friebe wrote: > Not yet. > this will at earliest be implemented, when individual folds can be > configured. The same applies for repeat/until > It may also have to wait fro some more/other refactoring on the folding. > The highlighting currently depends on the detection for folding. I thought about it too when I composed the list in the previous message, but considered them overkill. If single-statement folds, like for 'case', 'with', 'if' etc. will be implemented, they should be able to "merge" with begin/end folds for their bodies, to avoid useless almost-duplicate folds. -- Alexander S. Klenin ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Folding mess and Code Divider feature
Stephano wrote: > Martin Friebe wrote: > >> There is a general plan/idea to add some configuration (have to see how >> much) to define what you want to have foldable and what not. It wasn't >> seen as urgent yet (at least not by me...) >> >> Most (if not all) of the places that allow folding now, do so in Delphi >> as well. this is part of why they have been added, to make it easier for >> (ex-) Delphi users. >> > Is it possible have folding or more specifically identification for > case/end pairs? > Not yet. this will at earliest be implemented, when individual folds can be configured. The same applies for repeat/until It may also have to wait fro some more/other refactoring on the folding. The highlighting currently depends on the detection for folding. So it will be a while till that is done. The problem is that there are already units, that take more than one second to parse, and that can behave sluggish if you insert words like "begin". So implementing this must be done with care. If you have an idea how to patch this, please feel free to discuss. Best Regards Martin ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Folding mess and Code Divider feature
Graeme Geldenhuys wrote: > In that case the first picture is wrong => with DDL=1 there should be no >> line between procedures (it would be at the end of the unit level.) >> Not sure if complete: >> DDL 1: unit level >> DDL 2: implementation/ interface >> DDL 3: Procedure implementation / class declaration >> > > ah, nice to actually know what each level means. :-) Maybe that should > be place in the options screen instead of just numbers. > In a "program" it differs from a "unit", because you do not have the implementation/interface section. Include files may differ again. Those differences were always present, even with the older folding. The level only represents how many nested folds you have Unit: is the top level fold; not nested implementation/ interface: is nested in the unit fold procedures are nested into the implantation fold .. >> since you only switched tabs => did you aybe change config in your >> session? maybe the issue was that the config change was not set to all >> editors? >> > > That seems to be the partial cause. Setting the level to 3 gives the > most desirable outcome I wanted. But only after I restarted Lazarus, > did all the editors update. So there is one bug - not all editors get > updated. > Ok, I will check this part: "proper propagation of config changes, with regards to divider fold level" > I then played with the levels to see how they differ. After changing > the level, i did a Lazarus restart. It seems at Level = 2, I again get > the same behaviour as the bug report. Even with a restart. So that > seems to be another bug. > Are all 3 files units? with unit keyword at the start, and implementation/interface sections if you have an include file, with no "unit", no "interface" / "implementation" => then "procedure" is the top level fold (divider level = 1) I will need some feedback to reproduce this. Or if the behaviour is due to differences in the nesting structure, then the bug breaks down into: - propagation (see above) - restore the old behaviour that "procedure" divider lines, can be drawn independent of the fold-nest level. (they used to be top level, which is why they used to be content independent => that has changed) Best Regards Martin ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Folding mess and Code Divider feature
On Fri, Mar 13, 2009 at 22:16, Martin Friebe wrote: > There is a general plan/idea to add some configuration (have to see how > much) to define what you want to have foldable and what not. It wasn't > seen as urgent yet (at least not by me...) > > Most (if not all) of the places that allow folding now, do so in Delphi > as well. this is part of why they have been added, to make it easier for > (ex-) Delphi users. Actually, at least in Delphi 2007 code folding works only down to classes and procedures, not below. Still, I think it is a good feature. > IMHO most of the new ones are reasonable? > - Except maybe for: "Program" / "Unit" and "Implementation" / > "interface"; but they don't occur very often in a normal unit. > - Maybe discussable are "var" "Canost" "type" blocks? Think is they can > be very useful for bigger "var" sections (but I agree they can be > irritating with just on line in it) > - Folding at class / private / public => IMHO should be ok? > - Folding at "procedure" in addition to the begin => arguable, if it > should be instead of the begin? I'd say that such deep nesting should have very detailed configuration. I suggest to replace current numeric setting with a grid of checkboxes controlling code folding and divider drawing separately at logical levels: Level | Folding | Divider Unit/Program | Off | Off Section (interface/implementation/...) | On | Off Class/Object/Record Type Definition | On | On Class Visibility Specifier (public/private/...) | Off | Off Other Type Definition | On | Off Uses statement | On | Off Global var/property/const | On | On Procedure/Function/Method implementation | On | On Nested Procedure/Function | On | Off Local var/const | Off | Off Begin/end blocks | Off | Off Additionally, maybe for begin/end blocks a separate setting to turn folding on for blocks longer that N lines. The settings I above are my preferences, and I hope also reasonable defaults. -- Alexander S. Klenin ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Folding mess and Code Divider feature
Martin Friebe wrote: > There is a general plan/idea to add some configuration (have to see how > much) to define what you want to have foldable and what not. It wasn't > seen as urgent yet (at least not by me...) > > Most (if not all) of the places that allow folding now, do so in Delphi > as well. this is part of why they have been added, to make it easier for > (ex-) Delphi users. Is it possible have folding or more specifically identification for case/end pairs? ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Folding mess and Code Divider feature
On Fri, Mar 13, 2009 at 4:10 PM, Martin Friebe wrote: > > so they are all with > "Settings: > Code Folding: Enabled > Divider Draw Level: 1 > " > ? Yes > In that case the first picture is wrong => with DDL=1 there should be no > line between procedures (it would be at the end of the unit level.) > Not sure if complete: > DDL 1: unit level > DDL 2: implementation/ interface > DDL 3: Procedure implementation / class declaration ah, nice to actually know what each level means. :-) Maybe that should be place in the options screen instead of just numbers. > since you only switched tabs => did you aybe change config in your > session? maybe the issue was that the config change was not set to all > editors? That seems to be the partial cause. Setting the level to 3 gives the most desirable outcome I wanted. But only after I restarted Lazarus, did all the editors update. So there is one bug - not all editors get updated. I then played with the levels to see how they differ. After changing the level, i did a Lazarus restart. It seems at Level = 2, I again get the same behaviour as the bug report. Even with a restart. So that seems to be another bug. > > try level 3. Yes, that gives the best results for me. 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
Re: [Lazarus] Code Folding mess and Code Divider feature
Graeme Geldenhuys wrote: >>> code folding. The idea of "draw code divider" was simply to draw a >>> horizontal line at the end of each procedure or method (like visual >>> basic 6 did). I have no interest in drawing horizontal divider lines >>> wherever code folding can occur. And with the current verbose level of >>> >> That can be looked at / I can see the benefit of such a feature. >> > > Before horizontal line drawing between procedures / functions, I have > seen programmers add spaces to separate methods. Or use comments as > dividers. eg: {---} > > Those are all waisted efforts and get in the way of coding and > programs such as 'pasdoc'. The visual effect of synedit drawing the > line (without anything actually being in the source code) is brilliant > and gives a much better look! > > I think it will be worth having as a separate feature to code folding. > And at the moment I can only see it being useful between procedures, > functions and methods. I would ignore nested methods for now - it can > be added at a later date if the need arises. > If you set the draw level to 3 or maybe 4, you should get the correct divider draw levels. You will have to ignore the dividers drawn at the end of implementation sections >> Not sure where it gets broken? Are the pictures from different versions >> of lazarus? or are they with different settings? >> > > Nope, the screenshots in the bug report is all taken using the same > project, settings and Lazarus version. I simply switched tabs and took > screenshots. > so they are all with "Settings: Code Folding: Enabled Divider Draw Level: 1 " ? In that case the first picture is wrong => with DDL=1 there should be no line between procedures (it would be at the end of the unit level.) Not sure if complete: DDL 1: unit level DDL 2: implementation/ interface DDL 3: Procedure implementation / class declaration since you only switched tabs => did you aybe change config in your session? maybe the issue was that the config change was not set to all editors? > >> If you want then at begin/end level you need to set the divider draw >> level higher => the down side is, there will be additional dividers. >> This may not be the effect you desire, but it is the effect intended. >> > > I think my original idea or method dividers got lost somewhere. :-) I > only indented the feature to have dividers between procedures, > functions and methods. No nested methods and no other code folding > areas. > try level 3. Best Regards Martin ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Code Folding mess and Code Divider feature
On Fri, Mar 13, 2009 at 2:16 PM, Martin Friebe wrote: >> What is the end goal of code folding? Maybe is in the middle of the >> overall goal and I am simply acting to quickly. Either way, I will >> voice my concerns... >> > There is a general plan/idea to add some configuration (have to see how > much) to define what you want to have foldable and what not. It wasn't > seen as urgent yet (at least not by me...) OK thanks. So configuration is in the pipeline - that is good to know. :) > Most (if not all) of the places that allow folding now, do so in Delphi > as well. this is part of why they have been added, to make it easier for > (ex-) Delphi users. I did not know that. I last used Delphi 7 which had no code folding. I've only seen code folding in other editors and they were not that verbose as the current synedit in Lazarus. This is why I thought I would mention it. > IMHO most of the new ones are reasonable? > - Except maybe for: "Program" / "Unit" and "Implementation" / > "interface"; but they don't occur very often in a normal unit. I don't see the point of 'Program' or 'Unit' level. Many the others could be useful. > - Folding at "procedure" in addition to the begin => arguable, if it > should be instead of the begin? I'm not sure about this one either. I would have thought the first 'begin' after a procedure or function should be ok. >> At the moment it is more like trying to spot a line of code that >> doesn't have a [+] in the gutter!! This is just causing clutter and >> not actually adding any value as far as I can see. Especially now that >> the code folding lines and +/- signs are inside the editor code area >> and not the gutter area. OK, so we all know synedit now supports code >> > You can change this: > The gutter divider line is moveable, and the code fold background color > adjustable. I know the gutter divider line is movable, but I didn't know the background color is adjustable. I'll give this another try. See the original bug report for my editor colour scheme - it's not quite standard colours which probably exaggerated the problem a bit. ;-) > Enviroment=>options=>editor=>color=> "code folding tree" (3rd in box) Thanks, this makes code folding look a lot better already. My gutter is a different colour to the editor background. Now the code folding tree blends in much better with the gutter part. >> code folding. The idea of "draw code divider" was simply to draw a >> horizontal line at the end of each procedure or method (like visual >> basic 6 did). I have no interest in drawing horizontal divider lines >> wherever code folding can occur. And with the current verbose level of > > That can be looked at / I can see the benefit of such a feature. Before horizontal line drawing between procedures / functions, I have seen programmers add spaces to separate methods. Or use comments as dividers. eg: {---} Those are all waisted efforts and get in the way of coding and programs such as 'pasdoc'. The visual effect of synedit drawing the line (without anything actually being in the source code) is brilliant and gives a much better look! I think it will be worth having as a separate feature to code folding. And at the moment I can only see it being useful between procedures, functions and methods. I would ignore nested methods for now - it can be added at a later date if the need arises. > Not sure where it gets broken? Are the pictures from different versions > of lazarus? or are they with different settings? Nope, the screenshots in the bug report is all taken using the same project, settings and Lazarus version. I simply switched tabs and took screenshots. > If you want then at begin/end level you need to set the divider draw > level higher => the down side is, there will be additional dividers. > This may not be the effect you desire, but it is the effect intended. I think my original idea or method dividers got lost somewhere. :-) I only indented the feature to have dividers between procedures, functions and methods. No nested methods and no other code folding areas. 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
Re: [Lazarus] Code Folding mess and Code Divider feature
Graeme Geldenhuys wrote: > Hi, > > This relates to the new bug report: > http://bugs.freepascal.org/view.php?id=13322 > > Code Folding seems to have gone way overboard! It simply makes the > editor look like a mess at the moment (Lazarus svn trunk revision). > What is the end goal of code folding? Maybe is in the middle of the > overall goal and I am simply acting to quickly. Either way, I will > voice my concerns... > There is a general plan/idea to add some configuration (have to see how much) to define what you want to have foldable and what not. It wasn't seen as urgent yet (at least not by me...) Most (if not all) of the places that allow folding now, do so in Delphi as well. this is part of why they have been added, to make it easier for (ex-) Delphi users. IMHO most of the new ones are reasonable? - Except maybe for: "Program" / "Unit" and "Implementation" / "interface"; but they don't occur very often in a normal unit. - Maybe discussable are "var" "Canost" "type" blocks? Think is they can be very useful for bigger "var" sections (but I agree they can be irritating with just on line in it) - Folding at class / private / public => IMHO should be ok? - Folding at "procedure" in addition to the begin => arguable, if it should be instead of the begin? Will be interested to see, if other people will voice opinions, which of the new foldings they like, which not > In older versions of Lazarus the Code Folding [+] was in logical > places. begin..end blocks. Now they appear on Implementation > sections, uses classes, procedure/function level, begin..end block of > procedure/function, begin..end block of if statements, var blocks > etc... You end up with code looking as follows (code folding plusses > everywhere)! > . > At the moment it is more like trying to spot a line of code that > doesn't have a [+] in the gutter!! This is just causing clutter and > not actually adding any value as far as I can see. Especially now that > the code folding lines and +/- signs are inside the editor code area > and not the gutter area. OK, so we all know synedit now supports code > You can change this: The gutter divider line is moveable, and the code fold background color adjustable. Only the code-folding is now on the right side of the gutter (towards the text) rather than the left, as it used to be. Enviroment=>options=>editor=>display=> "gutter separator index" Enviroment=>options=>editor=>color=> "code folding tree" (3rd in box) > folding, but we don't need it on every line. Maybe Lazarus should > have a Code Folding verbosity level going from 'Normal Code Folding' > to 'Insane Code Folding'. > > This brings me to another point. Initially the Code Folding was not as > verbose, so I tied the "Draw Code Divider" feature into the Code > Folding feature. But now that Code Folding is so verbose it now makes > no more sense and seems to get broken quite often. Maybe the "draw > code divider" should become a separate feature and not tied into the > code folding. The idea of "draw code divider" was simply to draw a > horizontal line at the end of each procedure or method (like visual > basic 6 did). I have no interest in drawing horizontal divider lines > wherever code folding can occur. And with the current verbose level of > code folding and horizontal lines (if they work) you will actually > struggle to see your code between the whole mess. > That can be looked at / I can see the benefit of such a feature. Not sure where it gets broken? Are the pictures from different versions of lazarus? or are they with different settings? If you want then at begin/end level you need to set the divider draw level higher => the down side is, there will be additional dividers. This may not be the effect you desire, but it is the effect intended. Best Regards Martin ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus