XML / XAML formatting

Running VS2010 with R# 1641:

The default XML formatting has 'Attributes Format: On Single Line' - this is OK for small numbers of short attributes, but is not great for XAML, because if nothing else, the first element tends to have lots of namespaces, and so turns into a very long line (496 chars on a file I've just run here).

If you set it to 'Each attributre on separate lines' there are at least two problems:

1. This isn't really sensible for XAML either, because you end up with an immensely long file.
2. The default indent option of 'Align by first attribute' is broken, and you actually get all the attributes on the left-hand edge of the page, which is truly awful

Interestingly, you can see this in the preview in the options dialog - set indenting to 'align by first attributre' and then switch 'attributes format' from 'single line' to 'separate lines' - you can see all the attributes on the left-hand edge of the preview.  Clicking on 'align by first attribute' (even though it's already selected) makes the preview jump to the correct position, but an actual format of a real file is still broken.

So neither of these options would be any good for XAML, even if they worked properly.   Its seems to me that's what's needed is something like the 'scrubber' in kaxaml, where you can set the max number of attributes which can be on one line before they're all put onto separate lines.

I realise I've probably missed the boat for this on R#5, but perhaps the indent bug could be fixed?

3 comments
Comment actions Permalink

And what about the bug with ignoring tabs/spaces for indentation in settings when editing XAML file? I use in all files 4 spaces for indentation, but R# uses tabs in XAML autoformat. I've experienced this two weeks ago, not sure if it's happening now. Also there\s still the problem with duplicate autcomplete box, one from R# and one from VS. Just try to write some attribute in XAML and then click Ctrl + Space.

0
Comment actions Permalink

Yes, quite a lot of VS2010 feels like 'fight the popups'  - there's the one you've mentioned in XAML, and then in C# there's something really precarious about what happens if you type 'override' - if you're really careful you can look through a list of possibly overrides, but if you glance at your screen with the wrong facial expression, then a R# (I think) popup quickly arrives with a load of irrelevance and stomps on the override box.

I don't think the R# team are actually working in VS2010 for R# development yet, and perhaps that does show a bit.

0
Comment actions Permalink

I think, if R# formatter splits long lines it will solve the problem with attributes, but we do not support it still.

0

Please sign in to leave a comment.