Skip to content

Is it possible to display whitespace in output? #4839

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

Open
richardhboyd opened this issue May 15, 2021 · 2 comments
Open

Is it possible to display whitespace in output? #4839

richardhboyd opened this issue May 15, 2021 · 2 comments

Comments

@richardhboyd
Copy link

I'm working on creating some sample code that is heavily commented (as a teaching tool) and rustfmt was unhappy with trailing whitespace when I was using // on a line by itself to break up long blocks of text. the output showed

         // Payload: The response from the function, or an error object.
-        // 
+        //
         // For our example, we are just going to interact with the payload
         // portion of the response
         Ok(resp) => {

Which is rather confusing until you copy/paste the response and examine that one contains a space and the other doesn't. Would it be possible for rustfmt to identify this whitespace in some way? maybe like with the little dots that some IDEs use?

@calebcartwright
Copy link
Member

Thanks for reaching out! I'd be open to anything that provides more visual cues in these cases, but to be fully transparent doing so is a very low priority. Part of the challenge is that highlighting spacing can produce some very noisy/difficult to process diffs when you consider the entire realm of formatting changes beyond the simple trailing whitespace trim case shared in the description

There's a lot of other considerations that would fall under this bucket as well, such as conversions between tab and space characters, newline styles, etc.

@richardhboyd
Copy link
Author

Understandable. I didn't see an Issue for it so I figured I'd open one to track it. I think If I had read the docs before using rustfmt I probably wouldn't have been caught up by this.

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

No branches or pull requests

2 participants