[英]autocomplete html tags in strings in Visual Studio code?
Is this possible in Visual Studio?这在 Visual Studio 中可行吗? I'm following a Wes Bos tutorial and while he's typing html in backticks (therefore in a string) in javascript, the html end tags autocomplete.
我正在关注 Wes Bos 教程,当他在 javascript 中的反引号(因此在字符串中)键入 html 时,html 结束标签自动完成。
I found bierner.lit-html works perfectly.我发现bierner.lit-html效果很好。
I tried Tobermory.es6-string-html too but this only gives syntax highlighting, not autocompletion.我也试过Tobermory.es6-string-html但这只会突出语法,而不是自动完成。
Note that both require you to prefix your html strings with a special comment, or html
:请注意,两者都要求您在 html 字符串前加上特殊注释或
html
:
class DashboardView extends View {
__html__ = html`
<div class="mt-8 px-2 text-center">
Look, syntax highlighting!
</div>
`
}
Don't worry about the html
prefix, it doesn't interfere with your code, and is recognised in other places which handle markdown like github, and as you can see, stackoverflow:不用担心
html
前缀,它不会干扰您的代码,并且在其他处理 markdown 的地方(如 github)也可以识别,正如您所见,stackoverflow:
class DashboardView extends View {
__html__ = `
<div class="mt-8 px-2 text-center">
No syntax highlighting :-(
</div>
`
}
And the cherry on the cake is that other plugins which operate on HTML such as bradlc.vscode-tailwindcss which adds tailwindcss class intellisense also work:蛋糕上的樱桃是其他在 HTML 上运行的插件,例如bradlc.vscode-tailwindcss它添加了 tailwindcss class intellisense 也可以工作:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.