XML: Collapse empty tag

From several Youtrack entries (e.g.http://youtrack.jetbrains.com/issue/IDEA-89032) it appears that IntelliJ has an intention for replacing xml tags with empty body with a "bodyless" tag (e.g. <foo></foo> with <foo/>). If this intention indeed exists, I can't seem to find a place to enable it (using v 12.1.5) - all I find is the "reverse" intention ("Expand Empty Tag").
I am using Emmet expansion quite heavily in xhtml files and get plenty of tags with empty bodies that are all marked by the inspection "Xml Tag Has Empty Body", but I don't get any suggestion to "collapse" the tags.

Can anybody point me to where this can be enbled?

0

Please check Settings / Inspections, make sure XML / XML tag empty body is enabled.

NB: it works for literally empty body, e.g. a white space is not an empty string.

Regards,
Alexander.

1
Avatar
Permanently deleted user

Hi Alexander,

Maybe I expressed myself a bit unclear, but I was not looking for the inspection (that one is working!), but for an Intention to "collapse" the tag with empty body to short form. Is there something like that?

0

Surprisingly to me, there is indeed a feature (not intention, though): http://youtrack.jetbrains.com/issue/IDEA-38246#comment=27-34573

Please try.
Alexander.

0
Avatar
Permanently deleted user

Wow, works like a charm. Thanks a lot!


0

请先登录再写评论。