【问题标题】:VSCode HTML How to enable autoclose tag and tag suggestionsVSCode HTML 如何启用自动关闭标签和标签建议
【发布时间】:2020-04-01 15:41:52
【问题描述】:

在我的 VSCode 中,当我在放置新标签时使用 html 时,它并没有给我标签名称的建议。另外,如何在我写作时用 > 自动关闭标签?我已经安装了 HTML Snippets、Boiler、Intellisense Auto Complete Tag 扩展。

这是setting.json中写的内容

"python.pythonPath": "C:\\ProgramData\\Anaconda3",
"editor.renderWhitespace": "boundary",
"editor.tabCompletion": "on",

"auto-close-tag.enableAutoCloseTag": true,
"auto-close-tag.fullMode": true,
"auto-close-tag.SublimeText3Mode": true,
"html.format.indentInnerHtml": true,
"html.format.endWithNewline": true,
"html-css-class-completion.enableEmmetSupport": true,
"html.suggest.html5": true

【问题讨论】:

  • 顺便说一句,您可以使用 Emmet,只需输入例如 div,然后按 Tab 键,您会得到一个 <div></div>。它还附带一些很酷的东西,例如,您可以在一行中制作一个包含一些 lorem ipsum 文本的整个表格。 Emmet 内置在 VS Code 中,因此您无需安装任何东西
  • 它并没有就像 body 和 div 这样简单的东西提供建议(对于 div 它建议使用 divisibleby 代替)。同样按 tab 也不能获取
  • 是的,对于 div,您只需使用 .class,它就会生成 <div class="class"></div>。其他扩展也可能优先于 Emmet。

标签: html visual-studio-code


【解决方案1】:

我刚刚找到了我的解决方案here,第三个答案下来了。事实证明 VS Code 会自动检测语言为“django-html”而不是 vanilla“html”,结果,我在 VS Code 上安装的用于 html 的扩展都没有工作!

您可以通过单击 VS Code 右下角的 django-html 并将其更改为常规 HTML 来将自动检测更改为常规 HTML。

【讨论】:

    猜你喜欢
    • 2022-12-03
    • 2019-05-16
    • 1970-01-01
    • 2019-01-27
    • 2018-05-17
    • 1970-01-01
    • 2016-09-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多