Where extensible formatting breaks down
Imagine the following bit of code:
public void ImFeelingStandardToday(int i, int j, int k)
public void ImFeelingWhimsicalToday
int j, int l,
The first is the method as formatted by the standard rules we have in the formatting engine. The second is method of formatting that is nearly impossible to express with any kind of limited set of formatting functions. With an extensible model it might be possible to express rules that would make the second happen, but it would be very difficult to express in a rule based system the concepts of Standard versus Whimsical. You might as wel have rules based on:
- Am i coding during the day
- Am i coding with the sun in front of me or behind me
- Is it my brithday
So once you have some sort of model that allows rich rules you also need to ability to take a section of code and say “under no circumstances shall you format this code. This code carries a certain undefinable beauty under its current form and you shall not touch it”.
Unfortunately, it's not clear how one would go about doing this. You could use #regions, or specialized comments //*, but those end up changing your code thus potentially affecting it's 'being' (for lack of a better word).
You could make it an editor feature where you select a region of code and that's remembered in some special file (like breakpoints, etc). However, is that really good enough? What if you transfer that file to someone else. You don't want them mucking around with that formatting. So we need it to not actually touch the code, but travel around with the file. how to do that how to do that...
How about WinFS metadata? Or NTFS streams? We could store this additional strong information with the code that indicated our understanding of it on a higher level than just tokens without affectin gyour code at all. We could even try to be pretty smart about edits that happened outside of VS. Say you modify the file in notepad. A quick hash verification of the source would reveal that things were not the same anymore and we coudl prompt you if you wanted to preserve this structured data. Any thoughts on this?