Bug 4837 - On the fly formatter formats too much
Summary: On the fly formatter formats too much
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: Trunk
Hardware: PC Mac OS
: Low enhancement
Target Milestone: 3.0
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2012-05-02 17:55 UTC by Mikayla Hutchinson [MSFT]
Modified: 2012-05-04 11:34 UTC (History)
3 users (show)

Tags:
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:
Status:
RESOLVED FIXED

Description Mikayla Hutchinson [MSFT] 2012-05-02 17:55:57 UTC
The on the fly formatter formats too much.

When it's triggered by a semicolon, it should format only that statement. When it's trigged by a closing brace, it should only format that block.
Comment 1 Mike Krüger 2012-05-03 00:13:40 UTC
No I don't think so.

The formatting should always try to enforce the style to the whole file. That it works currently just inside the method is a drawback.

At best anything would be formatted always. That it works atm just on ; and } is a drawback.
Comment 2 Mikayla Hutchinson [MSFT] 2012-05-03 12:56:19 UTC
This is a problem because it creates a lot of VCS noise on existing code. The on the fly formatter is supposed to fix the code you're editing, not the whole file.
Comment 3 Mike Krüger 2012-05-04 01:29:40 UTC
It's just formatting the method - which I find reasonable.
Comment 4 Lluis Sanchez 2012-05-04 07:53:25 UTC
I agree with Michael, the on-the-fly formatter must only format the statement or block you are modifying. Formatting the whole file or even the whole method goes against the basic rule of not doing formatting changes together with code changes. The on-the-fly formatting option is not about enforcing the formatting policies, but about assisting the user in writing correctly formatted code. There may be many reasons why a file may have incorrectly formatted code. Maybe the formatting policy has changed, or maybe who wrote the code didn't have autoformatting enabled and used some incorrect formatting in some cases. But in any case, MD has no right to reformat code at will.
Comment 5 Mike Krüger 2012-05-04 10:13:53 UTC
it does not format the whole file - it even just formats just up to caret position from method begin.
Comment 6 Mike Krüger 2012-05-04 10:15:54 UTC
it doesn't no longer format on ';'
Comment 7 Mikayla Hutchinson [MSFT] 2012-05-04 11:34:59 UTC
OK, filed an enhancement for formatting statements on the final semicolon - bug 4884 :)