Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why don't IDEs support dynamic formatting?

Tags:

formatting

ide

Given all the holy wars surrounding various code formatting styles, and many companies' strict formatting requirements, why don't IDEs allow dynamic reformatting of code?
By that I mean have the IDE format the code the way the user wants it every time, and save the code without any formatting at all. (Well maybe line breaks so that diffs are still easy)
The user wouldn't have to worry about adhering to a coding standard, people wouldn't get bent out of shape over working in code that's not formatted just how they like it, and formatting changes wouldn't show up in repository diffs.
There's have to be some mechanism for turning it off so it doesn't screw up old, pre-formatted code, but otherwise, what's keeping this from becoming a standard feature?

Edit: I'm aware that some IDEs have an reformat feature, but that causes almost as many problems as it solves -- source control diffs become nearly useless as the actual changes are lost in a sea of insignificant formatting changes, and different tab character widths still knock things out of alignment. Also, it doesn't let programmers work with the code in their preferred format.

like image 537
Whatsit Avatar asked May 22 '09 16:05

Whatsit


1 Answers

Because most people like to see the code as it will be committed. Unless all of the tools you use to view your code (diff programs, grep, web based source repository viewers, etc) understand how to dynamically format the code the same way, you're going to be confused by different formattings when you look at it in your IDE vs. the other tools.

I agree it would be nice if we had more structural programming tools, rather than fixed width text tools, but it would require updating everything in your tool chain to really make it workable.

like image 149
Brian Campbell Avatar answered Sep 22 '22 08:09

Brian Campbell