How do I wrap a selection with an HTML tag in Visu

2019-01-21 04:37发布

This seems like the most basic question in the world, but damned if I can find an answer.

Is there a keyboard shortcut, either native to Visual Studio or through Code Rush or other third-party plug-in, to wrap the current selection with an HTML tag? I'm tired of typing the opening tag, cutting the misplaced closing tag to the clipboard, moving the cursor, and pasting it at the end where it belongs.

Update: This is how TextMate handles surrounding a selection with a tag. Frankly, I'm stunned that Visual Studio doesn't seem to have a similar feature. Creating a macro or snippet for every conceivable tag I might want to use seems absurd.

8条回答
霸刀☆藐视天下
2楼-- · 2019-01-21 05:04

Nothing I'm aware of, but writing a macro to wrap it in whatever tag you want shouldn't be hard. I have a similar one that will wrap my selection in a region block.

查看更多
祖国的老花朵
3楼-- · 2019-01-21 05:08

When faced with this situation, I often type the closing tag first, then the opening tag. This prevents the IDE from "helping" by inserting the closing tag where I don't want it. I'm also interested in a better solution, though.

查看更多
登录 后发表回答