Automatically Closing Tags

Discussion of how automatically closing tags could work. It’s annoying when you want to add a tag later, after you’ve already written something.

One possibility: highlight text and start typing tag, puts opening and closing tags around highlighted text.

1 Like

I like this idea, but I could see trouble with, say, replacing a greater-than > with a less-than < and suddenly you’ve got <tag>></tag>. In vscode, I have a keyboard shortcut (Ctrl+Shift+9 for reasons I don’t recall) for “Surround selection with tag” that I use all the time in markup.

I found a bit of a workaround earlier today. If you do the closing tag first at the end of whatever you want, it won’t auto-close when you do the open tag afterwards. It must search for a close tag and only auto-close if it doesn’t find one.

1 Like

Typing the end tag first is a reasonable workaround.