So, Java's Nashorn engine allows to embed javascript in a java application. Nashorn's javascript has some non-vanilla javascript features, it is possible to write a function litteral like this :
function add(x,y)x+y
Which is the same as function add(x,y){return x+y;}
There is also the for each loop :
for each(var i in myArray) print(i)
I would like to edit the javascript files in Visual studio code. However, for the features above, since they are not vanilla javascript, VSCode detects an error. I couldn't find an extension for visual studio to support Nashorn's javascript.
Is there any way to "extend" the javascript support on visual studio to allow the features above ?
No. You'd need an extension that implements a Nashorn JS language server. VS Code's built-in JS support cannot be extended easily this way
You can suppress these error messages by setting:
"javascript.validate.enable": false
IntelliSense and other language support will still not work however without a proper language extension