Vscode: Tab size and space / tab settings annoying behaviour.

Created on 12 Apr 2017  路  6Comments  路  Source: microsoft/vscode

I have tab indent size set at 2 and using spaces in both my User and Workspace settings. If I open a file created elsewhere (project generator created files for example) that have tab indentation of 4, I would expect to be able to just hit SHIFT-ALT F to format that document and have my tab settings applied. This does not happen. I have to go to the tab size indicator in VS Codes status bar, click on that and select 'Indent Using Spaces' and then click on '2 Configured Tab Size'.

This then allows me to use SHIFT-ALT F to apply my preferred tab sizes to most file types but, confusingly, this does not seem to work for .cshtml files, which seem to insist on retaining whatever tab size they were created with.

Is this intended behaviour?

  • VSCode Version: Code 1.11.1 (d9484d12b38879b7f4cdd1150efeb2fd2c1fbf39, 2017-04-06T13:58:12.954Z)
  • OS Version: Windows_NT ia32 10.0.15063
  • Extensions:

|Extension|Author|Version|
|---|---|---|
|html-snippets|abusaidm|0.1.0|
|azuretoolsforvscode|bradygaster|1.2.1|
|vscode-eslint|dbaeumer|1.2.8|
|vscode-babel-coloring|dzannotti|0.0.4|
|vscode-npm-script|eg2|0.1.9|
|azure-iot-toolkit|formulahendry|0.0.11|
|CppSnippets|hars|0.0.7|
|beautify|HookyQR|1.0.2|
|rest-client|humao|0.14.1|
|csharpextensions|jchannon|1.3.0|
|vscode-nuget-package-manager|jmrog|1.1.2|
|Angular2|johnpapa|2.2.3|
|vscode-extension-auto-import|moppitz|1.3.3|
|mssql|ms-mssql|0.3.0|
|cpptools|ms-vscode|0.10.5|
|csharp|ms-vscode|1.8.1|
|PowerShell|ms-vscode|0.12.2|
|vscode-azureextensionpack|ms-vscode|0.0.4|
|team|ms-vsts|1.115.0|
|azurerm-vscode-tools|msazurermtools|0.3.4|
|vscode-docker|PeterJausovec|0.0.13|
|view-in-browser|qinjia|0.0.5|
|vscode-icons|robertohuertasm|7.5.1|
|yo|samverschueren|0.9.3|
|aspnet-helper|schneiderpat|0.6.3|
|vscode-gulp|tanato|0.0.4|
|usql-vscode-ext|usqlextpublisher|0.1.13|
|application-insights|VisualStudioOnlineApplicationInsights|0.4.1|
|bootstrap-3-snippets|wcwhitehead|0.0.9|
|wilderminds-aspnetcore-snippets|wilderminds|0.2.1|;


Steps to Reproduce:


  1. 2.
*question

Most helpful comment

Yeah over and over and over and over and over no matter what you put in settings. There are no "workplace" settings any more. Nothing I'm doing in settings is changing the tab size from 2 to 4. I have to keep setting it.

All 6 comments

@Seefer Here are the 3 indentation settings that control our behaviour:

image

I believe you would like to set "editor.detectIndentation": false

You can also use per-language indentation settings. e.g. :

"[javascript]": { "editor.tabSize": 2, "editor.insertSpaces": false, "editor.detectIndentation": false }

"editor.detectIndentation": false

This does indeed change behaviour to what I was expecting, thanks! Did not know per-language settings were also possible.

However, .cshtml files still refuse to reformat with SHIFT-ALT+F. Very odd :)

In my project, it defaults to 2 spaces and I have to enter 4 spaces and trigger Detect to make it 4.

Yeah over and over and over and over and over no matter what you put in settings. There are no "workplace" settings any more. Nothing I'm doing in settings is changing the tab size from 2 to 4. I have to keep setting it.

.editorconfig file? Just found this. It has the tab settings that are overriding VSCode user settings. No clue where this came from.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DovydasNavickas picture DovydasNavickas  路  3Comments

borekb picture borekb  路  3Comments

ryan-wong picture ryan-wong  路  3Comments

lukehoban picture lukehoban  路  3Comments

vsccarl picture vsccarl  路  3Comments