Formatter should indent wrapped imports to same alignment as previous line
See original GitHub issueuse piston_window::{Button, clear, Context, Event, Input, Key, PistonWindow, text, types,
Transformed};
Should be formatted to
use piston_window::{Button, clear, Context, Event, Input, Key, PistonWindow, text, types,
Transformed};
According to rustfmt
0.6.3:
use piston_window::{Button, clear, Context, Event, Input, Key, PistonWindow, text, types,⏎
- Transformed};⏎
+ Transformed};⏎
@matklad Is the goal of the intellij-rust formatter is to default to what rustfmt
does? Just want to make sure I’m not reporting issues that aren’t actually in scope for where intellij-rust wants to go (but I assume this would be a positive).
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
How do I control indentation of wrapped lines in Visual Studio
So, frequently wrapped line starts at character 80 or 90! How can I make it always indent 4 characters from the previous line?...
Read more >SwiftFormat/Rules.md at master
A command-line tool and Xcode Extension for formatting Swift code - SwiftFormat/Rules.md ... Wrap braces in accordance with selected style (K&R or Allman)....
Read more >Code Style. Java | IntelliJ IDEA Documentation
Use this page to configure formatting options for Java files. ... IntelliJ IDEA will keep indents on the empty lines as if they...
Read more >Coding Conventions - Apache PDFBox
Wrapped lines should use either an indent of 4 or 8 characters or align with the expression at the same level on the...
Read more >Configuration · Scalafmt
If true , lines starting with the margin character | (or another if specified in the .stripMargin(...) call) will be indented differently. If...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes!
rustc
(and I thinkcargo
as well) uses some checks to find out if it’s running in an environment that supports colors. If not, the colored output is suppressed. But you can force it by passing the--color=always
option to the command (or explicitly suppress it by passing--color=never
).Cargo also supports the
--color
option, but it relies on other programs. For instance,cargo build
executesrustc
and passes some of its own options to the compiler, including--color
(if it has been specified explicitly). But when you executecargo clippy
, the--color
option is not passed torustc
(which is the actual clippy’s engine) because cargo treatsclippy
as a pluggable command and makes no assumptions on what options it supports.So,
cargo build --color=always
forces colored output in the underlyingrustc
command, whilecargo clippy --color=always
does not.The IntelliJ command output window handles output in a special way (for instance, it paints all the stderr output red), so we have to reconfigure it a bit and add the
--color=always
option every time we run a command that we know supports colored output.The IntelliJ terminal (and the outside one) works another way and is treated by
rustc
(as well as bycargo
) as color-friendly. So, no additional actions needed to force colors.I don’t know, what exactly is the difference in implementation of these two windows. Maybe Alexey can answer this. But the fact is that when you execute
cargo clippy --color=always
, the underlyingrustc
command remains unaware of this--color
option, so it fully relies on its checks (mentioned above) that fail to recognise the IntelliJ command output window as suitable for colored output. And here we are, with the red stderr text.