I'm using VS Code to edit projects in multiple languages (mostly Ruby, PHP and Javascript) and for each language we have different indentation models (spaces/tabs and width). Looks like VS Code supports this as it allows both editor.insertSpaces
and editor.tabSize
to be set to "auto"
which is a per-language definition.
But while editor.tabSize
looks to do about what I want, editor.insertSpaces
always insert spaces when in "auto"
mode.
I've tried to find where one can edit the per-language configuration but have found no such setting. I've also looked in the language directories under resources/app/client/vs/languages
but have failed to find something that specifies these features.
Any idea how to customize the per-language settings?
VS Code Auto Format On SaveOpen Visual Studio Code editor. Click the “Settings” gear icon in the bottom-left corner. Search “Formatter” and click the “Editor: Default Formatter” option. From the drop-down menu, select whichever code formatter you want to use.
You can open the settings.json file with the Preferences: Open Settings (JSON) command in the Command Palette (Ctrl+Shift+P). Once the file is open in an editor, delete everything between the two curly braces {} , save the file, and VS Code will go back to using the default values.
To use perlanguage settings, you use the [language_id]
in square brackets:
example:
{ "[typescript]": { "editor.formatOnSave": true, "editor.formatOnPaste": true }, "[markdown]": { "editor.formatOnSave": true, "editor.wrappingColumn": 0, "editor.renderWhitespace": "all", "editor.acceptSuggestionOnEnter": false } }
Update: editor.tabSize
and editor.insertSpaces
are now supported in version 1.10
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With