Jump to page: 1 27  
Page
Thread overview
dfmt options
Mar 14, 2015
Brian Schott
Mar 14, 2015
ketmar
Mar 14, 2015
Walter Bright
Mar 14, 2015
Brian Schott
Mar 15, 2015
Walter Bright
Mar 15, 2015
Daniel Murphy
Mar 15, 2015
Dicebot
Mar 15, 2015
Sönke Ludwig
Mar 15, 2015
Orvid King
Mar 15, 2015
Walter Bright
Mar 15, 2015
ketmar
Mar 15, 2015
Mathias Lang
Mar 15, 2015
ketmar
Mar 15, 2015
Jonathan M Davis
Mar 15, 2015
Walter Bright
Mar 15, 2015
Dicebot
Mar 15, 2015
Walter Bright
Mar 15, 2015
Dicebot
Mar 15, 2015
Brian Schott
Mar 15, 2015
Szymon Gatner
Mar 15, 2015
Walter Bright
Mar 15, 2015
Jonathan M Davis
Mar 15, 2015
Walter Bright
Mar 15, 2015
weaselcat
Mar 15, 2015
Idan Arye
Mar 15, 2015
Walter Bright
Mar 15, 2015
Jonathan M Davis
Mar 15, 2015
ketmar
Mar 15, 2015
John Colvin
Mar 15, 2015
Martin Nowak
Mar 17, 2015
Dragos Carp
Mar 14, 2015
Walter Bright
Mar 14, 2015
Brian Schott
Mar 15, 2015
Walter Bright
Mar 15, 2015
Mathias Lang
Mar 15, 2015
weaselcat
Mar 15, 2015
Meta
Mar 15, 2015
Dicebot
Mar 17, 2015
Jacob Carlborg
Mar 15, 2015
Daniel Murphy
Mar 15, 2015
Rikki Cattermole
Mar 15, 2015
ketmar
Mar 15, 2015
Rikki Cattermole
Mar 15, 2015
ketmar
Mar 15, 2015
Rikki Cattermole
Mar 15, 2015
ketmar
Mar 15, 2015
ketmar
Mar 15, 2015
Walter Bright
Mar 16, 2015
Rikki Cattermole
Mar 16, 2015
Idan Arye
Mar 16, 2015
Brian Schott
Mar 17, 2015
Jacob Carlborg
Mar 17, 2015
ketmar
Mar 15, 2015
anonymous
Mar 15, 2015
Idan Arye
Mar 16, 2015
Brad Anderson
Mar 16, 2015
Idan Arye
Mar 17, 2015
Jacob Carlborg
Mar 22, 2015
Martin Nowak
Mar 23, 2015
Jacob Carlborg
Mar 23, 2015
bearophile
Mar 23, 2015
Jacob Carlborg
Mar 23, 2015
Casper Færgemand
Mar 23, 2015
Martin Nowak
Mar 27, 2015
Shammah Chancellor
Mar 27, 2015
Martin Nowak
March 14, 2015
First, a disclaimer: I am an idiot for starting this thread.

Moving on...

I'm working on a list of configuration options for dfmt - a formatter for D source code.

So far I have the following:

* Insert spaces between if, while, for, foreach, etc loops and the "("
* Allman vs One True Brace Style (Already supported by commant-line switch)
* Operators at the end of the old line vs beginning of the new line when wrapping long expressions.
* Insert space after the ")" of a cast expression
* Make "case" and "default" match the indent level of the enclosing "switch"
* Labels for loops always on their own line vs the same line as the loop
* Labels outdented one level
* Label indentation matches the most recent "switch"
* Hard limit for line length
* Soft limit for line length

What am I missing?
March 14, 2015
On Sat, 14 Mar 2015 23:15:34 +0000, Brian Schott wrote:

> First, a disclaimer: I am an idiot for starting this thread.
> 
> Moving on...
> 
> I'm working on a list of configuration options for dfmt - a formatter for D source code.
> 
> So far I have the following:
> 
> * Insert spaces between if, while, for, foreach, etc loops and the "("
> * Allman vs One True Brace Style (Already supported by commant-line
> switch)
> * Operators at the end of the old line vs beginning of the new line when
> wrapping long expressions.
> * Insert space after the ")" of a cast expression * Make "case" and
> "default" match the indent level of the enclosing "switch"
> * Labels for loops always on their own line vs the same line as the loop
> * Labels outdented one level * Label indentation matches the most recent
> "switch"
> * Hard limit for line length * Soft limit for line length
> 
> What am I missing?

optional space before arguments in function declaration, if you please. i.e.:

  void foo();

vs

  void foo ();


March 14, 2015
On 3/14/2015 4:15 PM, Brian Schott wrote:
> What am I missing?

