Expand text into empty XML tags

If you write any text and hit tab webstrom will make it a full XML tag. For example: AnyText becomes <AnyText></AnyText>

However, more often I actually need an empty tag: <AnyText/>. Can i setup webstorm to produce empty tags instead of full tags on TAB key (or some other key sequence) ? 

0
5 comments

Hi there,

>AnyText becomes <AnyText></AnyText>

That's Emmet in action .. and AFAIK that's how it works -- I do not see any options for empty tag style.

If you know what tags you will be creating in advance -- you can always create custom Live Template for that (same expand key (Tab) can be used).

If such tags are rather random (editing different XML files with different sets of tags) then 2 options:

  1. Still use custom Live Template .. but single template with custom abbreviation (e.g. "qq" -- qq[tab] will expand into <[CARET] /> and you just type name of the tag where [CARET] is)
  2. No live template -- expand into pair of tags .. and as soon as they created just hit Alt+Enter (or via light bulb icon) and choose "Collapse empty tag" intention.
1
Avatar
Permanently deleted user

Is it possible to have a live template that will expand AnyText/ => <AnyText /> ? Mind the slash after AnyText.

0

Nope ... as Live Template needs to have an abbreviation (name of live template that it used to for expanding) .. otherwise -- how system should know what live template to use?

0

P.S.

You can always submit Feature Request ticket to the Issue Tracker at https://youtrack.jetbrains.com/issues/WEB

0
Avatar
Permanently deleted user
0

Please sign in to leave a comment.