Over the past few ReSharper releases, we completely rewrote our code formatting engine. By doing this rewrite, we are able to iterate and innovate more rapidly.
In the latest ReSharper 2017.3 EAP releases, we have started to build on top of these rewritten foundations, guided by the most-voted feature requests in our issue tracker. Let’s start a blog series and look at the various improvements!
This post is part of a series around changes in the ReSharper and Rider code formatter:
- Code formatting engine updates in ReSharper and Rider
- Different code styles for different blocks of code
- Aligning code in columns
- Configuring code formatting from code selection
New code formatting options in ReSharper and Rider 2017.3
For example in ReSharper C++, we can now configure outdenting for
-> in chained method calls, and for commas. For HTML, there are new options for configuring linebreaks before multiline elements or even before all elements.
Both ReSharper 2017.3 EAP and Rider 2017.3 EAP come with a large number of existing and new code formatting options. Here’s a list of some of the new options:
- All languages (C#/C++/JS/TS/HTML/Protobuf)
- Disable/enable/change settings for code formatter with comments
- Disable formatter using
.editorconfigfile masks that have
- Option to keep extra space inside (to respect user alignment around existing
- Alignment in columns inside code
- Options to outdent binary operators, dots and commas
- Option “Nested ternary expression style”
- Option to insert blank lines before/after statements: depending on their contents
- Improve alignment of nested binary expressions and chained method calls
- Line Breaks and Wrapping options to place attributes on same line/previous line, specify arrangement of attributes, …
- Options to specify single-line/multi-line formatting for expression-bodied members
- Options for embedded blocks of code
- HTML formatter has new options for linebreaks before multiline elements or even before all elements
- C++ adds outdenting for
->in chained method calls, and for commas
And many, many more! In the next post, we’ll look at two awesome new features made possible by our code formatter rewrite: disabling/enabling/configuring the code formatter for different blocks of code, and chopping long lines of code.
Download ReSharper 2017.3 EAP and give it a try! We’d love to hear your feedback!