Project files on WSL2 with symlink support

Answered

Hi,

After all the storm with WSL2! in (Windows 10 2004) I decided to give development on Windows an other chance. :-)

I am running some NodeJS projects on WSL2  with WSL Node interpreter and they work fine. I have also switched the terminal to use wsl.exe so that I can have direct access to any Linux functionality I am used to having while developing on Linux.

The problem is that the project contains symlinks. Everything works fine with the Run/Debug configuration since it is natively using WSL, but in the project files IDEA cannot understand symlink to folders.

Is there a way to fix this, or if not, is it an issue that is going to be tackled soon? VSCode works out of the box with WSL2 integration and symlinks etc...

I believe that with the change of Microsoft's direction to support Windows as a development platform, WSL2 should be natively integrated in Jetbrains products so that it can provide an equivalent development experience between Linux and Windows on an overall great product.

Feel free to sugget any solutions to the symlink problem!

3
5 comments

I am running PhpStorm 2020.2 and having the same question - unlike VS Code - JetBtains IDEs do not support symlinks.

It is not a problem for smaller and simpler projects but for more complex projects especially ones that use yarn workspaces where local dependencies are linked with symlinks - it is a big problem, you basically cannot use such projects because local dependencies cannot be resolved...

1

This is not a "bug" of PhpStorm. This is a bug of the WSL2 subsystem, particularly in the P9 file server.

 

You can check that it is not that "PhpStorm" cannot open the symlinks but that "nobody" (even "VsCode" -see later-) nobody from the windows side can open the symlinks. Just open `\\wsl$` from the explorer, or from a CMD or gitbash or whatever and you'll see all the symlinks failing.

 

I also faced this and asked here https://stackoverflow.com/questions/64489501/wsl2-linux-relative-symlinks-broken-when-accessed-from-windows-only-for-the and saw there's a bug already open in the WSL repo here https://github.com/microsoft/WSL/issues/5118

 

AFAIK the reason by which VsCode "seems" to be understanding the symlinks is because it's not "fully running" on the windows side, but it seems to be a client-server structure and in the windows side have only a "frontend" connected to a "remote core" which is natively running in the WSL2 linux, so, the "VsCode" itself "is seeing" the linux symlinks because it really runs on the linux side and only "sends" the info to the frontend.

 

I'd love to have PhpStorm reading the symlinks but I understand that refactoring the complete full PhpStorm architecture "just because another vendor has a bug" is probably not a possibility; while doing P9 file server work mainly as a samba file server (see the xrefs above) seems much more "feasible".

 

I'd love to contribute if I can help.

 

Just my 2 cents.

1

What IDE version do you use? Please try 2020.1.2 RC it has latest improvements for WSL support in Node JS projects.

>The problem is that the project contains symlinks. Everything works fine with the Run/Debug configuration since it is natively using WSL, but in the project files IDEA cannot understand symlink to folders.

If problem remains it would be great if you could file an issue at https://youtrack.jetbrains.com/issues/IDEA with a bit more details about your project structure including where the symlinks are used and what exactly is not working correctly with them. Please also include idea.log file (you can attach all diagnostics using Help | Collect Logs and Diagnostic Data action). Thank you.

0

If problem remains it would be great if you could file an issue at https://youtrack.jetbrains.com/issues/IDEA with a bit more details about your project structure including where the symlinks are used and what exactly is not working correctly with them. Please also include idea.log file (you can attach all diagnostics using Help | Collect Logs and Diagnostic Data action). Thank you.

Hi Andrey Dernov That would imply this hasn't already been done.

https://youtrack.jetbrains.com/issue/IDEA-162962

Admittedly that bug was likely raised on WSL1 but it is still valid today despite being closed.

Commented here
https://youtrack.jetbrains.com/issue/IDEA-242627#focus=Comments-27-4372132.0-0

0

FYI for anyone looking into this Intellij released a feature that now allows you to configure your IDE backend to launch directly in WSL2. I can confirm symlinks work. Here's the link. Hope it helps others.

 

The only drawback is the inordinate amount of RAM it uses (12gb in my case for an enterprise project). But I can live with that.

0

Please sign in to leave a comment.