如何在Visual Studio中自动设置代码格式?
问题描述:
我知道Visual Studio可以自动格式化以使我的方法和循环正确缩进,但是我找不到该设置.
I know Visual Studio can auto format to make my methods and loops indented properly, but I cannot find the setting.
答
格式化选择内容: Ctrl + K , Ctrl + F
To format a selection: Ctrl+K, Ctrl+F
格式化文档: Ctrl + K , Ctrl + D
To format a document: Ctrl+K, Ctrl+D
请参见预定义的键盘快捷键. (这两个是Edit.FormatSelection
和Edit.FormatDocument
.)
See the pre-defined keyboard shortcuts. (These two are Edit.FormatSelection
and Edit.FormatDocument
.)
在OS X上,请使用 CMD⌘键,而不要使用 Ctrl :
On OS X use the CMD ⌘ key, not Ctrl:
- 格式化选择内容: CMD⌘ + K , CMD⌘ + F
- 要格式化文档: CMD⌘ + K , CMD⌘ + D
- To format a selection: CMD ⌘+K, CMD ⌘+F
- To format a document: CMD ⌘+K, CMD ⌘+D