如何更改 Visual Studio Code 中的格式选项? [英] How do you change the formatting options in Visual Studio Code?

查看:53
本文介绍了如何更改 Visual Studio Code 中的格式选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道你可以在 Visual Studio Code 中使用 Ctrl+F/Cmd+F 格式化代码,但是您如何更改每种语言的格式选项?

I know you can Format Code using Ctrl+F / Cmd+F in Visual Studio Code but how do you change the formatting options for each language?

例如,在 Visual Studio 2013 中,我可以为 CSS 选择紧凑模式.

For example, in Visual Studio 2013 I can choose compact mode for CSS.

是否有另一个隐藏的 JSON 文件可以做到这一点?

Is there another hidden JSON file to do that?

推荐答案

在 VS 代码中:

Ctrl+Shift+P

然后输入Format Document With...

在列表末尾点击Configure Default Formatter...

现在您可以从列表中选择您最喜欢的美化工具.

Now you can choose your favorite beautifier from the list.

2021 年更新

如果 Format Document With..." 不再存在,请转到 file ->偏好 ->设置 ->扩展 ->Vetur 滚动一点然后你会看到 format ->defaultFormatter:css,现在您可以为不同的文件类型扩展名选择您之前安装的任何文档格式化程序.

if "Format Document With..." doesn't exist any more, go to file -> preferences -> settings -> Extensions -> Vetur scroll a little bit then you will see format -> defaultFormatter:css, now you can pick any document formatter that you installed before for different file type extensions.

这篇关于如何更改 Visual Studio Code 中的格式选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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