Bug 3001 - On-the-fly-code-formatting should not act when modifying existing code
Summary: On-the-fly-code-formatting should not act when modifying existing code
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Mike Krüger
Depends on:
Reported: 2012-01-20 22:04 UTC by Andres G. Aragoneses
Modified: 2012-01-22 01:30 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Andres G. Aragoneses 2012-01-20 22:04:21 UTC
On-the-fly-code-formatting is great, but is not very welcomed when modifying existing code (as it creates a lot of noise in the diff).

For example, an if-else block like this:

            if (field.Equals (ComposerField)  ||
                field.Equals (GenreField)     ||
                field.Equals (ComposerField)  ||
                field.Equals (ConductorField) ||
                field.Equals (CommentField)) {

                blah ();

            else if (field.Equals (LastPlayedField)  ||
                     field.Equals (LastSkippedField) ||
                     field.Equals (DateAddedField)   ||
                     field.Equals (YearField) ) {
                bleh ();

Here the OR operators are aligned together for greater visibility. If one needs to add an extra "field.Equals()" element, then all OR operators are going to be resetted to a different position by the on-the-fly-code-formatting feature.
Comment 1 Mike Krüger 2012-01-21 02:09:37 UTC
I see no way to "fix" things like that - either it formats or it doesn't
Comment 2 Andres G. Aragoneses 2012-01-21 20:44:52 UTC
Well, it could be done using VCS metadata:

- new file -> new code
- existing file -> check the part of the file where the user is writing.
Comment 3 Mike Krüger 2012-01-22 01:30:09 UTC
There are not only VCS controlled files and if you reopen a file that is not checked in -> same problem.

You're requestesting basically that the formatting shouldn't follow it's rules and  be a "do what I want" feature - that's not something I'll try out. (But I accept patches if the behaviour is really working out)

Another issue is that  VCS & diff is atm very slow in MD, on the fly formatting on key stroke is slow enough.