Developing "in" Windows Subsystem for Linux

已回答

In Visual Studio Code there is a plugin which allows you to edit projects that live in the WSL filesystem. This is extremely useful for editing projects that were built for a unix-like environment on a Windows machine.

Is there any likelyhood of bringing this sort of functionality to the IntelliJ family of IDEs?

151

I know there are a bunch of wsl-related issues (including the ones linked to above), but they seem a bit short of what's required. I may add a new YouTrack issue, but I'd like to get a general notion of what's possible given Idea's architecture. No point writing up a ticket for something infeasible.

The VS Code Remote extension for wsl is quite a game-changer for using wsl (especially version 2) for windows. It enables a developer to essentially do everything in linux, just using Windows for the GUI side of things. This is great for a number of reasons - the tooling is fantastic, the ext4 filesystem is much better suited to things like git & npm, etc. I don't even need to have any Windows versions of the developer tools installed at all.

By contrast, with IntelliJ Idea, if I want to have a unix commandline, I usually have to install, configure and maintain 2 of everything (git, sdks, compilers, etc) - one for linux commandline use, and one for IntelliJ to use. And one way or another presents performance problems because of bridging the separate windows & linux filesystems - either I store my source on wsl, in which case IntelliJ's  file access is slow, or on the Windows filesystem, in which case my commandline access is slow.

I know some of the individual language plugins for IntelliJ (python I think?) allow use of sdks on the wsl side in an ad hoc kind of way, but many don't (java notably).

Does the IntelliJ architecture allow something along the  lines of what VS Code is doing here?

53

I have come to the conclusion that for my uses the advantages of WSL are so great that it's worth running the Linux version of IntelliJ idea under WSL (using a Windows X Server). The disadvantages seem to be few and fairly trivial so far for me. Pending JetBrains making WSL a first-class citizen for their Windows IDEs (which for all I know may not even be feasible), this seems to be a good option.

6

Jetbrains should be looking at this as a priority!

33

Any updates on this? Really looking for some plugin for integration with WSL.

7

I agree with Crispin above, maintaining two of each tool is a real pain; I end up with a lot of setup overhead to avoid some inefficiencies, such as having duplicate maven repositories in both WSL and Windows.  I'd love Windows Intellij to run in the WSL environment.

3

@Crispin Bennett

How did you install phpstorm in wsl?

I have got an Xserver working with ssh to run linux gui's from wsl but I cant install phpstorm without snap.

```sudo snap install phpstorm --classic
Interacting with snapd is not yet supported on Windows Subsystem for Linux.
This command has been left available for documentation purposes only.```

 

 

0

Bradozman I didn't use the snap  but downloaded the *.tgz directly from Jetbrains (it was IntelliJ Idea, not PHPStorm, but it's the same notion). I just put it somewhere sensible to run it from. Don't remember where - I'm on bare-metal Linux now, but probably /opt or /usr/local/share.  It worked nicely.

0

Yeah thats what I did but then I still couldn't get it ti run with xming. Was there a guide or anything you followed to get it working?

0

I think I had to do a bit of googling around, but IIRC  it didn't involve doing  much more than setting the DISPLAY environment variable, and opening up windows firewall for the x server executable. I'd test basic connectivity with a simple X app first (eg. xeyes). I found x410 the best Windows x server I tried. Even if you're using something else their documentation is quite helpful (https://token2shell.com/howto/x410/).

0

Using VS code now but would much rather use RubyMine for this.  Code lives in WSL 2.

0

We can't support projects inside the wsl atm, because our IDE relies on file system events and P9 does not propagate those to the windows. And our IDE runs on Windows. You can try this and it may work somehow, but most likely you'll get constant re-indexing or other unexpected behavior.

1

Alexandr Evstigneev just voted for the IDEA-197573 issue.  Hope it lands soon.

0

1) In the linux subsystem, do:

cd /mnt/c/Users/<username>/Projects/
git clone git@github.com:<username>/<project>.git
explorer.exe .

2) In the file explorer, double click/open the project

 

