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

查看:104
本文介绍了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 带有 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.

您可以在菜单工具选项环境键盘中进行更改(通过选择其他选项键盘映射方案",或将各个键绑定到命令"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的 副本中,请查看菜单 Edit Advanced菜单-显示键菜单项的右侧,因此很容易发现它们在系统中的位置.

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.

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

(Please do not edit this answer to change the key bindings above to what your system has!)

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

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