简体   繁体   English

Visual Studio - 注释添加额外的缩进

[英]Visual Studio - Comments add an extra indent

I'm using Visual Studio 2015. Whenever I add any kind of comment, any new line after the comment has an extra indent. 我正在使用Visual Studio 2015.每当我添加任何类型的注释时,注释后面的任何新行都会有额外的缩进。 I have noticed this behavior in both C++ and C#. 我在C ++和C#中都注意到了这种行为。

This is what I get so far: 这是我到目前为止所得到的:

// Comment with correct indenting
     public void TestMethod() { }

It should be: 它应该是:

//Comment with corrent indenting
public void TestMethod() { }

How do I stop the former from happening? 如何阻止前者发生?

尝试使用Ctrl + K + D缩进整个文件....我认为这应该可以解决问题。

To remove the indentation automatically made by visual studio, select all code by pressing Ctrl+a , then Press Shift+Tab twice to remove the indentation that was automatically made by Visual Studio. 若要删除visual studio自动生成的缩进,请按Ctrl+a选择所有代码,然后按两次Shift+Tab以删除Visual Studio自动生成的缩进。

And if you want to disable that auto-formatting feature permanently: Goto Tool>Options>Text Editor>C#>Advanced (and then uncheck the options that are not required). 如果要永久禁用该自动格式化功能:转到工具>选项>文本编辑器> C#>高级 (然后取消选中不需要的选项)。

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

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