Hacker News new | past | comments | ask | show | jobs | submit login

Do languages other than C# support formatter/convention configuration via EditorConfig? Or is C# going some other way here?

Ref: https://docs.microsoft.com/en-us/visualstudio/ide/editorconf...

It’s not a language feature but an editor feature. Editors often have built-in syntax-aware linters and refornatters that support additional rules you can put inside editorconfig files.

Visual Studio has built-in support for editorconfig and also supplies C#-specific formatting rules, hence why the web-page you linked-to exists.

I was looking at this just the other day not realizing it was something other than just a Microsoft thing. There didn't seem to be anything to deal with auto wrapping long lines by breaking them in sensible ways which is one of my favorite things about clang-format for C++. ReSharper does it for C# but doesn't do a very good job in my experience and ReSharper has such abysmal performance in Visual Studio that I've had to turn it off despite it having some useful features. The ability to smart wrap lines is something I haven't found a substitute for yet for C#.

I use a 40-inch 4K monitor running at 96dpi so I have evolved past the need to wrap long lines. Lines that are “too long” simply don’t exist!

I use a 43" 4K monitor as my main monitor and a 27" 1440p in portrait as my secondary. I typically have the Unity editor on my main monitor though and C# code on the secondary and in that arrangement with the font at a size I find comfortable I still need to wrap at around 120 columns. The other arrangement I sometimes use is two side by side windows on the 4K monitor and even that still has a width limit.

C# is pretty bad in this regard compared to C++ because the standard formatting rules of indenting namespaces and the fact that there are no free functions wastes a lot of the left hand side most of the time.

Yes. But my question is still unanswered: Do other editors provide something like this for other languages? It seems to me that it's a MS only thing.

I'm not sure this answers your question, but VS Code (MS still) does the same sort of thing for golang via gofmt on save.

I think it's enabled by default now.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact