I writing typescript
and html
files, and the tabs become to spaces. It's the first time I am using Visual Studio Code.
I tried to change the settings and restart, but nothing changed.
The settings i configured:
// Place your settings in this file to overwrite default and user settings.
{
"editor.insertSpaces": false
}
I tried google it and I found that I did the right step when I added insertSpaces
to true
, but it's not changing my preferences...
EDIT 1:
I found that the tabs work in html
files, but not ts
files...
To change tab settings, click the text area right to the Ln/Col text in the status bar on the bottom right of vscode window.
The name can be
Tab Size
orSpaces
.A menu will pop up with all available actions and settings.
In my case, the problem was JS-CSS-HTML Formatter extension installed after january update. The default indent_char property is space. I uninstalled it and the weird behavior stops.
Below settings are worked well for me,
Above settings will reflect and applied to every files. You don't need to indent/format every file manually.
Check this from official vscode setting:
File -> Preferences -> Settings
(or just pressCtrl+,
, and search forspaces
, then just deactivate this option:I had to reopen the file so the changes take effect.
There are 3 options:
editor.detectIndentation
detects it from your file, you have to disable it. If it didn't help, check that you have no settings with higher priority. For example when you save it to User settings it could be overwritten by Workspace settings which are in your project folder.Update:
Now you have alternative to editing those options manually.
Click on selector Spaces:4 at the bottom-right of the editor:
When you want to convert existing ws to tab, install extension from MarketplaceEDIT:
To convert existing indentation from spaces to tabs hit
Ctrl+Shift+P
and type:This will change the indentation for your document based on the defined settings to Tabs.