georgewfraser / java-language-server

Java language server using the Java compiler API
MIT License
642 stars 126 forks source link

Allow wildcard matching in java.classPath setting #257

Open AaronAsAChimp opened 1 year ago

AaronAsAChimp commented 1 year ago

When using the java.classPath setting each JAR file needs to specified separately. It would be helpful if it allowed wildcards because it alleviates manually updating this setting every time a JAR is added or removed. It also makes it consistent with the way the class path is set for javac and Ant.

Current Behavior

The language server crashes with the exception:

java.nio.file.InvalidPathException: Illegal char <*> at index 4: lib\*
    at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
    at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
    at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
    at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
    at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:232)
    at java.base/java.nio.file.Path.of(Path.java:147)
    at java.base/java.nio.file.Paths.get(Paths.java:69)
    at org.javacs.JavaLanguageServer.classPath(JavaLanguageServer.java:131)
    at org.javacs.JavaLanguageServer.createCompiler(JavaLanguageServer.java:94)
    at org.javacs.JavaLanguageServer.compiler(JavaLanguageServer.java:39)
    at org.javacs.JavaLanguageServer.lint(JavaLanguageServer.java:61)
    at org.javacs.JavaLanguageServer.doAsyncWork(JavaLanguageServer.java:532)
    at org.javacs.lsp.LSP.connect(LSP.java:237)
    at org.javacs.Main.main(Main.java:30)

Expected Behavior

Allow using wildcards similar to the way Ant or javac's pattern matching works.