----

 

Also consider configuring the IDE to use the linux terminal (instead of windows):

Settings > Tools > Terminal > Shell path

"C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\ubuntu.exe" run

 

source: https://stackoverflow.com/questions/51912772/how-to-use-wsl-as-default-terminal-in-webstorm-or-any-other-jetbrains-products

-2

I've tried working on a mounted windows folder but I encountered some weird file system permission problems when I ran npm from a linux terminal in that mounted folder

0

Yeah this is why most people want to use the WSL file system instead of /mnt most ppl talking about this already use WSL as their terminal in ide etc etc this is a more advanced problem hence why ppl are asking for the ability to edit directly from WSL file system. Currently the only thing you can really do is dual boot or do all your development in a vm or run php storm from Ubuntu via x server.

FYI I also tried WSL v2 from Windows insiders builds and this also comes with its own set of problems as WSL 2 is a vm.

There currently is no way to resolve the incompatible file system issues without something like vs code. Would be nice if they had the file system service as part of WSL instead of vs code. Perhaps we should be pestering Microsoft?

2

I'm just here to also agree with the others. I had my sites running from the wsl filesystem, and I was amazed at how fast they were running; I've never had things like composer run that fast before. However, PHPStorm would NOT work as expected (namely, after it restarted, it couldn't open the .iml file and the directory listing was unusable.)

I moved the files to /mnt/c/soandso, and PHPStorm is working as expected... but any commands run in the container for those files are now taking 2 to 3 times as long.

I'm going to attempt to do what one other user suggested and run PHPStorm from within Ubuntu.

 

1

I'm running the Linux Version of Intellij inside of WSL with an Xserver on Windows. It's not ideal but it works well. I'm using x410 as the xServer. I'm more than happy to share my setup with folks.

5

In general I found the XServer solution and running from native Linux Subsystem to work better (PyCharm). The only major problem I encounter regards file updating. It is very slow and when it comes to repository updates it can get quite annoying having to wait 30 seconds to a minute for the update for a simple checkout.  In VS Code there is no such overhead. I believe this should be tackled by the team. 

4

@... D Tsimpoukis is there a tutorial to setup IntelliJ into wsl and see its GUI in Windows? I find it tricky.

0

Andrey Semakin Here is a tutorial getting Gitkraken working in WSL2. It covers the basics of setting up the xserver. From there just download the Jetbrains toolbox app for linux to install whatever ide you need. 

1

I used this guide and it worked perfectly: https://askubuntu.com/a/993331.

1

Serge Baranov did you run into https://youtrack.jetbrains.com/issue/IDEA-240600 or do you run a full UI desktop in X Server?

Still surprised that it relies on focus/unfocusing to display file changes, given that file changes are still detected behind the scenes via inotify.

1

I am also running the Linux version of IntelliJ Idea, but under the new WSL 2, and it feels as fast as running natively on Linux. Here is a step by step guide on how to set it up:

6

Anything new on this?

The wsl file system is a lot easier to access now and runs faster and PHPStorm works great opening the folder of the new wsl2 file system, however, it cant watch files now because it's a network mount?

I guess technically it is but it will probably be a lot faster now. Just wondering if anything has changed in how people tackle this?

0

Still a number of issues with it, nothing useful works except git which is pretty much the only thing I don't care about as I use git via cli and have it hooked up to windows credential manager anyway.


I tried using via vcxsrv but that doesn't work since I moved to wsl2. IDE freezes entirely when I open my project. I can open a small project with a few files but not my big ones.

So still no viable option yet other than working inside a VM.

Would be nice if since it detects WSL and uses git command that it also just used wsl for ALL commands, can't see why not. 😫 We'll get there eventually I guess. I'm too deep into phpstorm now to try switching to vscode so Ima hang in there and hope they pull through.

If anyone has any ideas why running ubuntu version via x11 would freeze on large project let me know.

0

Bradozman see my comment above on how to run in IntelliJ IDEA on WSL2, it works very well and very fast.

3

请先登录再写评论。