In most cases, the IDE determines that there should be a space before and after the curly braces in C# code. It does not determine either way for interpolated strings.
We should have a config that determines how the IDE handles this, and the IDE should actively reformat based on this setting.
Brief description:
In most cases, the IDE determines that there should be a space before and after the curly braces in C# code. It does not determine either way for interpolated strings.
We should have a config that determines how the IDE handles this, and the IDE should actively reformat based on this setting.
Suggested name: csharp_space_around_string_insert Values: false, before, after, before_and_after
Languages applicable:
C#
Code example that the analyzer should report:
For example, if you create an array and add an initialization list, the IDE adds the spaces for you, like this:
If you intentionally omit the spaces, then do a "Format Document" command, the IDE adds them back.
However, this is treated differently for an interpolated string. The IDE doesn't care how you do it.
For example, if you create an interpolated string like this:
Notice that they are formatted differently. If you do a "Format Document", neither is changed.
Additional information:
This omission causes inconsistencies in codebases and should be rectified.
Documentation requirements:
When this analyzer is implemented, it must be documented by following the steps at Documentation for IDE CodeStyle analyzers.