How to set Python language specific tab spacing in Visual Studio Code?
I had the same problem today.
This is how I fixed it. Add this lines in setting.json in VSCode:
"[python]": { "editor.insertSpaces": true, "editor.tabSize": 4 }
It works like a charm.
Python should be tab=4 spaces (replaced as spaces), and Ruby should be tab=2 spaces...
Install the editor config plugin.
ext install EditorConfig
Add an .editorconfig
file to your project root with Python and Ruby specific settings:
[*.py]indent_style = spaceindent_size = 4[*.rb]indent_style = spaceindent_size = 2
These are other supported properties:
tab_widthend_of_lineinsert_final_newlinetrim_trailing_whitespace
See also:
- Editor: Detect Indentation = false (default = true)
- Editor: Insert Spaces = true (default)
- Editor: Tab Size = 4 (default)