Visual Studio Code无法识别EJS [英] Visual Studio Code isn't recognising EJS
问题描述
我正在尝试遵循本教程,并用EJS编写一些代码在VS Code中。我按照视频的说明运行 npm我表示ejs
来安装Express和EJS,并且在控制台中没有弹出错误。但是,在右下角(蓝色栏中)仍显示HTML,当我单击它以更改语言时,EJS不会出现在列表中。
I am trying to follow this tutorial and write some code in EJS in VS Code. I ran npm i express ejs
as per the video's instructions to install both Express and EJS, and no errors popped up in the console. However, in the bottom right (in the blue bar) it still says HTML, and when I click on this to change the language, EJS doesn't appear in the list.
我在这里想念东西吗?我应该遵循另一步骤吗?任何帮助将不胜感激。
Am I missing something here? Is there another step I was meant to follow? Any help would be greatly appreciated.
推荐答案
默认情况下,VSCode没有为EJS模板文件突出显示语法。您需要安装这样的插件- EJS语言支持。
By default VSCode does not have syntax highlighting for EJS template files. You need to install a plugin like this one - EJS language support.
您还需要为 .ejs
文件配置文件关联。为此,请键入以下命令(使用 CTRL + SHIFT + P
)-更改语言模式
,然后选择为.ejs配置文件关联
,然后从下拉列表中选择 HTML
。
You also need to configure the file association for .ejs
files. In order to do so type the following command (using CTRL + SHIFT + P
) - Change language mode
and then select Configure file association for .ejs
, then select HTML
from the dropdown.
这篇关于Visual Studio Code无法识别EJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!