How to set tab size is already answered here.
But how to have different settings for different file types? E.g. I want the tab size for HTMLs to be 2, but for other files to be 4.
VS Code configures language specific settings in settings.json
Example of setting.json changing tabsize
{
"[sass]": {
"editor.tabSize": 2
},
"[html]": {
"editor.tabSize": 4
},
"[javascript]": {
"editor.tabSize": 2
}
}
These are not nested inside any other object, they are defined at the root.