Use tabs instead of space in VSCode when writing Python?

Viewed 387

How does one make the formatter in VSCode use tabs instead of spaces for indentation when programming in Python? I have already set VSCode to use tabs, but the formatter for Python ignores that and just does its own thing.

I've been trying to Google around, but I am only seeing results telling me how to do the opposite, ie. spaces instead of tabs, but that is not what I want. I tried to look at autopep8, which VSCode seems to be using for this formatting, but I can't find anything useful there, either.

1 Answers

You can use the editorconfig extension.

Create a .editorconfig at the root of the project and specify your configuration.

root = true

[*] # extensions of the files
indent_style = tab
indent_size = 2

Run format document after that and.. viola!

Related