rockofox / intellij-haskell-lsp

IntelliJ Plugin that provides Haskell language support via haskell-language-server
https://plugins.jetbrains.com/plugin/24123-haskell-lsp
Apache License 2.0
14 stars 4 forks source link

Windows platform: InvalidPathException on plugin startup #6

Open vojkog opened 4 months ago

vojkog commented 4 months ago

Hello, and thank you for developing/maintaining this project.

I have encountered an issue while trying to run the plugin on Windows, and I hope you can help.

Description

On project start HLS immediately crashes with the following stack trace:

java.lang.RuntimeException: Exception occurred while creating an instance of the stream connection provider
    at com.redhat.devtools.lsp4ij.server.definition.extension.ExtensionLanguageServerDefinition.createConnectionProvider(ExtensionLanguageServerDefinition.java:55)
    at com.redhat.devtools.lsp4ij.LanguageServerWrapper.lambda$start$0(LanguageServerWrapper.java:223)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 0: ::\\haskell-language-server-wrapper
    at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:177)
    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 boo.fox.haskelllsp.HaskellLanguageServer.findExecutableInPATH(HaskellLanguageServerFactory.kt:22)
    at boo.fox.haskelllsp.HaskellLanguageServer.<init>(HaskellLanguageServerFactory.kt:25)
    at boo.fox.haskelllsp.HaskellLanguageServerFactory.createConnectionProvider(HaskellLanguageServerFactory.kt:16)
    at com.redhat.devtools.lsp4ij.server.definition.extension.ExtensionLanguageServerDefinition.createConnectionProvider(ExtensionLanguageServerDefinition.java:53)
    ... 8 more

Environment

IntelliJ IDEA 2024.1.4 (Ultimate Edition) Build #IU-241.18034.62, built on June 20, 2024

Runtime version: 17.0.11+1-b1207.24 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 11.0 GC: G1 Young Generation, G1 Old Generation Memory: 2548M Cores: 16 Registry: debugger.new.tool.window.layout=true ide.experimental.ui=true editor.minimap.enabled=true terminal.new.ui=true Non-Bundled Plugins: com.github.bric3.excalidraw (0.4.0) com.jetbrains.space (241.18034.4) com.redhat.devtools.lsp4ij (0.0.2) com.intellij.ideolog (222.3.2.0) Pythonid (241.18034.62) com.intellij.grazie.pro (0.3.320) boo.fox.haskelllsp (1.3.2) AntSupport (241.18034.55) com.intellij.spring.websocket (241.14494.158) PlantUML integration (7.10.1-IJ2023.2) org.asciidoctor.intellij.asciidoc (0.42.2) com.intellij.ml.llm (241.18034.12) com.haulmont.rcb (241.15989.9) mdx.js (241.15989.9) com.intellij.bigdatatools.core (241.18034.62) com.intellij.bigdatatools.kafka (241.14494.158) Kotlin: 241.18034.62-IJ

Screenshot image

Please let me know if you need any additional information that might be helpful in resolving this issue. Thank you for your time and assistance!

dozed commented 2 months ago

@vojkog this could be related to a malformed PATH variable. Can you paste the value of that variable?

vojkog commented 2 months ago

Hello @dozed , thank you for your answer. Here is a value of my PATH variable:

C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Users\vojko\bin;C:\java\ant\apache-ant-1.10.13\bin;C:\Users\vojko\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\231.8109.175\bin\\bin;C:\java\graalvm-jdk-21+35.1\bin;C:\java\gradle\gradle-7.6.4\bin;C:\java\maven\apache-maven-3.9.6\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Docker\Docker\resources\bin;C:\Users\vojko\AppData\Local\Microsoft\WindowsApps;C:\Users\vojko\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\vojko\AppData\Local\GitHubDesktop\bin;C:\Program Files\heroku\bin;C:\Users\vojko\.fly\bin;C:\Users\vojko\AppData\Local\JetBrains\Toolbox\scripts;C:\Users\vojko\AppData\Roaming\npm;C:\Users\vojko\AppData\Roaming\Testcontainers Desktop\;C:\Users\vojko\.bun\bin;C:\ghcup\bin
dozed commented 2 months ago

The PATH looks ok.

It might be due to a different environment variable, as this function https://github.com/rockofox/intellij-haskell-lsp/blob/main/src/main/kotlin/boo/fox/haskelllsp/HaskellLanguageServerFactory.kt#L20-L22 iterates over all env variables.

Feanathiel commented 2 weeks ago

I think it's checking all environment variables instead of just Path itself. For me it's tripping over POWERSHELL_DISTRIBUTION_CHANNEL=MSI:Windows 10 Pro for the same stacktrace:

Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 3: MSI:Windows 10 Pro\haskell-language-server-wrapper
    at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:199)
    at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:175)
    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:231)
    at java.base/java.nio.file.Path.of(Path.java:148)
    at java.base/java.nio.file.Paths.get(Paths.java:69)
    at boo.fox.haskelllsp.HaskellLanguageServer.findExecutableInPATH(HaskellLanguageServerFactory.kt:25)

Removing the key indeed solves it.

Adding to that, I don't think it's going to work for Windows anyway, since HLS_EXECUTABLE_NAME doesn't contain .exe as an extension.