Assuming I am only using VS Code as the editor, is there an advantage to include a .editorconfig file in a project if I already have workspace settings saved. Or, a disadvantage: such as .editorconfig potentially overwrite my VS Code settings or vice-versa?
Basically, .editorconfig
has advantages when:
or
the .editorconfig
file is usually committed into the code repo so it can be used by multiple people working on the same repo. This enables you to have code consistency across all team members. You might like using tabs
but the rules are set to use spaces
. Sorry, team rules override your personal rules. Consistency wins.
VSCode workspace settings (or any built in IDE workspace settings) can be individually configured (per person) and thus could be different and make the files in the repository, inconsistent. You might use tabs
while other people use spaces
and it messes things up for everyone because now you're all fighting on coding style(s).
.editorconfig
files might require a 3rd part extension to work with your IDE (which is the case with VSCode) while IDE workspace settings are baked in to the IDE (no extra download(s) required). NOTE: Visual Studio (as opposed to VSCode) has this baked in.
IDE's usually allow you to 'backup' your IDE settings ... so it's true you can backup your settings and use them later on.
Not everyone in a team always uses the same IDE's. Again, means nothing if you're just working solo on something.
First off .editorconfig
only works in VSCode using a plugin. The advantage for .editorconfig
is that other editors also recognize it. The advantage for VSCode workspace settings is that it doesn't require a plugin and can include more settings.
From what I can tell .editorconfig
takes precedence over user and workspace settings. Although I couldn't find an official statement on this (but also one hint is that they mention this not being true for one of the settings as a bug).
I would use .editorconfig
for what I can and include VSCode workspace config for the remaining settings. I'd avoid conflicting settings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With