This question already has an answer here:
- How to do tag wrapping in VS code? 5 answers
I am using VSC for developing html pages. It's been a great experience using emmet with VSC, but often I find in a situation where I have to wrap a set of elements with a div, but have to use emmet on a single line and then cut paste the end tag at the end of the set of elements I want to map.
Is there any way where I can use emmet and automatically wrap the output of emmet around a set of selected elements?
The easiest way is to use a key binding, you can assign your own key for this. file > preference > keyboard shortcuts > editkeybindings and assign your own
[{ "key": "ctrl+shift+g", "command":"editor.emmet.action.wrapWithAbbreviation", "when": "editorTextFocus && !editorReadonly" }]
来源:https://stackoverflow.com/questions/44480051/wrapping-a-html-element-in-visual-studio-code-using-emmet