Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tab size not being respected #41542

Closed
mccreeker opened this issue Jan 12, 2018 · 2 comments
Closed

Tab size not being respected #41542

mccreeker opened this issue Jan 12, 2018 · 2 comments
Assignees
Labels
info-needed Issue requires more information from poster
Milestone

Comments

@mccreeker
Copy link

  • VSCode Version: 1.19.1
  • OS Version: Windows 10 Pro

Steps to Reproduce:

  1. Open a .php file and hit the Tab key.
  2. Notice it indents by 2 characters (while showing the tab arrow).
  3. Go to Settings and notice "editor.tabSize": 4,, "editor.insertSpaces": true, and "editor.detectIndentation": true,.
  4. Change the latter two to false in User Settings. Also try changing tabSize to 4 there as well.
  5. Save the file, close it, close the editor, open both back up again, and notice nothing has changed and the same problem happens on any file even with new typed or pasted tabs no matter what even if it's pasted from another source.

Does this issue occur when all extensions are disabled?: Yes

@vscodebot vscodebot bot added editor editor-core Editor basic functionality labels Jan 12, 2018
@alexdima
Copy link
Member

@mccreeker Those are indeed the 3 settings that influence what pressing Tab will do:

  // 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,

So, if you use:

  "editor.detectIndentation": false,
  "editor.insertSpaces": false,
  "editor.tabSize": 4,

All files will be opened with those settings. This will be confirmed in the status bar:
image

Here are some reasons why things might be not working for you:

  1. You have installed an extension that uses VS Code API to tweak those settings at runtime. e.g. editorconfig extension. Try with disabling all extensions.
  2. You have installed an extension that reimplements Tab. Try with disabling all extensions.
  3. You have workspace settings; you open a folder and the folder has a .vscode/settings.json file where the user settings are overwritten.
  4. You have modified your keybindings for Tab that it does something else than the default. Check your keybindings.json file.

@alexdima alexdima added info-needed Issue requires more information from poster and removed editor editor-core Editor basic functionality labels Jan 18, 2018
@alexdima alexdima added this to the Backlog milestone Jan 18, 2018
@mccreeker
Copy link
Author

So I checked that Spaces area at the bottom and noticed it said 2, clicked on it and changed it there, then did a 2nd review of all my settings and saw that "editor.tabSize": 2, was in Workspace Settings, which wasn't being respected before when I wanted to use that (for some reason, I'm not sure what I missed there), so I deleted it since I just want to use 4 now, restarted, and everything's working fine now. Thanks.

@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants