I have .ejs file and a js file that renders it, how to get code completion in the .ejs file?
Maybe I am just missing something obvious, but in the .ejs file all the variable references are unknown to Webstorm so there is no code completion. How do I connect the data passed in the render call with the template itself?
请先登录再写评论。
global variables are resolved as expected for me..
Could you share code snippets (your js variables declaration and usage in .ejs) the issue can be reproduced with?
I am sure its something I am not doing right:
const stmt = db.prepare("select * from artwork")
let result = stmt.all()
res.render('index', { title: 'Express', list: result });
I don't see how WB could even know the type of list although it works fine at runtime. Do I need to export the result? I did not see any way to specify an import/require.
You did everything right
Unfortunately this info is only available in runtime, there is no way for the IDE to resolve the properties during static code analysis:(
Yet the types are available statically in the js file, it's a lack of connection between it and the .ejs. I wonder if this is a limitation of WS or a limitation of ejs. It would seem a sad limitation whatever it is, it means the templates are easy to screw up.
>Yet the types are available statically in the js file
can't see them in your snippet:)