简体   繁体   English

Visual Studio IDE无法识别Javascript中的EJS变量

[英]Visual Studio IDE Doesn't Recognize EJS Variable in Javascript

I am making a project in Nodejs with the express framework I am using EJS as a template engine, I use Visual Studio as an IDE. 我正在使用快速框架在Nodejs中创建项目,正在使用EJS作为模板引擎,使用Visual Studio作为IDE。

I have a problem while using EJS variable in the same ejs file, it renders correctly and works perfectly but Visual Studio marks it an error at the syntax 我在同一个ejs文件中使用EJS变量时遇到问题,它可以正确呈现并正常工作,但是Visual Studio在语法上将其标记为错误

Is there any Tools or Extensions Features available, To overcome this issue 是否有任何工具或扩展功能可用,以解决此问题

Error shown in IDE IDE中显示的错误

在此处输入图片说明

Any one please help in solving this error in Visual Studio. 任何人都可以帮助解决Visual Studio中的此错误。

Right-click any given *.ejs file, and Select "Open With". 右键单击任何给定的* .ejs文件,然后选择“打开方式”。 In the dialog that opens, select "HTML (Web Forms) Editor" and select it as default. 在打开的对话框中,选择“ HTML(Web窗体)编辑器”,并将其选择为默认值。

Now, when you open your EJS files, you will get syntax highlighting and intellisense for your HTML. 现在,当您打开EJS文件时,您将获得HTML的语法突出显示和智能感知。 This does not give you support for EJS Code snippets, but will not throw errors. 这不会为您提供对EJS代码段的支持,但不会引发错误。

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

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