Menu

#8 Insert Block markers

open
nobody
None
5
2003-04-01
2003-04-01
Anonymous
No

If you have larger blocks it sometimes is hard to see
to which "begin" or "while" or so an "end" line belongs
to. So a feature to add information about this as
comments to the code would be great (and removal of
them as well).

if a = 1 then
begin
... lots of code
end
else
begin
... lots of code
end;

would reformat to
if a = 1 then
begin
... lots of code
end
else { "if a = 1" }
begin
... lots of code
end; { "if a = 1" }

These comments would be nice at the following locations:
"end" of every kind of loop
"else"
"end" of types, procedure and methods

In smaller blocks there's no need for these comments.
So an option should be how many lines must be between
the start and the end of a block to insert a block comment.

For removal of these block comments, there's the need
to establish a special char-pattern, like {/jcf
"comment" } to recognize these automatically created
comments.

Discussion

  • a2z

    a2z - 2003-12-10

    Logged In: YES
    user_id=39747

    But, you are asking a code formatter to inject something new
    to your own code.

    I can see you are asking for it as an option, and if it is
    an option, I am not really in a position to object it.

    But, I can see the nightmare of trying to remove someone
    else's block markers --in the case I was given a copy.

    Why cant you use

    If xxxxxxxx then begin
    code
    code
    code
    end else begin
    code
    code
    code
    end;

    The indentation, in this case, makes it all clear (to me, at
    least)

    Cheers,
    Adem

     
  • Jens Berke

    Jens Berke - 2004-05-26

    Logged In: YES
    user_id=249771

    Yes, the idention is a good thing to recognize where you are.
    But if you have a method with so many lines that you only
    see, say, the last third of the method, it might look like:
    ...
    end;
    end;
    end;
    end;
    end;
    end;

    So where does the 3rd "end" belong to, for example?
    Sometimes it's not so easy to tell without scrolling up and
    checking the indention. That's a case were I find these
    block markers useful.

    Jens

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.