Delphi IDE Code Formatter [Edit]

Hi All.
This thing continues to drive me crazy ;) : it is since the IDE of XE2 that I can't really use the integrated code formatter tool. 
Why it continues to break lines of code like these 

from 

for I := 0 to 4 do MyObj.mymethod(i);

to

for I := 0 to 4 do  
              MyObj.mymethod(i);

?

I know.., but for me it's a matter of taste, and not only: which is the option I have to turn off to avoid this breaking rule to be applied to my code?
Thanks.
Marco

Edited by: Marco Cirinei on Sep 26, 2014 11:31 AM
0
Marco
9/26/2014 9:32:04 AM
embarcadero.delphi.ide 3925 articles. 0 followers. Follow

7 Replies
1823 Views

Similar Articles

[PageSpeed] 54

On 26/09/2014 7:32 PM, Marco Cirinei wrote:
> Hi All.
> This thing continues to drive me crazy ;) : it is since the IDE of XE2 that I can't really use the integrated code formatter tool.
> Why it continues to break lines of code like these
>
> from
>
> for I := 0 to 4 do MyObj.mymethod(i);
>
> to
>
> for I := 0 to 4 do
>                MyObj.mymethod(i);
>
> ?
>
> I know.., but for me it's a matter of taste, and not only: which is the option I have to turn off to avoid this breaking rule to be applied to my code?
> Thanks.
> Marco
>
> Edited by: Marco Cirinei on Sep 26, 2014 11:31 AM
>
Latest Delphi (not sure about earlier ones):
In Tools|Options|Formatter|Delphi|Line Breaks
Look for the  node "Insert Line Breaks for Begin and Single instructions"
Set the "Line breaks before single instructions in control statements" 
to NO (default is YES).
Cheers,
Andrew
0
Andrew
9/26/2014 10:07:49 AM
> {quote:title=Andrew Baylis wrote:}
> >
> Latest Delphi (not sure about earlier ones):
> In Tools|Options|Formatter|Delphi|Line Breaks
> Look for the  node "Insert Line Breaks for Begin and Single instructions"
> Set the "Line breaks before single instructions in control statements" 
> to NO (default is YES).
> Cheers,
> Andrew

Thank you Andrew. I've tried with XE7 and it works. ;)
But I still can't fix this last bad behaviour of the formatter:

      case TTimer(Sender).tag of
        3, 6: if (i0 in [20 .. 23, 7 .. 8]) then else Exit;
        19: if (i0 in [7 .. 9, 21 .. 23]) then else Exit;
      end;
     
always acquires a line break between "then" and  "else" keywords:

      case TTimer(Sender).tag of
        3, 6: if (i0 in [20 .. 23, 7 .. 8]) then
          else Exit;
        19: if (i0 in [7 .. 9, 21 .. 23]) then
          else Exit;
      end;

thank you again!
Marco
0
Marco
9/26/2014 6:33:38 PM
On 27/09/2014 4:33 AM, Marco Cirinei wrote:
> case TTimer(Sender).tag of
>          3, 6: if (i0 in [20 .. 23, 7 .. 8]) then else Exit;
>          19: if (i0 in [7 .. 9, 21 .. 23]) then else Exit;
>        end;
You could try installing the "experimental" version of gexperts that 
includes a code formatter. This has slightly different formatting 
options compared to the IDE.

http://blog.dummzeuch.de/2014/09/04/experimental-gexperts-version-1-37-2014-09-04-released/

Cheers,
Andrew
0
Andrew
9/26/2014 10:33:53 PM
Marco Cirinei wrote:

> Hi All.
> This thing continues to drive me crazy ;) : it is since the IDE of
> XE2 that I can't really use the integrated code formatter tool.  Why
> it continues to break lines of code like these
> 
> from 
> 
> for I := 0 to 4 do MyObj.mymethod(i);
> 
> to
> 
> for I := 0 to 4 do  
>               MyObj.mymethod(i);

It doesn't do that here, but your example doesn't look right. In my
case, it turns it into:

{code}
  for I := 0 to 4 do
    MyObj.mymethod(I);
{code}

