rikvdkleij / intellij-haskell

IntelliJ plugin for Haskell
https://rikvdkleij.github.io/intellij-haskell/
Apache License 2.0
1.31k stars 96 forks source link

WSL #674

Open b-ncMN opened 2 years ago

b-ncMN commented 2 years ago

Hi, I'm opening an issue because I'm not sure if this plugin supports WSL 2.

I'm trying to setup a project SDK from windows into WSL, so selecting a stack executable into WSL, but the plugin states that image

maybe the plugin does not know how to work with WSL ? And if it doesn't, it would be great to implement a way to use this with WSL.

JoAllg commented 2 years ago

I noticed the same problem (current version)

The event log shows, that intellij-haskell tries to use it as a windows executeable:

15:01   Cannot run program "\\wsl$\Ubuntu.20.04\usr\local\bin\stack" (in directory "C:\Users\Joshua"): CreateProcess error=193, %1 ist keine zulässige Win32-Anwendung

15:01   Executing `\\wsl$\Ubuntu.20.04\usr\local\bin\stack --numeric-version` failed: \\wsl$\Ubuntu.20.04\usr\local\bin\stack --numeric-version:   
rikvdkleij commented 2 years ago

I have no knowledge of WSL. Is the path to stack the problem?

b-ncMN commented 2 years ago

Hm, I'm not actually sure, it would be very worth to investigate this though :+1:

vasdommes commented 1 year ago

I have no knowledge of WSL. Is the path to stack the problem?

The path is correct. The problem is that the plugin tries to call this file from Windows terminal because it thinks that we're on Windows.

In the case of WSL, IDE runs on Windows, whereas the project and Haskell binaries are in Linux.

To fix the issue, one probably has to:

  1. fix intellij.haskell.external.execution.CommandLine calls to run commands in WSL terminal, when needed,
  2. fix all SystemInfo.isWindows / SystemInfo.isLinux checks to account for WSL

P.S. WSL is just a special case of Remote Development, so ideally there should be a general fix (covering WSL, SSH etc).