Closed felixlinker closed 3 years ago
Some prefer spaces, some prefer tabs. Normally I would go by best practice / coding guidelines but Bohemia Interactive states that tabs and spaces both are okay aslong as they're consistant.
indent with two/four spaces or one tab. Do not mix these. SQF Best Coding Practices
Means there can be 4 valid cases:
Changing the width of tabs can be done with one setting and it automatically affects all files. Changing from 2 to 4 spaces or from 4 to 2 spaces however is more complicated as every file would have to be reformatted.
Same when changing from tabs to spaces. It's a bit safer to parse 1 tabulator to 2/4 spaces (can even be done via search/replace all) than converting 2/4 spaces to one tab - especially when the user didn't use autoformat or missed/has too many spaces somewhere in his project.
This is the main reason why I chose tabs over spaces as default, simply because it causes the least issues with user preferences. If someone has a better idea how to make everyone happy I'll implement it ;)
For your specific issue: In your vscode user settings you should be able to override the default settings once for all your current and future workspaces/projects/files:
"[sqf]": {
"editor.tabSize": 4,
"editor.insertSpaces": true
},
"[ext]": {
"editor.tabSize": 4,
"editor.insertSpaces": true
}
Hope this helps you.
Thanks for the pointer to the user configuration options.
I think it's suboptimal to set defaults regarding these settings. As you said - BIS leaves it open to the devs, so why alter it in the first place? Why not delete the default settings, e.g. in https://github.com/Armitxes/VSCode_SQF/blob/master/package.json#L101, and have the user settings be applied?
I'm not aware of any other extension that forces this by default, and I don't see a point in including this default.
I have the setting
editor.insertSpaces
set totrue
because I prefer indentation using spaces. In SQF or EXT files, however, the default setting always is to indent by tabs. It would be great if this could be addressed since I always have to alter the settings manually.