Bug 6206 - If you don't terminate a line, and hit enter, it indents to a weird location and inserts spaces.
Summary: If you don't terminate a line, and hit enter, it indents to a weird location ...
Status: RESOLVED FEATURE
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: unspecified
Hardware: Macintosh Mac OS
: Low normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2012-07-19 16:26 UTC by bryan costanich
Modified: 2013-09-11 13:36 UTC (History)
1 user (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 FEATURE

Description bryan costanich 2012-07-19 16:26:46 UTC
I have "convert tabs to spaces" unchecked (which, by the way, is terribly confusing wording - it implies one way, but not the other, aristotle would be not happy). however, if you do something like this:

public void foo(){
  var goo = () => { [hit enter]

then it'll indent all the way to the "foo(){" point rather than the previous line, and it will insert spaces on the line that the caret is now on.
Comment 1 Mike Krüger 2012-07-20 01:55:42 UTC
Works for me in md/master.

Which version are you using ?
Comment 2 bryan costanich 2012-07-23 19:33:09 UTC
v.3.0.3.4
Comment 3 Mike Krüger 2012-07-24 01:16:39 UTC
Ok then I assume it's fixed in master.
Comment 4 Mike Krüger 2012-07-24 03:34:03 UTC
Reopen if you can repro it there (a screencast would be helpful then)
Comment 6 bryan costanich 2012-09-24 15:31:54 UTC
Yeah, i can still repro it in the builds in the wild, as well as the MD UI refresh. in fact, it repros very easily, so i'm surprised that it works for you. i'm happy to send over another video, but it would be the exact same as before.

also this is my #1 complaint with the text editor in MD.
Comment 7 Mike Krüger 2012-09-24 16:15:23 UTC
Which build number do you have ?
Comment 8 Mike Krüger 2012-09-24 16:22:23 UTC
btw. I could need a file where that happens for you.
Comment 12 Mike Krüger 2012-10-10 02:35:17 UTC
It's a not supported formatting atm.
I hope I'll have some time in the future to work on that.

For now: break after the { and not before - the behaviour we've now would be the default setting I would choose - even if our formatting/indenter can do different things.
Comment 13 bryan costanich 2012-10-10 02:41:33 UTC
on what planet would that behavior be an appropriate choice? i've _never_ seen code indented like that. 

in any case, we should have the same default behavior as visual studio, and it should indent to where i noted in both of the videos. additionally it should _not_ put in a ton of spaces, when i have my editor set to tabs.
Comment 14 Mike Krüger 2012-10-11 05:18:09 UTC
spaces are used from indent to alignment position - tabs only up to indent 

That's proper indenting:

->->foo(bar,
->->____baz);

Or:
->->foo(
->->->bar,
->->->baz);

That are the two styles we support atm. WHat doses vs.net do ?
Comment 15 Mike Krüger 2013-09-04 07:00:10 UTC
Looked at vs.net - they handle that differently - they only support spaces.

Their tab approach seems to be broken.
Comment 16 bryan costanich 2013-09-09 14:19:20 UTC
No, this is not a 'feature.' just because you think that it's broken in VS as well, which, by the way, it seems to work for me just fine in VS, doesn't mean it's not broken here.

if you have tabs turned on in Xamarin studio, it shouldn't insert a million spaces. period.
Comment 17 Mikayla Hutchinson [MSFT] 2013-09-09 14:39:15 UTC
Using tabs for alignment breaks when the tab width is changed, so it's actually it's a reasonably common (and sensible) practice to use a mixture of tabs and spaces - tabs for *indentation* and spaces for *alignment*. This has been the hardcoded behavior in the indenter since 2007, long before we had a style system. If you don't like it, that's a personal preference, *not* a high priority bug, and the answer to your problem would be for the indenter to respect formatting policy settings.

Minor issues in the indenter have always been a low priority relative to all the other issues we need to deal with, so we've only very recently been able to land a new smart indenter that respects the formatting style policies. It's in any master build from today onwards.

If you can't find policies that match your desired personal style, please open enhancement bugs. If you find discrepancies between the new indenter and the formatter, please file bugs with test cases.
Comment 18 Mike Krüger 2013-09-10 00:55:25 UTC
btw. the new indenter supports:

->->foo(bar,
->->->baz);

That's the new default for 'mono' btw - that complies with the defined alignment in the mono styleguide.
Comment 19 bryan costanich 2013-09-11 13:36:43 UTC
great, that's exactly what i wanted to see.