I suggest defining "The One True Way" and have no configuration options.
March 14, 2015
On 3/14/2015 4:15 PM, Brian Schott wrote:
> What am I missing?

I'd also suggest making dfmt an algorithm. Then people can use it like map, reduce, filter, etc., in their programs. dfmt as a program then becomes incidental and trivial.
March 14, 2015
On Saturday, 14 March 2015 at 23:51:51 UTC, Walter Bright wrote:
> On 3/14/2015 4:15 PM, Brian Schott wrote:
>> What am I missing?
>
> I'd also suggest making dfmt an algorithm. Then people can use it like map, reduce, filter, etc., in their programs. dfmt as a program then becomes incidental and trivial.

I'm not sure if you're trolling or not. I mean, when you said that writing a D lexer and parser was a weekend project I knew that you were, but with this I'm not sure.
March 14, 2015
On Saturday, 14 March 2015 at 23:49:00 UTC, Walter Bright wrote:
> I suggest defining "The One True Way" and have no configuration options.

I hope you like tabs as much as I do.
March 15, 2015
On Saturday, 14 March 2015 at 23:49:00 UTC, Walter Bright wrote:
> On 3/14/2015 4:15 PM, Brian Schott wrote:
>> What am I missing?
>
> I suggest defining "The One True Way" and have no configuration options.

At which point you realize that "The One True Way" is wrong, ask for it to be changed, and are then told that it is "The One True Way".

Take tabs vs. spaces for instance, phobos' style guide states that indents should be 4 spaces, but I'd much prefer it to be a single tab.

Correct me if I'm wrong, but I believe the purpose of a formatter is to make the formatting of the code consistent in the way that the user wants it to be.
March 15, 2015
2015-03-15 0:15 GMT+01:00 Brian Schott via Digitalmars-d < digitalmars-d@puremagic.com>:
>
> What am I missing?
>

I suggest you fire a recent version of Visual Studio and go to tools /
Options / Tet editor / C# (or C/C++) / Formatting. There you got a bunch of
formatting options. Maybe not all of them are relevant, but that can give
some good ideas.
There can be an (almost) endless stream of possibility for formatting,
especially if you throw in the comments (e.g. put the comment for enums at
the EOL, or always comment using '/**'...).
Personal request: enforce that every block has a set of parenthesis.


March 15, 2015
On Saturday, 14 March 2015 at 23:15:35 UTC, Brian Schott wrote:
> First, a disclaimer: I am an idiot for starting this thread.
>
> Moving on...
>
> I'm working on a list of configuration options for dfmt - a formatter for D source code.
>
> So far I have the following:
>
> * Insert spaces between if, while, for, foreach, etc loops and the "("
> * Allman vs One True Brace Style (Already supported by commant-line switch)
> * Operators at the end of the old line vs beginning of the new line when wrapping long expressions.
> * Insert space after the ")" of a cast expression
> * Make "case" and "default" match the indent level of the enclosing "switch"
> * Labels for loops always on their own line vs the same line as the loop
> * Labels outdented one level
> * Label indentation matches the most recent "switch"
> * Hard limit for line length
> * Soft limit for line length
>
> What am I missing?

Have you given clang's formatter options a read over? It might spark an idea or two.
http://clang.llvm.org/docs/ClangFormatStyleOptions.html
March 15, 2015
On Saturday, 14 March 2015 at 23:15:35 UTC, Brian Schott wrote:
> First, a disclaimer: I am an idiot for starting this thread.
>
> Moving on...
>
> I'm working on a list of configuration options for dfmt - a formatter for D source code.
>
> So far I have the following:
>
> * Insert spaces between if, while, for, foreach, etc loops and the "("
> * Allman vs One True Brace Style (Already supported by commant-line switch)
> * Operators at the end of the old line vs beginning of the new line when wrapping long expressions.
> * Insert space after the ")" of a cast expression
> * Make "case" and "default" match the indent level of the enclosing "switch"
> * Labels for loops always on their own line vs the same line as the loop
> * Labels outdented one level
> * Label indentation matches the most recent "switch"
> * Hard limit for line length
> * Soft limit for line length
>
> What am I missing?

Maybe nobody else does this, but I prefer to write switch cases in an indented block style.

switch (expr)
{
    case 0:
        //Do stuff
    end;

    case 1 .. case 9:
        //Do other stuff
    end;

    default:
        //Do default stuff
}




In the same way, I indent attribute labels in classes/structs. I'm positive almost nobody else does that, however, so it's probably not an option you want to enable.

class Test
{
    private:
        //Methods, members

    public:
        //etc.
}
« First   ‹ Prev
1 2 3 4 5 6 7