Razor code formatting updates in ReSharper and Rider
Note: check our series about code formatting engine updates in ReSharper and Rider for more background.
ReSharper makes it possible to add (or remove) line breaks before and after specific language constructs. We can configure this in the ReSharper options, under Code Editing | Razor | Code Style. As with any code style settings, we can preview the effect of enabling/disabling the option from the preview pane:
Another place where blank lines and line breaks make sense is when using Razor helpers,
@section statements. Typically, these statement blocks are utilities that are used elsewhere in a Razor template, and by adding some whitespace around them it is much easier to focus while working in the editor.
In the ReSharper options, find these under Code Editing | Razor | Code Style:
Note that we have also implemented .EditorConfig support for Razor code formatter options. More information about the EditorConfig properties is available from our web help.
The code style setting will be applied when editing or pasting code, using a refactoring or code generation action, or by reformatting code (e.g. by selecting a piece of code and then using Alt+Enter | Format Selection or the Reformat Code action).
Download ReSharper 2017.3 and give it a try! We’d love to hear your feedback!
Subscribe to Blog updates
Thanks, we've got you!
Visualize Entity Framework Relationships and Additional Query Analysis in ReSharper 2023.3
A lot of teams are using Entity Framework or EF Core to work with their database. As an Object-Relational Mapper (ORM), it bridges objects in code to a relational database model, so that as a developer you don’t have to worry too much about the actual database. We all know: that’s not entirely tr…
Automatically Analyze ASP.NET Core Performance With Dynamic Program Analysis
Slow web pages may make your users or customers abandon your web application, even before they’ve had a proper look at it. You’ve likely also been frustrated working with a web application that is slow to load. The good news is that the latest versions of ReSharper and JetBrains Rider’s Dynamic P…
OSS Power-Ups: MassTransit – Webinar Recording
The recording of our webinar, OSS Power-Ups: MassTransit, with Chris Patterson, is available. This was the thirteenth episode of our OSS Power-Ups series, where we put a spotlight on open-source .NET projects. Subscribe to our community newsletter to receive notifications about future webinars.…
Eager, Lazy and Explicit Loading with Entity Framework Core
Entity Framework Core (EF Core) supports a number of ways to load related data. There’s eager loading, lazy loading, and explicit loading. Each of these approaches have their own advantages and drawbacks. In this post, let’s have a quick look at each of these ways to load data for navigational prope…