-
Notifications
You must be signed in to change notification settings - Fork 54
Description
This extension works better than others with the most recent JDKs, but it doesn't handle the new folder structures that are now possible with Compact Source Files being a standard Java feature as per JEP 512.
Context
I want to write a standalone hello world program, and other like it, according to JEP 512. I expect students to write many such files in the root folder (anonymous package) and to create many such files in my own demo folder.
void main() {
IO.println("Hello world!");
}
void main() {
var currentDir = new File(".");
var filesList = new ArrayList<File>();
for (File f : currentDir.listFiles()) {
if (f.getName().endsWith(".md")) {
filesList.add(f);
}
}
IO.println(filesList);
}
Expected behaviour
- Autocompletion after typing
IO.
(and other classes) - Implicit
java.util
andjava.io
module imports - View options to run or debug in the editor and on top of the
void main()
declaration
Issue with current behaviour
Instead of launch options, there is a warning on main saying main is never used
.
Request
Recognise this new type of valid single-file, standalone program correctly:
- No "never used" warning on instance main method in compact source files
- Run and debug options appear as expected for compact source files in the root folder (anonymous package)
- (If possible as a bonus side-effect) Command Palette > Java: New File from Template... --> Compact source file snippet available (
void main() {}
)
Current workaround
I will simply have students run java [filename]
in the integrated terminal as before.
If there is no change before ~March, I will probably go back to the "Java Extension Pack" once they release JavaSE-25 support <-- I would like to avoid this if possible: this extension is WAAAAAAY more appropriate for new programmers.