editorconfig-vscode
editorconfig-vscode copied to clipboard
Add a way to ignore tab_size
Issue
Visual Studio Code | editorconfig-vscode | |
---|---|---|
Version | 1.58.2 |
0.16.4 |
Root .editorconfig
File
; Check http://editorconfig.org/ for more informations
root = true
[*]
indent_style = tab
tab_width = 8
trim_trailing_whitespace = true
insert_final_newline = true
[*.yml]
indent_style = space
indent_size = 2
[*.md]
indent_style = space
indent_size = 4
trim_trailing_whitespace = false
[*.py]
indent_style = space
indent_size = 4
Are there any other relevant .editorconfig
files in your project? No
Visual Studio Code Setting | Default | User | Workspace |
---|---|---|---|
editor.insertSpaces |
true |
____ |
____ |
editor.tabSize |
4 |
2 |
_ |
editor.trimAutoWhitespace |
true |
____ |
____ |
files.autoSave |
"off" |
"___" |
"___" |
files.insertFinalNewline |
false |
_____ |
_____ |
files.trimTrailingWhitespace |
false |
_____ |
_____ |
File opened
src\apply.c
Expected behavior
I want a way for my user preferred tab size to override what's in the editorconfig file.
Actual behavior
Their editorconfig file has tab_size
set to 8. Every time I open a file, or switch files, the extension automatically resets the tab width to 8. This is regardless of what is in my settings, or if I manually use "Indent Using Tabs" -> 2.
Additional comments or steps to reproduce
This issue can be observed on the libgit2 repo or any other repo that uses the tab_size
property.
I want to be able to view codebases using my preferred tab width. Currently, the only way for me to do this is to either turn off the editorconfig extension or to edit the .editorconfig file to delete the tab_size = 8
line, which shows up as a modification in git.
I'd prefer if there was a config option I could set that would ignore tab_size. When the indent style is set to spaces, the indent_size should continue to be respected.
I can't fit very many columns on my screen due to below average vision, which is why I reduce the tab size.
I don’t know if this is something the project should try to do. The primary goal of the project is to enforce editorconfig settings, including overriding vscode settings. It seems kind of contradictory to add a way to disable/ignore the extensions primary goal.
To me, the primary purpose of this extension is to make sure your indentation follows the same conventions as the project. If you change the tab width, you're still fundamentally using tabs... It's purely visual, and doesn't change the bytes you type into the file.
It has a possible minor impact to code auto-formatters, but those should be reading from project configs, not from VS code's tab width setting.
I think this could make sense, I was hoping for such a setting for a while as well. Unfortunately, I think it does also have an impact on things like line-length, though.
For example, if a project has the tab-size of 4, but you ignore it and visually stick with 2. Yes, the bytes are the same. However, you may not realize you're stepping over line-length limits now. Doesn't seem like great UX to get warnings for going over the line-length that doesn't match the line-length you're viewing, either.
Note: Not saying if I think this option is good or not, just noting a possible issue that may need to be considered.
Just ran into this. Yes, some means to do a client-size override on tab size when indenting with tabs without altering the global .editorconfig would be nice.
Especially if this could be some kind of "display only" feature, where vscode still secretly uses the config-defined tab-size for line-length calculations, but I realize that's basically fantasy.