简体   繁体   English

VS Code - 如何启用 Html 标签属性显示

[英]VS Code - How to enable Html tag attribute display

I am new to VS Code and using it for Html editing.我是 VS Code 的新手,并将其用于 Html 编辑。 Is there a way to have the IDE show me a list of the attributes available for an Html tag?有没有办法让 IDE 向我显示可用于 Html 标记的属性列表? I do get Intellisense when I am typing a tag name and it will auto-close the tag, but there doesn't seem to be support for displaying the attributes specific to the tag.当我输入标签名称时,我确实得到了 Intellisense,它会自动关闭标签,但似乎不支持显示特定于标签的属性。 I can use Ctrl-Space to display a universe of attributes, but I'm looking for a list of the attributes from the official Html reference.我可以使用 Ctrl-Space 来显示属性的范围,但我正在寻找来自官方 Html 参考的属性列表。 Or maybe a tag-level help pane where it would display the tag information, including purpose, usage, attributes, etc.或者可能是一个标签级帮助窗格,它会显示标签信息,包括用途、用途、属性等。

Without installing an extension, I am getting a list of attributes when I press Ctrl + Space while inside an open tag like this <p .在不安装扩展程序的情况下,当我在像<p这样的打开标记内按Ctrl + Space时,我会得到一个属性列表。

There must be a space after the <p , so the tag name must be complete and the cursor separated from it by a space. <p之后必须有一个空格,因此标记名称必须完整并且光标与它之间用空格分隔。 If the cursor is still on the tag name, VSCode tries to autocomplete the tag name when pressing Ctrl + Space .如果光标仍在标签名称上,VSCode 会尝试在按Ctrl + Space时自动完成标签名称。

In VS Code it is showing attributes available in an HTML tag but it fails when showing/suggesting values for a specific tag.在 VS Code 中,它显示 HTML 标记中可用的属性,但在显示/建议特定标记的值时失败。 For that purpose, I am using this extension called "HTML CSS Support" by ecmel.为此,我正在使用 ecmel 称为“HTML CSS 支持”的扩展。 But for the scenario mentioned in this question, You can get it done with @C14L 's answer.但是对于这个问题中提到的场景,你可以通过@C14L 的回答来完成。 There may be other good extensions but this is the one I have tried and it works perfectly.可能还有其他好的扩展,但这是我尝试过的,并且效果很好。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM