如何在Visual Studio中自动设置代码格式? [英] How do you auto format code in Visual Studio?

查看:478
本文介绍了如何在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.FormatSelectionEdit.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

这篇关于如何在Visual Studio中自动设置代码格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