3 ms·
There's no round trip in the editors I've used. You have the standard formatting, and that's it. What you type in will get rearranged in situ so it's in the rig
by to3m 11y ago
There's no round trip in the editors I've used. You have the standard formatting, and that's it. What you type in will get rearranged in situ so it's in the right format. If you prefer something else - well, good luck with that, because you can type it in, and it will compile, but you run the risk of somebody doing something that will cause the file to be reformatted and you'll end up with the standard layout anyway. Best get used to it now. (As I understand it, gofmt is very similar.)
This functionality is actually a benefit, because you can type in something like this:
public Fred(int[]x):base(x){
UpdateStuff();}
and the editor sorts it out, something like this:
public Fred(int[] x)
:base(x)
{
UpdateStuff();
}
No need to wear out your space bar and/or Return key putting the formatting in. Visual Studio has got a fair idea of what sort of stuff might have been formatted thet way deliberately, too, so single-statement controlled statements won't get their own line by default, and when opening and closing braces are on the same line the code is left that way. It pretty much always just works. (C/C++ isn't quite as good - maybe 85% of the way there.)
I don't really have a problem with automatically making everybody's code look pretty much the same.
- vidarh 11y ago> There's no round trip in the editors I've used. My point exactly. It's an incredibly hard problem. > You have the standard formatting, and that's it. Which is why I don't use any of those editors, and won't ever do so. > This functionality is actually a benefit, because you can type in something like this: Every editor I've used in the last 20-30 years or so has been able to do that, but none of them have forced me into a specific formatting that I can't override. That's the difference. > I don't really have a problem with automatically making everybody's code look pretty much the same. Well, I do, and enough people I've worked with do (EDIT: The issue is not making everybody's code the same; the issue is that I'm not willing to have a specific format dictated to me and so unless everyone will format their code like me I won't use tools that attempt to force a single style), and so any attempt to standardise tooling like that just ensures that environment/language has one more barrier against adoption. There's plenty of people like me that avoid Python "just" over significant indenting for example.
- to3m 11y agoWell I did say that I expect fixed formatting will become more common over time. Having to press the space bar less is one reason. Discussions such as this one are another ;)