visual studio code – VSCode Extension to fix inconsistent tab issue of Python
visual studio code – VSCode Extension to fix inconsistent tab issue of Python
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.
By default vscode use four spaces instead of a tab. See your configuration options:
When opening a file,
editor.tabSize
andeditor.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 wheneditor.detectIndentation
is on.
editor.insertSpaces: true
The number of spaces a tab is equal to. This setting is overridden
based on the file contents wheneditor.detectIndentation
is on.
editor.tabSize: 4
visual studio code – VSCode Extension to fix inconsistent tab issue of Python
- 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
Related posts
- python – Converting string into datetime
- Python – TypeError: int object is not iterable
- python – How do I sort a dictionary by value?
- Does Python have a string contains substring method?
- python – Convert bytes to a string
- What is the Python equivalent for a case/switch statement?
- python – How do I list all files of a directory?