如何在 VS Code 中为新文件设置默认文件类型? [英] How to set default file type for new files in VS Code?

查看:118
本文介绍了如何在 VS Code 中为新文件设置默认文件类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有时会在 VS Code 中编辑 JSON 文件,我想将默认文件类型设置为 Json(例如,单击 CTRLN 时)

I sometimes edit JSON files in VS Code, I would like to set the default file type to be Json (e.g. when clicking CTRLN)

我没有找到任何相关的设置,我使用 CTRL KM 但它不是很有效率.

I didn't find any related setting, I use CTRL KM but it's not very productive.

有没有办法设置默认文件类型?

Is there a way to set the default file type?

解决方法是使用 "files.defaultLanguage": "json"

推荐答案

点击 File –> Preferences –> SettingsCTRL + ,

Click File –> Preferences –> Settings or CTRL + ,

点击打开设置文件并查找files.defaultLanguage

Click to open the settings file and look for files.defaultLanguage

将光标移动到这一行或将鼠标悬停在其上,单击左侧显示的铅笔符号,单击Copy to Settings,然后在右侧窗格中添加文件类型.比如

Move the cursor to this line or mouse hover on it, click the pencil sign shown on the left, click the Copy to Settings, then add the file type in the right pane. such as

"files.defaultLanguage": "JSON",

CTRL + S 完成后

这篇关于如何在 VS Code 中为新文件设置默认文件类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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