如何在 VS 代码中进行标签包装? [英] How to do tag wrapping in VS code?

查看:25
本文介绍了如何在 VS 代码中进行标签包装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我选择的 html 包装在 VS 代码中的标签中.我怎么做?

解决方案

嵌入式


这个东西甚至支持传递参数:

{键":ctrl+shift+9",命令":editor.emmet.action.wrapWithAbbreviation",when":editorHasSelection",参数":{缩写":跨度",},},

像这样使用它:

  • span.myCssClass
  • span#myCssId
  • b
  • b.myCssClass

I would like to wrap my selected html within a tag in VS code. How do I do that?

解决方案

Embedded Emmet could do the trick:

  1. Select text (optional)
  2. Open command palette (usually Ctrl+Shift+P)
  3. Execute Emmet: Wrap with Abbreviation
  4. Enter a tag div (or an abbreviation .wrapper>p)
  5. Hit Enter

Command can be assigned to a keybinding.


This thing even supports passing arguments:

{
    "key": "ctrl+shift+9",
    "command": "editor.emmet.action.wrapWithAbbreviation",
    "when": "editorHasSelection",
    "args": {
        "abbreviation": "span",
    },
},

Use it like this:

  • span.myCssClass
  • span#myCssId
  • b
  • b.myCssClass

这篇关于如何在 VS 代码中进行标签包装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