On Fri, 20 Oct 2017, Werner Pamler via Lazarus wrote:

The new outline feature of the IDE in Laz 1.8 and trunk is extremely helpful in locating code block inconsistencies. I cannot imagine how I could have lived without it in older versions.

In my opinion, however, it is not always working correctly:

A "for" loop with a "begin"/"end" block ("for ... do begin end;") is a logical entity of the code; there is only a single semicolon which terminates this sequence. Therefore I'd expect all four keywords to be painted in the same color, no matter of how the code is formatted.

The IDE behaves differently, however. Look at screenshot "orig.png" which is taken from the current LCLtranslator.pas of trunk and essentially shows a "for" loop with a "begin"/"end" block. However, the author of this unit likes to put the "begin" into a new line and to indent it with respect to its "for" parent. Note that the IDE now switches color - "for...do" and "begin"/"end" are colored differently. - I think this is wrong

This changes if the indentation of "begin" is modified to match that of "for" (screenshot "modif-1.png"), or if "begin" is kept in the same line as "for" (screenshot "modif-2.png").  Now all three keywords are colored equally. - I think this is correct.

How can it be that the logical relation between keywords depends on the way of writing? Is this a bug? Or is it just that my understanding of the Pascal block concept is wrong?

Interestingly, I had a discussion recently with one of the authors of this
functionality (Pascal Riekenberg). He had remarks about exactly this point. He uses the C style of putting "begin" at the end of the for/if/while line, while I use the Object Pascal style of putting begin on a separate line.


I suppose that as a result of this discussion, the behaviour may still be
fine-tuned.

Michael.
-- 
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to