dfmt options
Idan Arye via Digitalmars-d
digitalmars-d at puremagic.com
Sun Mar 15 11:12:24 PDT 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?
Are you planning on making all these options command-line flags?
When you invoke dfmt via an editor plugin it doesn't matter much
- but if there are a lots of options, having each editor support
all of them will require all the plugin maintainers to always
keep their plugins up to date. Otherwise, a team that wants to
use dfmt will be limited to the lowest common subset of
formatting options supported by the editors of all team members.
How about making dfmt read it's configuration from a file? That
way, a project can a dfmt.json file or something in it's root
directory, and all editors will point it to this file.
If you choose to use this approach, dfmt should also be able to
emit a template of this file(fully configured to the one true
style, whatever that may be), and you should consider if you want
to allow a default dfmt style file in the user's home directory
or if you want to force users that work on unconfigured projects
to always use the default(though it should be easy enough for an
editor plugin to allow the user to have a default style file).
More information about the Digitalmars-d
mailing list