VSCode 中的 .ejs 格式 [英] .ejs formatting in VSCode
本文介绍了VSCode 中的 .ejs 格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的问题 - 它不可读
This is my problem - its unreadable
为了让 .ejs 正常工作,到目前为止我已经添加了以下内容.我也有保存和更漂亮的格式.我正在寻找更好地格式的建议,以便我可以阅读它.
In order to get .ejs working in general, I've so far added the following. I also have format on save and prettier. I'm looking for proposals to get better formatting of this so that I can read it.
"files.associations": {
"*.ejs": "html",
"*.css": "postcss"
},
"emmet.includeLanguages": {
"postcss": "css",
"ejs": "html"
},
"emmet.syntaxProfiles": {
"postcss": "css",
"ejs": "html"
}
推荐答案
我知道这是一个老问题,但是在 VSCode 中使用 .ejs 仍然是一个问题.但我找到了解决方案(对于 ?
分隔符)
I know that's an old question, but working with .ejs in VSCode is still a problem. But I found the solution (for ?
delimeter)
- 安装
EJS语言支持
插件 - 现在您有 ejs 支持、突出显示和代码段,但有些标签如
<? for( let item of array ) { ?>
(some data)
<? } ?>
格式不正确(至少使用默认的 html 格式化程序).
are formatted incorrectly (at least with default html formatter).
- 要解决此问题,您可以尝试将自定义分隔符设置为?"
ejs.delimeter = '?'
.现在你有了正确的< 缩进?... ?>
标签. - 要将片段与我们的自定义分隔符一起使用,您需要编辑扩展片段(或添加您自己的片段):安装
Snippets Ranger
插件,然后找到所需的扩展并编辑其文件.Snippets Ranger
是非常方便的工具.
- To fix this, you can try set custom delimeter to '?'
ejs.delimeter = '?'
. Now you have correct indentation with<? ... ?>
tags. - To use the snippets with our custom delimeter, you need to edit extension snippets (or add your own): install
Snippets Ranger
plugin, then find needed extension and edit its file. TheSnippets Ranger
is very handy tool.
我希望我能帮助某人为 .ejs 文件设置 VSCode
I hope I helped somebody to setup VSCode for .ejs files
这篇关于VSCode 中的 .ejs 格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文