save text files with the newline convention present in the file when opened
The Visual Studio text file editor has an "advanced save" option that allows me to choose a particular format to save to, every time I save a file.
However, 99% of the time, the right thing to do is to save the file using whatever convention was present when the file was originally opened. Thus, if I open a file with LF-style line termination, new lines I add should be terminated with LF, and the file should be saved as LF-terminated. If I open a file with CRLF convention, new lines I *** should be terminated with CRLF, and it should be saved CRLF terminated. Repeat for each convention you want to support.
Currently, the text editor inserts CRLF for newlines, no matter what the convention in the file was when opened. This generates files with mixed-convention line endings, which is a terrible thing to work with.
Users should not have to know which convention is present in a file when opening, and then be forced to choose that convention when saving, to have the right thing happen. Users should also not have to choose a particular convention in a "convert to" menu before saving. Both of those options add significant, continuous, drag on workflow, and, being manual steps, cause errors to be made.
Visual Studio can detect the convention automatically, and can automatically do the right thing, and would be a much better text editor if it did.
New files can be created using whatever default you want (CRLF, for example) without user intervention. It's the insistence on inserting CRLF into files that are not loaded with CRLF endings that's the biggest sin.
Microsoft knows this. They aren't stupid. But they are a bit short sighted. As usual, they find little ways to make life difficult for developers targeting multiple platforms. And no, when I say multiple platforms, I don't mean multiple Windows platforms.
This (smart newlines) is a standard feature on -all- modern non-Microsoft IDE editors. There are no exceptions.
Paulo Renato Nascimento commented
This behavior is specially annoying when switching back and forth between Visual Studio and Xamarin Studio while developing Xamarin.iOS applications. Having a clever convention or even a project-wide setting would be a much welcomed feature, indeed.
Also, save in ascii by default if possible if the charcters in the file do not need unicode. This helps detect unintentially pasting in a non-ascii character into a source file. SQL Server manager's editor needed this for over 8 years starting with SQL Server 2005.