Description
Some context
I'm trying to get JBang scripts work OOTB in VS Code. Since the classpath dependencies are coded right in the Java file, I use a similar mechanism to invisible projects to create a Java project under the jdt.ls workspace, that is then augmented with informations gathered from the JBang directives in the original file. This is based on jbang-eclipse. The jdt.ls integration is currently living on my fork. Finally, the VS Code Java integration can be found at https://github.com/fbricon/vscode-jbang, one can install a CI build of the vscode-jbang.vsix from the latest release page.
Now.
When I open a folder containing a JBang script, say hello.java:
///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS com.github.lalyos:jfiglet:0.0.9
//DEPS org.slf4j:slf4j-api:1.7.32
//JAVA 17
import com.github.lalyos.jfiglet.FigletFont;
class hello {
public static void main(String... args) throws Exception {
System.out.println(FigletFont.convertOneLine(
"Hello " + ((args.length > 0) ? args[0] : "jbang")));
}
}
After opening the file, the Java Runtime version is not displayed. It should show JavaSE-17 (or whatever is matching the //JAVA version
comment in the file.
I have a strong feeling Invisible project detection conflicts with other projects under the jdt.ls workspace. Chance are, we'll need to identify invisible projects differently, i.e. by adding them an invisible project specific nature.