Re:EditorConfig – file format for defining coding styles and...
by majewsky on Friday July 21, 2017 @04:25AM
(#14818935)
Looks like 99% of this is covered by my editor being configured to autodetect existing indentation, and adjust itself accordingly: https://github.com/ciaranm/detectindent
[ Parent
| on HN ]
Re:EditorConfig – file format for defining coding styles and...
by HyperMassive on Friday July 21, 2017 @07:11AM
(#14819499)
I think you might be missing the point, not everyone (your collaborators) will use the same editor, the same white-space rules.
And some developers couldn't care less about consistent code and quality at all.
But having a EditorConfig file means writing none compliant code becomes a defiant choice.
Re:EditorConfig – file format for defining coding styles and...
by to3m on Friday July 21, 2017 @07:57AM
(#14819657)
Typically the whitespace rules are part of the standards as well. Spaces after if, spaces after commas, spaces before stars, after stars, around stars, alignment, newlines, two spaces after a full stop in a comment, the full works. People have spent entire meetings trying to come to agreement on this stuff. And then afterwards people keep checking in stuff that's "wrong", not intentionally, but because they've spent literally their entire lives doing it the other way, and they're stuck with the muscle memory.
If you want the computer to make your entire codebase look roughly the same, you'll need more than a .editorconfig file...
(For C and C++, I've been quite pleased with clang-format, provided somebody else gets to set it up. Of course, as well as the code layout, it also sorts out tabs vs spaces, line ending type, and indent width.)
Re:EditorConfig – file format for defining coding styles and...
by mathw on Friday July 21, 2017 @09:27AM
(#14820320)
EditorConfig's not about that kind of whitespace though. That's a language-specific thing, best solved with an autoformatting tool like the utterly magnificent one that comes with Go.
I don't much care for Go the language, but shipping a formatter with the compiler is an utterly genius move.
Re:EditorConfig – file format for defining coding styles and...
by rxdazn on Friday July 21, 2017 @07:12AM
(#14819502)
it's meant to be used within teams, with people who might not have the same editor (or the same set of plugins) as you
you just drop an .editorconfig at the root of your project and you'll know for sure that any code written by anyone will have the same indentation, encoding, and final newline config
Re:EditorConfig – file format for defining coding styles and...
by ewanm89 on Friday July 21, 2017 @08:51AM
(#14820022)
The other useful case is when you open project on another machine for some reason and you find your usual editor not installed and configured. Open any editor and away you go with this, for those quick dirty edits. I require all editors installed to be able to read .editorconfig files and use them accordingly.
Re:EditorConfig – file format for defining coding styles and...
by majewsky on Friday July 21, 2017 @07:48AM
(#14819623)
Is that widely implemented enough to be useful? Because I'm literally seeing this for the first time today.
Re:EditorConfig – file format for defining coding styles and...
by JetSpiegel on Friday July 21, 2017 @06:55AM
(#14819440)
See also vim-sleuth