Visual Studio 是否有格式代码快捷方式? [英] Is there a format code shortcut for Visual Studio?

查看:41
本文介绍了Visual Studio 是否有格式代码快捷方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Eclipse 中有一个快捷方式,Ctrl+Shift+F,重新缩进代码并修复注释和空行.是否有 Visual Studio 2010 的等效版本?

In Eclipse there is a shortcut, Ctrl+Shift+F, that re-indents code and fixes comments and blank lines. Is there an equivalent for Visual Studio 2010?

推荐答案

Visual Studio with C# 键绑定

要回答具体问题,在 C# 中,您可能会使用 C# 键盘映射方案,默认情况下将使用这些热键:

Visual Studio with C# key bindings

To answer the specific question, in C# you are likely to be using the C# keyboard mapping scheme, which will use these hotkeys by default:

Ctrl+E, Ctrl+D 格式化整个文档.

Ctrl+E, Ctrl+D to format the entire document.

Ctrl+E, Ctrl+F 格式化选择.

Ctrl+E, Ctrl+F to format the selection.

您可以在菜单 ToolsOptionsEnvironmentKeyboard(通过选择不同的键盘映射方案",或将单个键绑定到命令Edit.FormatDocument"和Edit.FormatSelection").

You can change these in menu ToolsOptionsEnvironmentKeyboard (either by selecting a different "keyboard mapping scheme", or binding individual keys to the commands "Edit.FormatDocument" and "Edit.FormatSelection").

如果您没有选择使用 C# 键盘映射方案,那么您可能会发现快捷键不同.例如,如果您不使用 C# 绑定,则键可能是:

If you have not chosen to use the C# keyboard mapping scheme, then you may find the key shortcuts are different. For example, if you are not using the C# bindings, the keys are likely to be:

Ctrl + K + D(整个文档)

Ctrl + K + D (Entire document)

Ctrl + K + F(仅限选择)

Ctrl + K + F (Selection only)

要找出哪些键绑定适用于您的 Visual Studio 副本,请查看菜单编辑高级菜单 - 显示了键位于菜单项的右侧,因此很容易发现它们在您的系统上的内容.

To find out which key bindings apply in your copy of Visual Studio, look in menu EditAdvanced menu - the keys are displayed to the right of the menu items, so it's easy to discover what they are on your system.

(请不要编辑此答案以将上面的键绑定更改为您的系统所拥有的!)

这篇关于Visual Studio 是否有格式代码快捷方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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