You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
insertSpaces = auto, new file, first indentation, tab not possible. #1747
When insertSpaces = auto is set and you create a new file, pressing the tab key will insert spaces rather than a tab character. This is a problematic default because it means there is no easy way to actually get the first tab into the file so the auto can start learning what the file's indentation mechanism is. If you want space indent, you can simply press the space bar a few times to start the learning process. In order to start a new file with tab indentation though you (currently) need to go find another file with a tab in it, copy the tab, and paste it into the new file.
I recommend having the fallback behavior for an empty file be that the space bar inserts spaces and the tab key inserts tabs. This way both camps (spaces and tabs) have the ability to reasonably start new files when in auto-mode.
I agree this setting is very bad designed. There should be insertSpaces, tabSize and autoDetectIndentation or something like that, with the former being the default for new files and the latter being a boolean if the editor should auto detect these for existing files. This should default to true.
Or, even better, merge editorconfig extension into core and read values from editorconfig in user home directory.
The default was recently changed from tab to space due to yaml not working with tabs. #498
I like your solution Felix Becker (@felixfbecker), pulling out "editor.insertSpaces": "auto" into its own config value and allowing specification of fallbacks.
RE: Editor config, there is currently an extension in the marketplace. It's not fully compatible with .editorconfig files yet I believe due to API limitations, but it does do tab style and size.
Anders Nilsson (@nilzona) Try using [*] instead of [*.*] and make sure you are using the correct plugin. The Microsoft EditorConfig plugin is deprecated in favour of the plugin from the EditorConfig community.
In March, there is a new setting editor.detectIndentation = true|false that replaces the usage of "auto" in editor.tabSize and editor.insertSpaces.
When editor.detectIndentation is true, and the file has sufficient hints (e.g. it is not empty, it contains indented lines), editor.tabSize and editor.insertSpaces will be overwritten. This allows to cover the new file case by using:
Even if the previous developer used tab's on the file I don't care I am using spaces :P so I make sure that I disable autodetection. But a Makefile is the only exception where things start breaking if I do that. Can Makefile's have a forced Tab no matter what the settings are?
Activity
MicahZoltu commentedon Jan 2, 2016
An alternate option would be to add a setting for empty file default (tab or spaces) and/or add a setting for each file type.
felixfbecker commentedon Jan 3, 2016
I agree this setting is very bad designed. There should be
insertSpaces,tabSizeandautoDetectIndentationor something like that, with the former being the default for new files and the latter being a boolean if the editor should auto detect these for existing files. This should default totrue.Or, even better, merge editorconfig extension into core and read values from editorconfig in user home directory.
KichangKim commentedon Jan 4, 2016
Strongly agree. When I make Makefile file, I suffered for this issue because Makefile needs Tab indent.
felixfbecker commentedon Jan 4, 2016
@kkc0923 That would be solved when editorconfig gets merged into core, because you can set different settings for different file types via globs.
KichangKim commentedon Jan 4, 2016
Felix Becker (@felixfbecker) Does you mean "Editor Config for VS Code" extension? If it is, I'll check it. Thanks.
Tyriar commentedon Jan 4, 2016
The default was recently changed from tab to space due to yaml not working with tabs. #498
I like your solution Felix Becker (@felixfbecker), pulling out
"editor.insertSpaces": "auto"into its own config value and allowing specification of fallbacks.RE: Editor config, there is currently an extension in the marketplace. It's not fully compatible with
.editorconfigfiles yet I believe due to API limitations, but it does do tab style and size.MicahZoltu commentedon Jan 4, 2016
The
.editorconfigextension is not currently compatible witheditor.insertSpaces: auto. See https://github.com/Microsoft/vscode-editorconfig/issues/12SamVerschueren commentedon Feb 12, 2016
Zoltu (@Zoltu) Use the EditorConfig plugin from
EditorConfigitself. Global settings beingautoare supported sincev0.2.2.nilzona commentedon Mar 15, 2016
Sam Verschueren (@SamVerschueren) I have this issue even if I use EditorConfig.
in my .editorconfig file:
in settings.json (user preferences):
Even so, a new file that is created always insert spaces when tabbing.
I have to paste some code with tabs, close the editor and re-open. Then it picks up the right tab setting.
SamVerschueren commentedon Mar 15, 2016
Anders Nilsson (@nilzona) Try using
[*]instead of[*.*]and make sure you are using the correct plugin. The Microsoft EditorConfig plugin is deprecated in favour of the plugin from the EditorConfig community.alexdima commentedon Mar 15, 2016
In March, there is a new setting
editor.detectIndentation = true|falsethat replaces the usage of "auto" ineditor.tabSizeandeditor.insertSpaces.When
editor.detectIndentationis true, and the file has sufficient hints (e.g. it is not empty, it contains indented lines),editor.tabSizeandeditor.insertSpaceswill be overwritten. This allows to cover the new file case by using:This will make new files use Tabs@4 and existing files will be scanned to detect their indentation.
gertcuykens commentedon Sep 12, 2016
Can there be a exception made for Makefile's :)
I always use
Even if the previous developer used tab's on the file I don't care I am using spaces :P so I make sure that I disable autodetection. But a
Makefileis the only exception where things start breaking if I do that. Can Makefile's have a forced Tab no matter what the settings are?felixfbecker commentedon Sep 12, 2016
Install the editorconfig extension