Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set default file type for new files in VS Code? [duplicate]

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)

enter image description here

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?

EDITED: The solution is to use "files.defaultLanguage": "json"

like image 612
Ofiris Avatar asked Jan 26 '18 06:01

Ofiris


People also ask

How do I change the default encoding code in Visual Studio?

In the bottom bar of VS Code, you'll see the label UTF-8. Click it to open the action bar and select Save with encoding. You can now pick a new encoding for that file.


1 Answers

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

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

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 after finishing

like image 50
ild flue Avatar answered Oct 22 '22 02:10

ild flue