简体   繁体   English

ReSharper格式:禁用删除空间以创建匿名对象

[英]ReSharper formatting: disable remove spaces for anonymous object creation

I'm not sure if my title is entire accurate, however, I would like to disable the feature in ReSharper formatting where it removes spaces upon formatting. 我不确定标题是否完全正确,但是我想禁用ReSharper格式化功能,该功能会在格式化时删除空格。 The following image describes the behaviour (red = before format, green = after format) 下图描述了行为(红色=格式化前,绿色=格式化后)

: ReSharper格式

As you can see the spaces before id and after fileId are removed, so: 如您所见,删除idfileId之后的空格,因此:

new { id = fileId } --> new {id = fileId} new { id = fileId } -> new {id = fileId}

I would like to disable this behaviour, and actually (if possible) enforce the leading and trailing space. 我想禁用此行为,并实际上(如果可能)强制执行前导和尾随空格。 I can't find what the option is called in the ReSharper -> Options -> C# -> Formatting Style -> Spaces tab. 我在ReSharper->选项-> C#->格式样式->空格选项卡中找不到该选项的名称。

Any help would be greatly appreciated 任何帮助将不胜感激

You can keep the spacing with the option: Within single-line initializer braces . 您可以使用以下选项保持间距: Within single-line initializer braces
It can be found here: Resharper -> Options -> Code editing -> C# -> Formatting Style -> Spaces 可以在这里找到: Resharper->选项->代码编辑-> C#->格式设置->空格 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM