VSCode 上的链接 + 选项卡快捷方式 Emmet - 如何获得“类型"?要包括在这? [英] Link+tab shortcut Emmet on VSCode - How can I get the "type" to be included in this?

查看:32
本文介绍了VSCode 上的链接 + 选项卡快捷方式 Emmet - 如何获得“类型"?要包括在这?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我键入快捷方式 link+tab 以获取链接标签和属性时.

When I type the shortcut link+tab to get the link tag and attributes.

它只显示:

当我希望它显示时:
<link rel="stylesheet" type="text/css" href="">

如何更改内置的 emmet 快捷方式/代码段来执行此操作?我试过进入偏好和快捷方式等,但还没有完全弄清楚.感谢您的帮助!

How can I change the built-in emmet shortcut/snippet to do this? I've tried going into preferences and shortcuts, etc. but haven't quite figured it out. Thanks for any help!

推荐答案

将此放入您的设置中:

"emmet.extensionsPath": "C:\\Users\\Mark\\Test Bed\\.vscode",  
// with path to your .vscode folder.
// right-click on the folder in your explorer bar and choose Copy Path - use that in above

以上将允许 emmet 找到您将创建的片段.

The above will allow emmet to find the snippets you will create.

在您的 .vscode 文件夹中创建一个 snippets.json 文件.

Create a snippets.json file in your .vscode folder.

将其放入该文件中:

{
  "html": {
    "snippets": {
        "link": "<link rel='stylesheet' type='text/css' href='${1}'>"
    }
  }
}

重新加载 对这个文件进行任何更改后的 vscode 窗口,否则您将看不到更改生效!

Reload vscode window after any changes to this file or you won't see the changes take effect!

如果您想使用双引号,请使用此表单:

or use this form if you want to use double quotes:

        "link": "<link rel=\"stylesheet\" type=\"text/css\" href=\"${1}\">"

更多信息在这里:https://code.visualstudio.com/docs/editor/emmet#_using-custom-emmet-snippets

这篇关于VSCode 上的链接 + 选项卡快捷方式 Emmet - 如何获得“类型"?要包括在这?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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