XAML SurroundWith Tag is Not working

When I put the cursor at the beginning of a tag in XAML and I use Ctrl+E, U to surround with tag, only the start tag is surrounded with the new tag. The new tag should encompass the entire element, not just the start tag.

The only way I can use surround with in XAML is to select the entire scope of the element. Might as well just do it manually at that point.

6 comments
Comment actions Permalink

Hello Seamus,

You should first select the whole tag (including start and close) before
using a Surround With template. Thank you!

Andrey Serebryansky
Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

When I put the cursor at the beginning of a tag in XAML and I use
Ctrl+E, U to surround with tag, only the start tag is surrounded with
the new tag. The new tag should encompass the entire tag, not just the
start tag.

The only way I can use surround with in XAML is to select the entire
scope of the tag. Might as well just do it manually at that point.

---
Original message URL:
http://www.jetbrains.net/devnet/message/5265361#5265361



0
Comment actions Permalink

I have to ask that this feature be re-thought. Its useless as it is.

Begin and End tags in XAML can easily be hundreds of lines apart, (yay xml), and its quite common to wrap such elements in Borders, Grids, Panels, ContentControl, etc. BTW your competitor's product does the 'right' thing.

After all it is xml and its gotta be cake to understand the scope of a tag. Compared to some of the cool stuff ReSharper ferrets out it's very straight forward. For now I'll probably just make a macro to do it.

You folks might as well as remove the feature if you aren't going to improve it, as I said its useless as is.

0
Comment actions Permalink

Hello,

Begin and End tags in XAML can easily be hundreds of lines apart, (yay
xml),


Since you got Extend Selection (CtrlW or CtrlAlt+Right), it's easy to select
the whole element, be it two or hundred lines in length.

Surrond-with could be taught a few new tricks as well, thanks for hinting.


Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”


0
Comment actions Permalink

Hello,

Currently, if there's no selection, Surround With would just use the current
line (pretty much like VS does with Edit.Copy without any selection). In
your case you had just one tag on the line, and it all got surrounded. Could
be smarter with XML, I think. I've filed an issue on the tracker, http://youtrack.jetbrains.net/issue/RSRP-182530.


Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”


0
Comment actions Permalink

Thanks Serge. I believe I mentioned I could select the entire element, problem is, the cursor would no longer be where I need it to be.

I think it would be a great little enhancement to the behavior.

0
Comment actions Permalink

Hello,

Thanks Serge. I believe I mentioned I could select the entire element,


Yes, sure. I just pointed out that with Extend Selection, executed just twice,
you get the whole element selected, after which Surround With does its job,
which is far better than doing the same manually.

problem is the cursor, is not where I need it to be.


The caret, before or after doing "surround"? If after, then I believe its
final position could be adjusted at the live template text, with a macro.
Also, there're actions like goto matching bracket (Ctrl+]) for jumping to
the pairing tag of the element, and goto parent element (Ctrl+[) that takes
you to the opening tag of the element that currently contains the caret.



Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”


0

Please sign in to leave a comment.