I was just setting up visual studio code so that my python code uses tabs for indentation. Now when I press enter, instead of VSC putting in the correct amount of tabs to stay in the indent, it converts them to spaces. I have seen so many posts that deal with the opposite problem but not with this one. Has this happened to anyone?
example:
counter = 0
while True:
print("Hello World")
counter+=1
if counter == 1:
print(counter)
#now when I pressed enter it added only two spaces instead of two tabs
My tab size is set to 4 and I have tried turning on/off the insert spaces setting, and Detect Indentation. Also I have tried clicking on the tab size in the right corner and using the menu there, but nothing has fixed this.
go to your settings.json file and look for "editor.formatOnType" and turn that off for both global (if exists), and language specific section. this setting seems to reformat new lines incorrectly after applying the language specific indentation settings.
you can also look for the setting in ctrl shift p, search for configure language specific settings, select python, and look for "format on type", and turn that off.