But that can be changed as well, AFAIK. Take a look at "line breaks
before single instructions in control statements", set it to "As is"
and see if that helps.

What is your right margin setting for the formatter? 

-- 
Rudy Velthuis        http://www.rvelthuis.de

"2 + 2 = 5, for extremely large values of 2." -- unknown
0
Rudy
9/27/2014 11:45:43 AM
> {quote:title=Rudy Velthuis (TeamB) wrote:}{quote}
> Marco Cirinei wrote:
> 
> > Hi All.
> > This thing continues to drive me crazy ;) : it is since the IDE of
> > XE2 that I can't really use the integrated code formatter tool.  Why
> > it continues to break lines of code like these
> > 
> > from 
> > 
> > for I := 0 to 4 do MyObj.mymethod(i);
> > 
> > to
> > 
> > for I := 0 to 4 do  
> >               MyObj.mymethod(i);
> 
> It doesn't do that here, but your example doesn't look right. In my
> case, it turns it into:
> 
> {code}
>   for I := 0 to 4 do
>     MyObj.mymethod(I);
> {code}
> 
> But that can be changed as well, AFAIK. Take a look at "line breaks
> before single instructions in control statements", set it to "As is"
> and see if that helps.
> 
> What is your right margin setting for the formatter? 
> 

Hi Rudy, the right margin , I think, isn't the problem (normally I use 140+).
Thanks, that setting helped for the first problem.
Anyway, AFAIK, the IDE formatter (XE7) doesn't like this construct in a single line:

"if Condition then else..."

and always adds a line break after the "then" keyword (I end changing it to "if not Condition then...")
0
Marco
9/28/2014 11:32:34 AM
W dniu 2014-09-28 o 13:32, Marco Cirinei pisze:

> Anyway, AFAIK, the IDE formatter (XE7) doesn't like this construct in a single line:
>
> "if Condition then else..."
>
> and always adds a line break after the "then" keyword (I end changing it to "if not Condition then...")
>
It may be your coding style, but I use

if not Condition then ...

instead.
0
Marek
10/12/2014 7:42:23 PM
Marco,

| Anyway, AFAIK, the IDE formatter (XE7) doesn't like this construct in
| a single line:
| 
| "if Condition then else..."

Good!  I think that's a horrible construct!!!  <g>  

-- 

   Q 

1.19.1.372  (Q's Broken Toolbar.)
0
Quentin
10/12/2014 10:50:12 PM
Reply:

Similar Artilces:

Delphi IDE Code Formatter
Hi All. This thing continues to drive me crazy ;) : it is since the IDE of XE2 that I can't really use the integrated code formatter tool. Why it continues to break lines of code like these from for I := 0 to 4 do MyObj.mymethod(i); to for I := 0 to 4 do MyObj.mymethod(i); ? I know.., but for me it's a matter of taste, and not only: which is the option I have to turn off to avoid this breaking rule to be applied to my code? Thanks. Marco ...

Delphi XE IDE code parser error ?!? [Edit]
After adding a IdUDPServer to my form and trying to put some code into the OnUDPRead event, I'm not able to add any component to my form at design time, nor can I run the application. here is the error i got: http://i54.tinypic.com/2j5jl0p.jpg i`ve asked about this on StackOverflow and Mike Justin suggested to +remove the +System.+ from +TArray<System.Byte>+ (in the interface and implementation)+, even so then OnUDPRead event doesn`t trigger. To test this i have made a simple app which uses 2 IdUDPServer comps, one to broadcast and one to Listen, works as expected in Delph...

