Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4840

How to control formatting of attributes with explicit expressions in Razor components using Rider with editor config setup

$
0
0

I can't for the life of me figure out how to do this, if possible.

When using explicit expressions as values for EventHandlers or actions on components, is there a way to define how you want them formatted when using code cleanup/formatting functions in the IDE? In this instance, I use Rider and I've tried going through all settings in the code style options to no avail.

Here's an example, the ValueChanged and TextChanged attributes here use expressions and I'd like them to be formatted something along the lines of this:

<DxComboBox    Data="@(cities ?? [])"    Value="@City"    ValueChanged="@((City? city) =>                  {                      if (city is not null && city != City)                          OnCityChanged(city);                  })"    TextChanged="@((string? cityName) =>                 {                     if (cityName is not null && cityName.Length > 0 && cityName != City?.Name)                         OnCityChanged(new City(cityName));                 })"    AllowUserInput="true"    ListRenderMode="ListRenderMode.Virtual"    SearchMode="ListSearchMode.AutoSearch"    SearchFilterCondition="ListSearchFilterCondition.Contains"/>

But no matter what I try, it will always get formatted into this:

<DxComboBox    Data="@(cities ?? [])"    Value="@City"    ValueChanged="@((City? city) => { if (city is not null && city != City) OnCityChanged(city); })"    TextChanged="@((string? cityName) => { if (cityName is not null && cityName.Length > 0 && cityName != City?.Name) OnCityChanged(new City(cityName)); })"    AllowUserInput="true"    ListRenderMode="ListRenderMode.Virtual"    SearchMode="ListSearchMode.AutoSearch"    SearchFilterCondition="ListSearchFilterCondition.Contains"/>

which, to me, is way less easy to read than the formatting with line breaks.

Is there a way to configure this using editorconfig?


Viewing all articles
Browse latest Browse all 4840

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>