Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Biome plugin not working with WSL #49

Open
niklas-e opened this issue Apr 10, 2024 · 2 comments
Open

Biome plugin not working with WSL #49

niklas-e opened this issue Apr 10, 2024 · 2 comments

Comments

@niklas-e
Copy link

niklas-e commented Apr 10, 2024

I tried to use the plugin with a project in Windows Subsystem for Linux. I couldn't get it to work and tried to gather some relevant log entries from the IDEA logs.

First I tried with Automatic Biome configuration. The plugin seemingly loads fine, no errors. However the formatter hangs on save and I got this in the logs:

2024-04-10 19:17:24,713 [ 777798] SEVERE - #com.github.biomejs.intellijbiome.actions.BiomeCheckRunner - Failed to run Biome check with (format, safefixes) for file App.jsx - Timeout exceeded
java.lang.Throwable: Failed to run Biome check with (format, safefixes) for file App.jsx - Timeout exceeded
        at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)
        at com.github.biomejs.intellijbiome.actions.BiomeCheckRunner.applyChanges(BiomeCheckRunner.kt:91)
        at com.github.biomejs.intellijbiome.actions.BiomeCheckRunner.access$applyChanges(BiomeCheckRunner.kt:20)
        at com.github.biomejs.intellijbiome.actions.BiomeCheckRunner$formatDocuments$1$1.run(BiomeCheckRunner.kt:58)
        at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:477)
        at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:133)
--
        at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
        at java.base/java.lang.Thread.run(Thread.java:840)

Then I tried with Manual Biome configuration pointing executable and biome.json to files inside WSL. The plugin immediately indicates the language server is terminated (screenshot below). In addition when saving any file the log contains entries about invalid path (see below).

image

2024-04-10 19:25:52,261 [1285346] SEVERE - #c.i.o.p.Task - Cannot run program "\\wsl.localhost\Ubuntu-22.04\home\niklas\code\my-project\node_modules\.bin\biome" (in directory "\\wsl.localhost\Ubuntu-22.04\home\niklas\code\my-project"): CreateProcess error=3, The system cannot find the path specified
com.intellij.execution.process.ProcessNotCreatedException: Cannot run program "\\wsl.localhost\Ubuntu-22.04\home\niklas\code\my-project\node_modules\.bin\biome" (in directory "\\wsl.localhost\Ubuntu-22.04\home\niklas\code\my-project"): CreateProcess error=3, The system cannot find the path specified
        at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:366)
        at com.intellij.execution.process.OSProcessHandler.startProcess(OSProcessHandler.java:86)
        at com.intellij.execution.process.OSProcessHandler.<init>(OSProcessHandler.java:46)
        at com.intellij.execution.process.CapturingProcessHandler.<init>(CapturingProcessHandler.java:20)
        at com.github.biomejs.intellijbiome.extensions.CommandLineExtKt.runProcessFuture(CommandLineExt.kt:26)
        at com.github.biomejs.intellijbiome.BiomeStdinRunner.check(BiomeStdinRunner.kt:34)
        at com.github.biomejs.intellijbiome.actions.BiomeCheckRunner$formatDocuments$1$1.run(BiomeCheckRunner.kt:55)
        at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:477)
        at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:133)
--
        at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
        at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.io.IOException: Cannot run program "\\wsl.localhost\Ubuntu-22.04\home\niklas\code\my-project\node_modules\.bin\biome" (in directory "\\wsl.localhost\Ubuntu-22.04\home\niklas\code\my-project"): CreateProcess error=3, The system cannot find the path specified
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1143)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073)
--
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1110)
        ... 34 more

Probably requires some additional handling to get it working with WSL, but I guess it should be doable since IDEA works nicely with WSL.

On a side note: would be worth it to add some error handling too, because especially with the automatic configuration there's no errors so the plugin just shows as not working or buggy for the user.


Environment information:

IntelliJ IDEA 2024.1 (Ultimate Edition)
Biome plugin v1.0.0
Biome 1.6.4

@martinbiard
Copy link

martinbiard commented Apr 16, 2024

I've got somewhat of the same issue here. My situation is a little different as I'm running my server inside docker instead of inside WSL, but the issue is very likely to be the same thing since I expect in both cases, IntelliJ is being run as client/server.

The LSP server starts then exits immediately with error code 137 as can be seen in logs below.

2024-04-16 15:16:35,479 [ 476993]   INFO - #c.i.p.l.a.LspServerDescriptor - LspServerDescriptor@workspace: starting LSP server: /usr/bin/node [/workspace/node_modules/@biomejs/biome/bin/biome, lsp-proxy]
2024-04-16 15:16:35,482 [ 476996]   INFO - #c.i.p.l.i.LspServerImpl - LspServerDescriptor@workspace(Initializing;0): LSP server process started: /usr/bin/node /workspace/node_modules/@biomejs/biome/bin/biome lsp-proxy
2024-04-16 15:16:35,484 [ 476998]   INFO - #c.i.p.l.i.LspServerImpl - LspServerDescriptor@workspace(ShutdownNormally;0): LSP server process terminated, exit code = 137, command line: /usr/bin/node /workspace/node_modules/@biomejs/biome/bin/biome lsp-proxy
2024-04-16 15:16:35,506 [ 477020]   INFO - #c.i.p.l.i.LspServerImpl - LspServerDescriptor@workspace(Running;0): LSP server initialized, name = biome_lsp, version = 1.7.0
2024-04-16 15:16:35,508 [ 477022]   INFO - #c.i.p.l.i.LspServerImpl - LspServerDescriptor@workspace(Running;3): window/logMessage: Server initialized with PID: 90828
2024-04-16 15:17:07,104 [ 508618]   INFO - #c.j.r.d.BackendDiagnosticsHost - A CWM client requested logs

I've read that exit code 137 can often mean running out of memory, but in my case everything looks perfectly fine from inside my docker container:

top - 15:47:37 up 9 days, 15:12,  0 user,  load average: 0.22, 0.15, 0.18
Tasks:  16 total,   1 running,  15 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.5 us,  0.3 sy,  0.0 ni, 99.2 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st 
MiB Mem :  15900.5 total,   5071.4 free,   3584.1 used,   7621.4 buff/cache     
MiB Swap:   4096.0 total,   4085.3 free,     10.7 used.  12316.3 avail Mem

I'm not sure how to test if it's actually working, but when I run the command manually, it seems to be working, waiting for input and not exiting, so the lsp-proxy just won't stay up when running from the IDE.

/usr/bin/node /workspace/node_modules/@biomejs/biome/bin/biome lsp-proxy

IntelliJ IDEA 2024.1 (Ultimate Edition)
Biome plugin v1.0.2
Biome 1.7.0

@martinbiard
Copy link

I just noticed while running ps -aux that the lsp-proxy is actually running even though IntelliJ reports it as stopped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants