简体   繁体   English

Visual Studio格式化整个文件?

[英]Visual Studio Format entire file?

是否可以使用CodeRush Express发出关键命令来正确格式化VS2008中的整个文件?

Use Ctrl + K + Ctrl + D to format document keystroke 使用Ctrl + K + Ctrl + D格式化文档按键

Use Ctrl + K + Ctrl + F to format selection keystroke 使用Ctrl + K + Ctrl + F格式化选择键

It's also possible to set your own keystrokes by opening Options... dialog (select Tools->Options from the menu). 也可以通过打开“选项...”对话框来设置自己的击键(从菜单中选择“工具”->“选项”)。 In Options dialog select Environment->Keyboard form the tree and set your own shortcuts for Edit.FormatDocument. 在“选项”对话框中,从树中选择“环境”->“键盘”,然后为Edit.FormatDocument设置自己的快捷方式。

You could always go to Tools -> Options -> Keyboard and give the Edit.FormatDocument a new shortcut. 您总是可以转到“ 工具”->“选项”->“键盘”,并为Edit.FormatDocument提供新的快捷方式。

Update You can also see what the Shortcuts mapped to this command are this way. 更新您还可以通过这种方式查看映射到此命令的快捷方式。

Ctrl + K , Ctrl + D Ctrl + KCtrl + D

This question with answers has a lot of handy tips. 这个带答案的问题有很多方便的提示。

Visual Studio中用于格式化整个文档的快捷方式是Ctrl + ED

Just select all content of page by Ctrl + A then click Ctrl + K and Ctrl + D . 只需按Ctrl + A选择页面的所有内容,然后单击Ctrl + KCtrl + D即可 The whole page tag format. 整个页面标签格式。

For example see this link: Format the content 例如,请参见以下链接: 格式化内容

If Ctrl + E + Ctrl + D or Ctrl + K + Ctrl + D or Ctrl + K + Ctrl + F doesn't work for you, try to set below settings: 如果Ctrl + E + Ctrl + D Ctrl + K + Ctrl + D Ctrl + K + Ctrl + F对您不起作用,请尝试设置以下设置:
Tools->Options -> Text Editor ->C# ->Tabs , Tools->Options -> Text Editor ->C# ->Tabs
make sure `Keep tabs is selected. 确保选择了“保留标签”。
Then, go back to your text editor, re-try formatting. 然后,返回到文本编辑器,重试格式化。

I was really annoyed before, and steps above works for me. 之前我真的很烦,上面的步骤对我有用。 hope it works for you guys.. 希望它对你们有用。

我只是使用内置的Visual Studio格式化命令: Ctrl + AAlt + F8

在Visual Studio Express 2013中, 按Ctrl + E + D

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

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