SEPA components for Delphi with Source Code (Delphi 5
Hi all, in the european union change next year the Bankingformat to the SEPA Format. All peoples and companies must change the bankingssoftware and the costumer data form acountnummers in the new IBAN and BIC numbers. See: http://www.arma-it.de/shop/artikelueber.php?wgruppeid=211&wgruppe_offen=211 Functions: - generate SEPA XML'S - Calc IBAN - BIC Database (DE,AT and CH) Questions: vertrieb@arma-it.de PS: Bankinssoftware for Develpoers (Germany only) http://www.arma-it.de/shop/artikelueber.php?wgruppeid=212&wgruppe_offen=212 El 26/10/13 21:38, A...

Delphi code thowing errors within IDE (but not in compiled exe) [Edit]
Rad Studio - Delphi 2010 (Windows 7, 64 bit laptop) I started to get some issues with my delphi code not running within my Rad Studio (Delphi) 2010. I have been days trying to figure out why. Working with one installed package after another, trying to decide if it was the culprit or not. After finally uninstalling all packages, and even uninstalling the entire Rad Studio (and re-installing just Rad-Studio), i can't seem to figure what can be causing my Delphi IDE to act as it does. I even cleaned the registry of all things related to my component package a nd Rad Studio (before re-inst...

VS ide / delphi ide key map
I'm quit lost in VS ide, F9 run, F8 / F7 Ctrl+Alt+P for tool pallet and the fast find when you type component name F11 to switch to code view / object inspector, the ability to navigate in the object inspector with tab and writing property name. Will someone make a Delphi to VS guide? -- Henning Swiboda wrote: > I'm quit lost in VS ide, F9 run, F8 / F7 > Ctrl+Alt+P for tool pallet and the fast find when you type component > name > F11 to switch to code view / object inspector, the ability to navigate > in the object inspector with tab and writing propert...

Delphi 2006 vs Delphi 2009 IDE stability
Hello, all. I have medium sized project which includes about 20Mb of source code (just size of *.pas files). I use Delphi 2006. There are third party component suites JVCL, DevExpress Bars, Pegasus Imaging. All updates applied. The main problem is IDE stability. About four..five times a day IDE become unstable after intensive usage of code insight functions (most often I press Ctrl+Space key). The best outcome is that I have to save everything and restart the IDE. The worst outcome is when IDE stalls or falls into endless loop of error messages and any unsaved work is lost. OS...

Code works in Delphi 7 but not in Delphi 2010 [Edit]
hello, i have a procedure that open's a file by passing the file name as the parameter to the executable. something like this {code} C : \ P r o g r a m F i l e s \ Da c k e r \ D r a c k e r . e x e " G : \ D E l p h i 7 \ D e l p h i 7 A p p _ l o g . t " {code} The source code is {code} procedure OpenFileWithExe var hReg: HKEY; Ret: Longint; RegDataType, RegDataSize: DWORD; CmdLine: array [0..560] of Char; Len: Integer; SInfo: TStartupInfo; PInfo: TProcessInformation; begin Ret := windows.RegOpenKeyEx(HKEY_CURRENT_USER, ...

multiple edit windows in delphi ide
Hi All, Like most developers I have a wide screen monitor and would like to keep two edtors open side by side. You can click New Edit Window and open files and adjust windows so the two files are side by side but it's tedious each time I open delphi. What I'd like to have is 1) Dockable edit windows so I can dock them side by side 2) Delphi remember the windows settngs when I open the project so it opens the two windows where I was before. Is there any way to do this? tia, Dave David Ninnes wrote: > Hi All, > > Like most developers I have a wide screen ...

Delphi IDEs
Is it possible to write applications for Android and touch sensitive screens with Delphi XE4 or later versions of Delphi? Is it possible to write applications for Windows 8 and touch sensitive screens with Delphi XE4 and later versions of Delphi? Pier Pier wrote: > Is it possible to write applications for Android and touch sensitive > screens with Delphi XE4 or later versions of Delphi? iOS support was added in XE4. Android support was added in Delphi XE5. > Is it possible to write applications for Windows 8 and touch sensitive > screens with Delphi XE4 an...

Delphi Xe IDE error [Edit]
Hi, Getting the error: "Error in module : Declaration of class T_changeMeBack_s is missing or incorrect" when creating a new project as: New -> Other -> ActiveX Library Then adding New -> Other -> Active Form with the Include about box checked Project is created but the About1.pas file is not visible in the project manager (but a reference to it is found in the uses clause of the created unit and _TLB.pas files Edited by: mark buller on Nov 30, 2012 5:45 PM ...

Comparison between Visual Studio 2008 IDE and Delphi 2010 IDE?
Hi, I wonder which is more programmer friendly. Especially for syntax highlighting and fast code writting, viewing.. Thanks.. Mehmet Fide wrote: > Hi, > > I wonder which is more programmer friendly. Especially for syntax > highlighting and fast code writting, viewing.. > > > Thanks.. See "RAD Studio 2010 vs. Visual Studio 2010" in non-technical group. -- Warm Regards, Lee ...

Write plugin for Delphi IDE [Edit]
Hi. Is there tutorial how to write plugin for IDE (for example Delphi XE) ? I'd like to write plugin to extend menu strip and context menu (right click mouse menu) to do some actions at editor code. Edited by: Tomasz Maciejewski on Aug 12, 2012 2:52 AM Tomasz Maciejewski wrote: > Hi. Is there tutorial how to write plugin for IDE (for example Delphi > XE) ? Not for XE (where OTA was noticeably expanded) but Experts and Wizards in Delphi http://delphi.about.com/od/objectpascalide/a/wizardsexperts.htm Erik’s Open Tools API FAQ http://www.gexperts.org/open-tools-api-...

Re: Where is data form wizard in Delphi 2009? [pubic.delphi.ide]
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --JivePart=_21560.zeB8CwDOH5aMJzMl Content-Type: text/plain; charset="Utf-8" Sample picture showing drag and drop from persistent fields edit window. (Any TField in any TDataset should work, TSomeKindofTable, or TSomeKindofQuery. Warren --JivePart=_21560.zeB8CwDOH5aMJzMl Content-Type: image/jpeg; name="drag_and_drop_from_persistent_fields_editor.jpg" Content-Transfer-Encoding: base64 Content-Disposition: attachment; ...

Delphi IDE compared to IntelliJ Idea [Edit]
I've been using for quite a while the jetbrain products - IntelliJ Idea and Resharper and I love them. Now I am coming back to Delphi and I am missing the little things from IntelliJIdea that can make a huge difference when you code. For instance, the code completion works by using a 'contains' algorithm rather than a 'begins with' algorithm. I love the block cursor. Another good one: intellij idea can declare a function based on a call. You type the actual method call and the parameters, press ALT+Enter then the IDE adds the method declaration and it infers the pa...

Web resources about - Delphi IDE Code Formatter [Edit] - embarcadero.delphi.ide

JSON Formatter & Validator
The JSON Formatter & Validator helps debugging JSON data by formatting and validating JSON data so that it is easily read by human beings.

Disabling the Xml Formatter in ASP.NET Web API–The easy way
... idea doesn’t get lost in the warehouse of “to be posted” posts. A common request people are asking is how to disable / remove the xml formatter ...

New Gem: Yertle Formatter
I launched my first Ruby gem a few days ago, yertle_formatter . It’s a custom RSpec 3 formatter that prints out turtles for slow specs and then ...


ProCSSor is the perfect CSS formatter & compressor for Web designers
... messy. You might have been in a rush, or maybe you’re just a bit sloppy. While it’s always better to stay clean from the start, a CSS formatter ...

Free SD Formatter
In order to format SD, SDHC and SDXC memory cards, the Free SD Formatter can be considered by users. It is an easy tool that can be...

Open Directory - Computers: Programming: Languages: JavaScript: Tools: Obfuscators
about dmoz - dmoz blog - suggest URL - update listing - become an editor - report abuse/spam - help the entire directory only in Tools/Obfuscators ...

TeX - Wikipedia, the free encyclopedia
and released in 1978. Within the typesetting system, its name is formatted as T e X . Together with the Metafont language for font description ...

Who Writes Wikipedia? (Aaron Swartz's Raw Thought)
Wikimedia 2006 Elections Part 1: Wikimedia at the Crossroads Part 2: Who Writes Wikipedia? Part 3: Who Runs Wikipedia? Part 4: Making More ...

Tools I'm Lovin' - Angela Maiers, Speaker, Educator, #YOUMATTER
A comparison of the net's top file sharing tools!

Resources last updated: 12/14/2015 11:48:11 PM