New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

separate rust-format or rustfmt tool that does the pretty-printing #3195

Closed
dbp opened this Issue Aug 14, 2012 · 17 comments

Comments

Projects
None yet
@dbp
Contributor

dbp commented Aug 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?

@brson

This comment has been minimized.

Show comment
Hide comment
@brson

brson Aug 14, 2012

Contributor

I would prefer it to be a separate tool.

Contributor

brson commented Aug 14, 2012

I would prefer it to be a separate tool.

@graydon

This comment has been minimized.

Show comment
Hide comment
@graydon

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.

Contributor

graydon commented Aug 29, 2012

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.

@graydon

This comment has been minimized.

Show comment
Hide comment
@graydon

graydon Aug 29, 2012

Contributor

Note: this is a relative bug of #2238

Contributor

graydon commented Aug 29, 2012

Note: this is a relative bug of #2238

@graydon

This comment has been minimized.

Show comment
Hide comment
@graydon

graydon Apr 25, 2013

Contributor

nominating for backwards-compatible milestone

Contributor

graydon commented Apr 25, 2013

nominating for backwards-compatible milestone

@nikomatsakis

This comment has been minimized.

Show comment
Hide comment
@nikomatsakis

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.

Contributor

nikomatsakis commented Apr 25, 2013

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.

@graydon

This comment has been minimized.

Show comment
Hide comment
@graydon

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.

Contributor

graydon commented May 7, 2013

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.

@msullivan

This comment has been minimized.

Show comment
Hide comment
@msullivan

msullivan Jul 3, 2013

Contributor

What's the status of this?

Contributor

msullivan commented Jul 3, 2013

What's the status of this?

@cmr

This comment has been minimized.

Show comment
Hide comment
@cmr

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.

Member

cmr commented Jul 23, 2013

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.

@MaikKlein

This comment has been minimized.

Show comment
Hide comment
@MaikKlein

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.

Contributor

MaikKlein commented Jul 24, 2013

@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.

@pnkfelix

This comment has been minimized.

Show comment
Hide comment
@pnkfelix

pnkfelix Oct 11, 2013

Member

cc me

Member

pnkfelix commented Oct 11, 2013

cc me

@Ryman

This comment has been minimized.

Show comment
Hide comment
@Ryman

Ryman May 14, 2014

Contributor

@pcwalton has a repo relevant to this https://github.com/pcwalton/rustfmt

Contributor

Ryman commented May 14, 2014

@pcwalton has a repo relevant to this https://github.com/pcwalton/rustfmt

@SirVer

This comment has been minimized.

Show comment
Hide comment
@SirVer

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.

@caizixian

This comment has been minimized.

Show comment
Hide comment
@caizixian

caizixian Jan 14, 2015

What's the status of this?

caizixian commented Jan 14, 2015

What's the status of this?

@steveklabnik

This comment has been minimized.

Show comment
Hide comment
@steveklabnik

steveklabnik Jan 14, 2015

Member

The status is the same. Would love to have it, don't have one yet.

Member

steveklabnik commented Jan 14, 2015

The status is the same. Would love to have it, don't have one yet.

@caizixian

This comment has been minimized.

Show comment
Hide comment
@caizixian

caizixian Jan 15, 2015

@steveklabnik Is there any official style guide?

caizixian commented Jan 15, 2015

@steveklabnik Is there any official style guide?

@steveklabnik

This comment has been minimized.

Show comment
Hide comment
@steveklabnik

This comment has been minimized.

Show comment
Hide comment
@steveklabnik

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

Member

steveklabnik commented Jan 21, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment