Skip to content
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

Soft wrapping for comments #535

Closed
little-dude opened this issue Oct 25, 2015 · 3 comments
Closed

Soft wrapping for comments #535

little-dude opened this issue Oct 25, 2015 · 3 comments
Labels
a-comments only-with-option requires a non-default option value to reproduce poor-formatting

Comments

@little-dude
Copy link

It seems that rusfmt wants comment lines to fit into 80 characters. To enforce that, it currently does hard wrapping whereas for comments, soft wrapping looks just nicer.

Example:

//! Terminal formatting library.
//!
//! This crate provides the `Terminal` trait, which abstracts over an [ANSI
//! Terminal][ansi] to provide color printing, among other things. There are two implementations,
//! the `TerminfoTerminal`, which uses control characters from a
//! [terminfo][ti] database, and `WinConsole`, which uses the [Win32 Console
//! API][win].
//!
//! # Examples

Becomes:

//! Terminal formatting library.
//!
//! This crate provides the `Terminal` trait, which abstracts over an [ANSI
//! Terminal][ansi] to provide color printing, among other things. There are
//! two implementations,
//! the `TerminfoTerminal`, which uses control characters from a
//! [terminfo][ti] database, and `WinConsole`, which uses the [Win32 Console
//! API][win].
//!
//! # Examples

Instead of:

//! Terminal formatting library.
//!
//! This crate provides the `Terminal` trait, which abstracts over an [ANSI
//! Terminal][ansi] to provide color printing, among other things. There are two
//! implementations, the `TerminfoTerminal`, which uses control characters from
//! a [terminfo][ti] database, and `WinConsole`, which uses the [Win32 Console
//! API][win].
//!
//! # Examples
@ustulation
Copy link

bump - running into this too. Is this going to land anytime soon or is it not a priority for long time ?

@nrc
Copy link
Member

nrc commented Oct 26, 2016

The plan is that we'll probably turn off formatting of comments altogether. I expect that to happen soon-ish. At the moment I'm concentrating on the formatting RFC process to try and establish default styles rather than Rustfmt, so development is likely to be slow, sorry.

@nrc nrc added the only-with-option requires a non-default option value to reproduce label Jan 16, 2017
@gnzlbg
Copy link
Contributor

gnzlbg commented Oct 26, 2017

This is still a pain. I want formatting of comments, but for example with max_width = 80 this:

/// Compare the lowest `f32` of both inputs for greater than or equal. The
/// lowest 32 bits of the result will be `0xffffffff` if `a.extract(0)` is
/// greater than or equal `b.extract(0)`, or `0` otherwise. The upper 96 bits of
/// the result are the upper 96 bits of `a`.

gets formatted into:

/// Compare the lowest `f32` of both inputs for greater than or equal. The
/// lowest 32 bits of the result will be `0xffffffff` if `a.extract(0)` is
/// greater than or equal `b.extract(0)`, or `0` otherwise. The upper 96 bits 
/// of
/// the result are the upper 96 bits of `a`.

IMO rustfmt needs to be able to reformat comments, doing soft-wrapping, and handling long URLs so that they can still be displayed by rustdoc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-comments only-with-option requires a non-default option value to reproduce poor-formatting
Projects
None yet
Development

No branches or pull requests

5 participants