Code Style

Robert Fraser fraserofthenight at gmail.com
Fri Jun 15 13:34:55 PDT 2007


It will totally be configurable enough to set that style, and there will definitely be more than one set of properties (it's based on the Eclipse formatter, so you can set everything individually, but I'm adding some things to make it easy to set everything at once and edit just what you want changed).

Alexander Panek Wrote:

> Robert Fraser wrote:
> > Hi all,
> > [...]
> > Also, a more general question... would you ever consider actually USING a code formatter/have used one in the past?
> 
> Personally, I don't use code formatters as they tend to have only one 
> set of formatting properties, which makes it a bit of a pain in the ass 
> at times. The fact that Vim does not provide any (on-the-fly) code 
> formatting might also be an influence..
> 
> Anyways, my formatting of code requires rather much space(s) and thus 
> might not be appreciated by anyone. Though, if you'd like to take a peak 
> on it, here are some files with hopefully interesting formatting :)
> 
> http://trac.brainsware.org/libodf/browser/branches/d/odf/OpenDocument.d
> http://trac.brainsware.org/libodf/browser/branches/d/odf/Content.d
> 
> Basically, everything that is not contextually connected is placed in a 
> new paragraph, which means:
> 
> <code>
> set;
> of;
> instructionsContextA;
>                          // teh space.
> set;
> of;
> instructionsContextB;
> </code>
> 
> A function is always written as follows:
> 
> <code>
> Type functionName (T) ( T1 a, T2 b ) {
> 	/// code...
> }
> 
> // or
> 
> Type functionName ( T1, T2 ) ( T1 a, T2 b ) {
> 	/// code...
> }
> </code>
> 
> Classes are similar to that:
> 
> <code>
> class Foo (T) { // or "( T1, T2 )" as above
> 	Type     alignedMembers;
>          TypeType alignedMemberFoos;
> 	T        buh;
> }
> </code>
> 
> ..etc. Hope that helps.
> 
> Kind regards,
> Alex




More information about the Digitalmars-d mailing list