Export EditorConfig Code Style, Optimize References for SDK Projects, and More ReSharper 2019.1 EAP Updates

The latest ReSharper 2019.1 Early Access Preview (EAP) and Rider 2019.1 EAP builds come with a number of improvements to formatting and code cleanup. ReSharper can export code style settings to EditorConfig. In the editor, pressing backspace returns to the proper indent position in the editor. Analyze/optimize references now works for SDK projects and helps us remove unused package references. And there are a few more things, such as a new built-in code cleanup profile for applying code style settings. Let’s have a look, shall we?

DOWNLOAD ReSharper 2019.1 EAP

Export EditorConfig from ReSharper code style settings

Many teams are using EditorConfig to customize code style settings across IDEs and editors. From the ReSharper settings, under Code Editing | General Formatter Style, we can now export ReSharper’s code style settings to EditorConfig. We can export cross-editor options, as well as properties that are only supported by ReSharper/Rider.

Export .editorconfig from ReSharper code styles

Combined with the Format Selection | Configure… context action (Alt+Enter), we can visually update formatting rules and then export them as EditorConfig.

Edit formatting visually in editor

Typing assist for unindent on backspace

To help with indenting/unindenting code, we’ve added a new typing assist when pressing Backspace. Instead of moving the caret back one position at a time, pressing Backspace returns the caret to the proper indent position.

Backspace indents to proper position

We can change the behavior of this typing assist in ReSharper’s settings (under Environment | Editor | Editor Behavior):

Configure backspace indent typing assist

The following options are available:

  • To proper indent position (default) – When the caret is to the right of the proper indent, Backspace deletes the space to the proper indent. Otherwise, Backspace deletes the whole indent and moves to the previous line. This means that maximum 2 Backspaces are required to move to the previous line.
  • To nearest indent position – Backspace moves to the previous indent position.
  • Disabled – Speaks for itself, doesn’t it? 😉

Analyze/optimize references for SDK projects

Code bases evolve. Over time, we add new references and install NuGet packages into our projects. Removing those that are not in use is often more difficult. ReSharper 2019.1 comes with improvements to analyzing and optimizing references in our projects!

Next to analyzing project and assembly references, ReSharper now also checks for unused package references in SDK projects! Using the Optimize References… context menu for a project (Ctrl+Alt+Y), we can analyze and optimize references. When our project does not contain any code that uses a given reference, it will show as unused. We can easily uninstall unused packages and keep our project’s dependency tree clean!

Analyze and optimize package references

The Mark reference as used at runtime context menu can be used to inform ReSharper of references that are used implicitly (only at runtime). Even if there are no direct code dependencies on them, ReSharper will mark these references as being in use.

Other updates to formatting & code cleanup

In ReSharper 2018.3, we made customizing code style easier and faster, by detecting formatting and naming settings from existing code. In 2019.1, this detection now runs in the background, allowing you to continue coding while detection is running.

We have added a new option Place ‘System.*’ and ‘Windows.*’ namespaces first when sorting ‘using’ directives (find it in the ReSharper settings, under Code Editing | C# | Code Style | Reference Qualification and ‘using’ Directives). By default, ReSharper and Rider will place these namespaces first when ordering namespaces. When this option is disabled, namespaces will be ordered alphabetically. Namespace ordering is now also compatible with Visual Studio and StyleCop.

Another new formatting option helps inserting blank lines before or after a case <x>: statement (under Code Editing | C# | Formatting Style | Blank Lines).

Want to update your code to match code styles? A new built-in code cleanup (Ctrl+E, C) profile is now available for that: Reformat & Apply code styles.

Reformat and apply code styles with code cleanup

Give ReSharper 2019.1 EAP a go, or try these features in Rider 2019.1 EAP! We’d love to hear your feedback.

About Maarten Balliauw

Maarten Balliauw is a Developer Advocate at JetBrains, working on .NET tools. He focuses on .NET, Azure, web technologies and application performance. Maarten is a frequent speaker at various national and international events. In his free time, he brews his own beer. Follow him on Twitter or check his personal blog.
This entry was posted in How-To's and tagged , , , , . Bookmark the permalink.

11 Responses to Export EditorConfig Code Style, Optimize References for SDK Projects, and More ReSharper 2019.1 EAP Updates

  1. James says:

    Does the IIS Express feature work with Compound configurations ? I’m trying to launch several apps through IIS express but I’m having issues…

  2. Test says:

    When do you anticipate that we will stop seeing the message about depreciated APIs and have resharper load async, since Visual Studio 2019 will be launching next week?

  3. Test says:

    The above comment is in relation to 2019.3 still showing a message even though your release notes suggest async package loading should be working

    • That warning should be gone with 2019.1 EAP 3. Can you double check you are on that version (or newer) via the Extensions | ReSharper | Help | About ReSharper…. menu?

      • test says:

        Yes I can confirm that it still shows the warning messages:
        “One or more of your installed extensions will not be compatible with a future Visual Studio update” when I click manage performance, Resharper 2019.1 EAP 3 is listed under Depreciated APIs.

        I’ve installed it on 2 machines with the same results

        JetBrains Resharper Ultimate 2019.1 EAP3 Checked built 2019-03-26

        Visual Studio 2019 Rc4 (version 16.0.28721.148 )

  4. mu88 says:

    I’m already looking forward to have “Typing assist for unindent on backspace” in the public release of ReSharper!

    But one thing is not so clear to me: am I right that “Analyze/optimize references for SDK projects” scans for unused references and in case of anything found, it also removes the NuGet package from packages.config resp. CSPROJ file, whereas the “old” versions of ReSharper only remove the assembly reference but not the package?

  5. ahmadjavadi says:

    i’m still waiting to add a renaming feature for vs project like rider.

  6. Albert Weinert says:

    If you can sort System.* und Windows.* namespaces to the top, then you also should add Microsoft.* the that list.

Leave a Reply to Test Cancel reply

Your email address will not be published. Required fields are marked *