Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upseparate rust-format or rustfmt tool that does the pretty-printing #3195
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
I would prefer it to be a separate tool. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
graydon
Aug 29, 2012
Contributor
Yeah, this is going to move out to a separate tool a la gofmt along with something similar to gofix that has archived copies of old grammars and knows how to migrate code forward between language versions. I'll rename this bug.
|
Yeah, this is going to move out to a separate tool a la |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Note: this is a relative bug of #2238 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
nominating for backwards-compatible milestone |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
nikomatsakis
Apr 25, 2013
Contributor
if possible, I'd prefer to retain the option (perhaps with -Z) to print out the expanded+identified tree. The reason is that it is very common for me to take a rustc FOO BAR ZED command line and tack on --pretty expanded+identified so that I can know what all the node ids refer to.
|
if possible, I'd prefer to retain the option (perhaps with -Z) to print out the |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
graydon
May 7, 2013
Contributor
Marking as a metabug and collecting in dependencies: #751 #850 #2951 #5181
Also note that https://github.com/dbp/rustfmt does contain a sketch. But the tool frontend is less the hard part. Getting the pp in good enough state to take over is the hard part.
|
Marking as a metabug and collecting in dependencies: #751 #850 #2951 #5181 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
What's the status of this? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
cmr
Jul 23, 2013
Member
The pretty printer becomes more and more broken as time goes on. @MaikKlein was working on a separate rust format, even had a PR for it.
|
The pretty printer becomes more and more broken as time goes on. @MaikKlein was working on a separate |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
MaikKlein
Jul 24, 2013
Contributor
@cmr I was using pretty printer for the formating. But I realized it was pretty broken. It often didn't even parse legit code. I wanted to do some work to improve the pretty printer but I had no time.
|
@cmr I was using pretty printer for the formating. But I realized it was pretty broken. It often didn't even parse legit code. I wanted to do some work to improve the pretty printer but I had no time. |
This was referenced Aug 22, 2013
catamorphism
referenced this issue
Sep 16, 2013
Closed
Pretty-printer moves comments in do- and for-loop above (and outside) loop #7485
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
cc me |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Ryman
May 14, 2014
Contributor
@pcwalton has a repo relevant to this https://github.com/pcwalton/rustfmt
|
@pcwalton has a repo relevant to this https://github.com/pcwalton/rustfmt |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
SirVer
Jan 4, 2015
+1 for this. Feels pretty essential these days with clang-format (great!) and gofmt (so-so) setting standards.
SirVer
commented
Jan 4, 2015
|
+1 for this. Feels pretty essential these days with clang-format (great!) and gofmt (so-so) setting standards. |
lifthrasiir
referenced this issue
Jan 14, 2015
Closed
Is there any official formatter or linter? #21128
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
caizixian
commented
Jan 14, 2015
|
What's the status of this? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
The status is the same. Would love to have it, don't have one yet. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
caizixian
commented
Jan 15, 2015
|
@steveklabnik Is there any official style guide? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
steveklabnik
Jan 21, 2015
Member
I'm pulling a massive triage effort to get us ready for 1.0. As part of this, I'm moving stuff that's wishlist-like to the RFCs repo, as that's where major new things should get discussed/prioritized.
This issue has been moved to the RFCs repo: rust-lang/rfcs#648
|
I'm pulling a massive triage effort to get us ready for 1.0. As part of this, I'm moving stuff that's wishlist-like to the RFCs repo, as that's where major new things should get discussed/prioritized. This issue has been moved to the RFCs repo: rust-lang/rfcs#648 |
dbp commentedAug 14, 2012
It would be really nice to have the pretty printer be good enough to use it as a code formatter, ala gofmt. It still has some issues (I've been working on it), but it is reasonably close to being usable in that way.
But, the commandline invocation is kind of unwieldy (and feels redundant). It seems like --pretty should just pretty print, and other stuff should be handled secondarily, ie with:
--pretty-expanded
--pretty-typed
--pretty-expanded-identified
--pretty-identified
Alternatively, perhaps it would make more sense to actually split it into a separate binary, called rustfmt (or, in longer-keyword land, rustformat).
Thoughts?