digitalmars.D - dfmt - D source code formatter
- Walter Bright (2/2) Jul 04 2012 It would be nice to have a D source code formatter. But it needs a champ...
- Andrei Alexandrescu (3/5) Jul 04 2012 Yes please.
- Jonathan M Davis (4/6) Jul 04 2012 Doesn't that need a lexer and parser for D first (which I'd _love_ to do...
- Walter Bright (3/8) Jul 04 2012 Yes.
- Paulo Pinto (7/19) Jul 04 2012 Personally I would rather see it as a separate tool.
- Paulo Pinto (7/19) Jul 05 2012 Somehow my reply seems to have been lost.
- Jonathan M Davis (8/10) Jul 05 2012 It will be eventually, but someone (or several someones) will have to ta...
- Jens Mueller (4/6) Jul 05 2012 I'm using uncrustify (http://uncrustify.sourceforge.net/). It does most
- maarten van damme (4/10) Jul 05 2012 I'm using uncrustify too although it has the annoying habbit of
- Brian Schott (5/9) Jul 14 2012 Creating a formatter that works *well* is a larger challenge than
- Jens Mueller (4/17) Jul 05 2012 Have you tried adding an issue?
- Jacob Carlborg (5/7) Jul 05 2012 It's a great idea but as others have said, I see no point in creating
- Jacob Carlborg (9/11) Jul 05 2012 I just tried ddmd-clean and it already does some form of source code
- Brian Schott (4/6) Jul 05 2012 I'm already working on adding formatting to my general-purpose D
- Walter Bright (3/5) Jul 05 2012 I think that formatting the code is actually rather easy - the hard part...
- Brian Schott (7/9) Jul 05 2012 Eclipse has had a LOT of time and energy put into it, and it
- Walter Bright (3/12) Jul 05 2012 I agree that whatever is inside the comment should be left alone. I was ...
- Roman D. Boiko (3/5) Jul 05 2012 Why would that be more difficult to do than code formatting? I'm
- Brian Schott (25/30) Jul 05 2012 If the forum interface strips leading whitespace, this message
It would be nice to have a D source code formatter. But it needs a champion. Who's up for it?
Jul 04 2012
On 7/5/12 12:46 AM, Walter Bright wrote:It would be nice to have a D source code formatter. But it needs a champion. Who's up for it?Yes please. Andrei
Jul 04 2012
On Wednesday, July 04, 2012 21:46:29 Walter Bright wrote:It would be nice to have a D source code formatter. But it needs a champion. Who's up for it?Doesn't that need a lexer and parser for D first (which I'd _love_ to do but just haven't had time to get around to)? - Jonathan M Davis
Jul 04 2012
On 7/4/2012 10:22 PM, Jonathan M Davis wrote:On Wednesday, July 04, 2012 21:46:29 Walter Bright wrote:Yes. Or it could be written based on the .di generation logic, i.e. as part of dmd.It would be nice to have a D source code formatter. But it needs a champion. Who's up for it?Doesn't that need a lexer and parser for D first (which I'd _love_ to do but just haven't had time to get around to)?
Jul 04 2012
On Thursday, 5 July 2012 at 06:27:55 UTC, Walter Bright wrote:On 7/4/2012 10:22 PM, Jonathan M Davis wrote:Personally I would rather see it as a separate tool. D already gets a bit of bad publicity for having the compiler do too much stuff that should be relegated to separate tools. This is again another use case that would benefit from the "compiler as library".On Wednesday, July 04, 2012 21:46:29 Walter Bright wrote:Yes. Or it could be written based on the .di generation logic, i.e. as part of dmd.It would be nice to have a D source code formatter. But it needs a champion. Who's up for it?Doesn't that need a lexer and parser for D first (which I'd _love_ to do but just haven't had time to get around to)?
Jul 04 2012
On Thursday, 5 July 2012 at 06:27:55 UTC, Walter Bright wrote:On 7/4/2012 10:22 PM, Jonathan M Davis wrote:Somehow my reply seems to have been lost. I find it nice, but would rather see it as a separate tool. This are the type of projects that would benefit from having the compiler available as library. -- PauloOn Wednesday, July 04, 2012 21:46:29 Walter Bright wrote:Yes. Or it could be written based on the .di generation logic, i.e. as part of dmd.It would be nice to have a D source code formatter. But it needs a champion. Who's up for it?Doesn't that need a lexer and parser for D first (which I'd _love_ to do but just haven't had time to get around to)?
Jul 05 2012
On Thursday, July 05, 2012 11:11:28 Paulo Pinto wrote:This are the type of projects that would benefit from having the compiler available as library.It will be eventually, but someone (or several someones) will have to take the time to do it. Once I find the time, I intend to port the lexer (and later parser) from dmd's frontend to D, and I intended to have it done quite some time ago, but I haven't had the time, so it hasn't happened yet, and no one else has taken the time to do that (or if they have, they haven't finished the job). - Jonathan M Davis
Jul 05 2012
Walter Bright wrote:It would be nice to have a D source code formatter. But it needs a champion. Who's up for it?I'm using uncrustify (http://uncrustify.sourceforge.net/). It does most of the time what I want. Jens
Jul 05 2012
2012/7/5 Jens Mueller <jens.k.mueller gmx.de>:Walter Bright wrote:I'm using uncrustify too although it has the annoying habbit of rewriting => to = > causing all functions using the new lambda syntax to break.It would be nice to have a D source code formatter. But it needs a champion. Who's up for it?I'm using uncrustify (http://uncrustify.sourceforge.net/). It does most of the time what I want. Jens
Jul 05 2012
On Thursday, 5 July 2012 at 10:27:41 UTC, maarten van damme wrote:I'm using uncrustify too although it has the annoying habbit of rewriting => to = > causing all functions using the new lambda syntax to break.Creating a formatter that works *well* is a larger challenge than I first imagined, so I took a small break and fixed that bug in uncrustify. The pull request is here: https://github.com/bengardner/uncrustify/pull/86
Jul 14 2012
maarten van damme wrote:2012/7/5 Jens Mueller <jens.k.mueller gmx.de>:Have you tried adding an issue? I had different problems. Most where fixed. JensWalter Bright wrote:I'm using uncrustify too although it has the annoying habbit of rewriting => to = > causing all functions using the new lambda syntax to break.It would be nice to have a D source code formatter. But it needs a champion. Who's up for it?I'm using uncrustify (http://uncrustify.sourceforge.net/). It does most of the time what I want. Jens
Jul 05 2012
On 2012-07-05 06:46, Walter Bright wrote:It would be nice to have a D source code formatter. But it needs a champion. Who's up for it?It's a great idea but as others have said, I see no point in creating this until we have a D compiler available as a library. -- /Jacob Carlborg
Jul 05 2012
On 2012-07-05 06:46, Walter Bright wrote:It would be nice to have a D source code formatter. But it needs a champion. Who's up for it?I just tried ddmd-clean and it already does some form of source code formatting. It will format the following file: https://github.com/zachthemystic/ddmd-clean/blob/master/main.d To something like this: http://pastebin.com/JUauQDvb https://github.com/zachthemystic/ddmd-clean -- /Jacob Carlborg
Jul 05 2012
On Thursday, 5 July 2012 at 04:47:29 UTC, Walter Bright wrote:It would be nice to have a D source code formatter. But it needs a champion. Who's up for it?I'm already working on adding formatting to my general-purpose D tool. https://github.com/Hackerpilot/Dscanner
Jul 05 2012
On 7/4/2012 9:46 PM, Walter Bright wrote:It would be nice to have a D source code formatter. But it needs a champion. Who's up for it?I think that formatting the code is actually rather easy - the hard part will be dealing with the comments in a reasonable way.
Jul 05 2012
On Thursday, 5 July 2012 at 19:22:56 UTC, Walter Bright wrote:I think that formatting the code is actually rather easy - the hard part will be dealing with the comments in a reasonable way.Eclipse has had a LOT of time and energy put into it, and it still makes my javadoc uglier than it was before formatting. My thought is to properly indent/align comments, but other than that leave them unmodified. There are too many things that can go wrong with re-wrapping them (I'm imagining accidentally ruining somebody's carefully-crafted ASCII art diagram).
Jul 05 2012
On 7/5/2012 1:52 PM, Brian Schott wrote:On Thursday, 5 July 2012 at 19:22:56 UTC, Walter Bright wrote:I agree that whatever is inside the comment should be left alone. I was more talking about lining up comment blocks, etc.I think that formatting the code is actually rather easy - the hard part will be dealing with the comments in a reasonable way.Eclipse has had a LOT of time and energy put into it, and it still makes my javadoc uglier than it was before formatting. My thought is to properly indent/align comments, but other than that leave them unmodified. There are too many things that can go wrong with re-wrapping them (I'm imagining accidentally ruining somebody's carefully-crafted ASCII art diagram).
Jul 05 2012
On Thursday, 5 July 2012 at 22:25:15 UTC, Walter Bright wrote:I agree that whatever is inside the comment should be left alone. I was more talking about lining up comment blocks, etc.Why would that be more difficult to do than code formatting? I'm wondering.
Jul 05 2012
On Thursday, 5 July 2012 at 22:27:09 UTC, Roman D. Boiko wrote:On Thursday, 5 July 2012 at 22:25:15 UTC, Walter Bright wrote:If the forum interface strips leading whitespace, this message will look pointless. /** * This is easy */ // trivial // multi-line // comment /* This is a list where indenting is significant: * list item * other list item * How do we indent this? */ /* I want this to be fixed * because these lines are off by one space * and should be aligned */ /++ Ddoc is, IIRC, bad at handling leading spaces in code samples --- foo("hello world"); --- +/ void foo(string arg) {I agree that whatever is inside the comment should be left alone. I was more talking about lining up comment blocks, etc.Why would that be more difficult to do than code formatting? I'm wondering.
Jul 05 2012