简体   繁体   English

无法使用VS代码格式化文档

[英]Cannot format document in VS code

I tried ctrl+K Ctrl +F, and searching the command palette for "format" but nothing comes up. 我试过ctrl + K Ctrl + F,然后在命令面板中搜索“格式”,但没有任何反应。 VS code says Ctrl+K ctrl+f is not a command. VS代码说Ctrl + K ctrl + f不是命令。

Just upgraded to x64 VS code for windows 10 yesterday. 昨天刚刚升级到Windows 10的x64 VS代码。 Still not working. 还是行不通。 File is an XML file that is open from a project. 文件是从项目打开的XML文件。 All XML is currently on one line. 当前所有XML都在一行上。

Am I missing some extension or something? 我是否缺少扩展名或其他内容?

You can only use CTRL+K CTRL+F when you have selected text. 选择文本后,只能使用CTRL+K CTRL+F Otherwise, if you want to format the whole document, you should use ALT+Shift+F 否则,如果要格式化整个文档,则应使用ALT+Shift+F

You need to install a VS Code extension that provides formatting support for XML. 您需要安装VS Code扩展,以提供对XML的格式支持。

You can try the XML Language support by Red Hat , which supports some formatting preferences specific to XML. 您可以尝试Red Hat提供XML语言支持 ,它支持一些特定于XML的格式设置首选项。

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

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