pba*_*nis 3 c# editorconfig visual-studio-2022
当我在 VS 2022 中剪切并粘贴以下 C# 文本时:
public int? Units { get; set; }
Run Code Online (Sandbox Code Playgroud)
它将其粘贴格式为:
public int? Units
{
get; set;
}
Run Code Online (Sandbox Code Playgroud)
需要调整什么 .editorconfig 规则来告诉 VS 我希望我的自动实现的属性保留在一行上?
另外,对于衷心的奖励积分(但没有实际积分),有没有一个好的方法可以让我自己找到这些信息?我用谷歌搜索这个直到我的眼睛流血,并且我尽可能长时间地搜索“选项”->“文本编辑器”->“C#”->“代码样式”下的选项,但没有运气。
在 .editorconfig UI 中,它是:
Whitespace -> Wrapping preferences -> Leave block on single line (checked)
Run Code Online (Sandbox Code Playgroud)
在 .editorconfig 文件中,添加:
csharp_preserve_single_line_blocks = true
Run Code Online (Sandbox Code Playgroud)
虽然这个问题现在已经得到解答,但当我想不出要搜索的正确单词或短语时,我仍然发现自己在尝试弄清楚如何在这些情况下找到这些选项时感到沮丧。在某种程度上,它只需要运气,这并不能让代码猴子快乐。
| 归档时间: |
|
| 查看次数: |
826 次 |
| 最近记录: |