VSCode Extension to fix inconsistent tab issue of Python

VS Code is very intuitive in this regard. Just to illustrate the way to solve it in two clicks.

First focus on the bottom right corner of your PC.

enter image description here

Here click on spaces.

Context window will open which will give us the option to convert indentations to spaces. Click on convert indentation to spaces and you are done.

enter image description here


You can fix the tab inconsistency by converting all indentation to tab or spaces. If you open the "Show All Commands" tab, ( by pressing Ctrl+Shift+P or F1 ) and search for "convert indentation", two options will by available:

  • convert indentation to tabs
  • convert indentation to spaces

Just choose tabs if you use tabs or spaces if use spaces as your indentation method.


  1. click : ctrl+shift+p or right click on the mouse and select 'Command Plate' - this will prompt a list. 2.select from list: 'Convert Indentation to Spaces'

By default vscode use four spaces instead of a tab. See your configuration options:

When opening a file, editor.tabSize and editor.insertSpaces will be detected based on the file contents.

  "editor.detectIndentation": true

Insert spaces when pressing Tab. This setting is overridden based on the file contents when editor.detectIndentation is on.

  "editor.insertSpaces": true

The number of spaces a tab is equal to. This setting is overridden based on the file contents when editor.detectIndentation is on.

  "editor.tabSize": 4