Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Code formatter in XE7


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Mar 31, 2015 9:54 AM Last Post By: Jeff Overcash (...
Lance Rasmussen

Posts: 40
Registered: 9/26/02
Code formatter in XE7  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 30, 2015 6:17 PM
I'm trying to do some cleanup in the IDE Code Formatter and have the settings almost to what I like.

Issue I'm having is this:

try
I := 0;
while not Eof( MyFile ) do begin
ReadLn( MyFile, S );
if I = 0 then begin
cleSubject.Text := S;
I := 1;
end else begin
tbEmail.Lines.Add( S );
end;
end;
finally
CloseFile( MyFile );
end;

I'm trying to figure out which options in the formatter that will place a linefeed before the begin.
while not Eof( MyFile ) do begin
would become
while not Eof( MyFile ) do
begin

Also I want the else to have a linefeed before, to go from:
end else begin
to become
end
else begin

Jeff Overcash (...

Posts: 1,529
Registered: 9/23/99
Re: Code formatter in XE7  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 31, 2015 9:54 AM   in response to: Lance Rasmussen in response to: Lance Rasmussen
Lance Rasmussen wrote:
I'm trying to do some cleanup in the IDE Code Formatter and have the settings almost to what I like.

Issue I'm having is this:

try
I := 0;
while not Eof( MyFile ) do begin
ReadLn( MyFile, S );
if I = 0 then begin
cleSubject.Text := S;
I := 1;
end else begin
tbEmail.Lines.Add( S );
end;
end;
finally
CloseFile( MyFile );
end;

I'm trying to figure out which options in the formatter that will place a linefeed before the begin.
while not Eof( MyFile ) do begin
would become
while not Eof( MyFile ) do
begin

Also I want the else to have a linefeed before, to go from:
end else begin
to become
end
else begin


In the Tools | Options | Formatter | Delphi | Line Breaks section

I have all three of the line breaks before begin set to yes That should deal
with your first case. The section above has a Remove line break inside else if
which probably needs to be set to true.

In the indentions section you probably want to set the indent begin end keywords
to true.

I am not sure you can get the begin to move to the next line on the If..then and
stay on the same line on the else...{if}, but most of what you are wanting can
be done.

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
And so I patrol in the valley of the shadow of the tricolor
I must fear evil. For I am but mortal and mortals can only die.
Asking questions, pleading answers from the nameless
faceless watchers that stalk the carpeted corridors of Whitehall.
(Fish)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02