在Visual Studio中,Windows上的Ctrl + K + F和Ctrl + K + D用于格式化,或在Visual Studio代码编辑器中“美化”代码的等效功能是什么?


当前回答

在Ubuntu上是Ctrl + Shift + I。

其他回答

在Visual Studio Code中,Shift+Alt+F的作用就像在Visual Studio中Ctrl+K+D的作用一样。

在我安装Mono for Mac OS X、DNVM和DNX之前,c#中的格式快捷方式对我不起作用。

在我安装Mono之前,自动格式化快捷键(Shift + Alt + F)只适用于.json文件。

在Mac上,Shift + Alt + F适合我。

你可以在菜单中检查键绑定:

菜单文件→首选项→键盘快捷键和过滤关键字“格式”。

选择文本,右键单击选区,选择选项“命令调色板”:

打开一个新窗口。搜索“格式”,并根据需要选择有格式的选项。

您可以在菜单文件→首选项→键盘快捷键中添加按键绑定。

{ "key": "cmd+k cmd+d", "command": "editor.action.formatDocument" }

或者像Visual Studio那样:

{ "key": "ctrl+k ctrl+d", "command": "editor.action.formatDocument" }