IntelliJ Rust brings JetBrains-quality language support and full IDE experience to your Rust workflow. Rust becomes native to IDEA, CLion, and other IntelliJ IDEs with smart coding assistance, seamless Cargo support, and built-in test runner. In CLion, you get even more: fully-fledged debugger, CPU profiler, and Valgrind memcheck. Software developers know the importance of using the best tool for the job. Often this means choosing a world-class integrated development environment (IDE), which JetBrains IntelliJ IDEA. A: The IntelliJ IDEA 64-bit version was specially designed for 64-bit Windows Operating Systems and performed much better on those. The IntelliJ IDEA 32-bit version was initially intended for 32-bit Windows Operating Systems, but it can also run on 64-bit Windows Operating Systems. IntelliJ IDEA is an application that builds.
If you managed to get here then I’m assuming you also have problems using Jetbrains tools with Windows Subsystem for Linux 2 (WSL2). Here’s a list of the problems I myself encountered when using WebStorm with WSL2 (the problems are the same in any of their tools - WebStorm, PyCharm and IntelliJ):
Poor Git performance under
/mnt/...
This problem has been described well by a lot of blog posts and bug reports, and everyone suggests to keep your project files on native Linux filesystem, for example/home/<user>/projects
like I do. This however causes a number of problems listed belowOpening a file from
wsl$...
raises a warning “External file changes sync may be slow” From what I gathered it’s because WebStorm can’t start thefsnotifier64
on a network drive, which it thinks our Linux is on.“Filesystem Case-Sensitivity Mismatch” This can be easily fixed by going to “Help” -> “Edit Custom Properties”, and setting
idea.case.sensitive.fs=true
as described here: https://confluence.jetbrains.com/display/IDEADEV/Filesystem+Case-Sensitivity+Mismatch One thing to watch out with this setting is that you’re going to get that same warning when you open a project from your windows partition, so setting it to true might not be the optimal option.Incorrect line endings By default WebStorm/IntelliJ/PyCharm assume that the files you write should be using the line endings from the OS you’re in. This however can cause problems when editing files on WSL. On Windows the git client does the conversion between CRLF and LF for you when pulling and committing changes, so this is not an issue. This will not be the case on WSL, and could get you into some problems down the line. Line endings can be changed in Jetbrains tools to whatever you prefer, but that might not be ideal when dealing with projects on WSL and Windows from the same setup
.idea
folder gets corrupted by Windows version of Jetbrains tools This particular problem can be observed by opening freshly pulled project from repository, opening it in Jetbrains editor, closing the project and re-opening it. What happened for me is that my project files disappeared.
Well, if using a Windows version of WebStorm with WSL2 is such a pain, why don’t I just run WebStorm inside WSL2.
To do this we’ll need to add support for X11 to our WSL with the help of X11 Port Forwarding.
There are a few different options to achieve this:
- VcXsrv: https://sourceforge.net/projects/vcxsrv/
- Xming: https://sourceforge.net/projects/xming/
- Cygwin/X: https://x.cygwin.com/
I tried a few of them to see which one works for me before settling on Cygwin/X, which turned out to be the most stable to me, even though the setup procedure is a bit more involved.
As there’s already a great documentation page dedicated to installing Cygwin/X on Windows, I’m not going to repeat these instructions here. Please head over to https://x.cygwin.com/docs/ug/setup.html#setup-cygwin-x-installing for detailed instruction on how to get it installed. Make sure to select all required packages from the section 15
.
Once that is done we’re going to add the Cygwin/X launcher to our startup applications - this will start the X11 server any time we start our system.
Firstly, right click on an empty space on your desktop, select “New” then “Shortcut”.
Then in the “Create shortcut” popup in the location box enter:
Then click “Next” and “Finish” buttons.
Finally move the newly created shortcut over to the Start-up position of your Start Menu. You can get there by opening this location in Windows Explorer:
Once the shortcut is in the “StartUp” position of your Start Menu, double-click on that shortcut to start the Cygwin/X with the correct options.
The next step is to install a Desktop Environment, as WSL doesn’t come with any desktop environment. The environment I chose is XFCE4 as its use with WSL is well documented (e.g. https://autoize.com/xfce4-desktop-environment-and-x-server-for-ubuntu-on-wsl-2/)
In the WSL terminal run
The next step is to configure your X11 Display forwarding to the Windows Host X11. I’m using zsh
shell, so the file I’m editing is ~/.zshrc
, but in your case it could be the default ~/.bashrc
or ~/.bash_profile
depending on the shell you use.
Once you save these changes make sure to re-load them in your shell by doing source ~/.zshrc
(if you’re using ZSH like me), or by re-opening your WSL terminal.
The next logical step is to see if everything works fine. In the WSL terminal run:
After a few seconds you should be greeted in XFCE4 desktop. You can use it to change your system settings like key repeat speed, which is different to your Windows.
The last step is to head over to Jetbrains website, and download a linux version of WebStorm/IntelliJ/PyCharm, extract it and finally running /home/tmikus/WebStorm-193.6015.40/bin/webstorm.sh
. If everything worked correctly it should open a new window of your editor.
Good luck, and happy coding!
- Intellij Idea Tutorial
- Intellij Idea Resources
- Selected Reading
Debugger makes application debugging much easier. Using debugger, we can stop the execution of program at a certain point, inspect variables, step into function and do many things. IntelliJ provides inbuilt Java debugger.
Breakpoints
Breakpoint allows stopping program execution at certain point. Breakpoints can be set by hovering the mouse over the Editor’s gutter area and clicking on it.
Breakpoints are denoted using red circle symbols. Consider the breakpoint set at line 3.
Consider the following steps to understand more on how the breakpoints work −
Right-click on the red circle symbol.
Select the More options.
To remove breakpoint just click on same symbol.
Follow these steps to start the debugger −
- Navigate to the Run menu.
- Select the Debug option.
Step into
While debugging, if a function is encountered and a step into action is selected, then debugger will stop program execution at each point of that function as if debugging is enabled for that function.
For instance, when program execution reaches at line 9 and if we select the step into action then it stops the execution at each line in the sayGoodBye() function.
Step out
The Step out action is exactly the reverse of Step in action. For instance, if you perform the step out action with the above scenario then debugger will return from the sayGoodBye() method and start execution at line 10.
Step over
The Step over action does not enter into function instead, it will jump to the next line of code. For instance, if you are at line 9 and execute the step over action then it will move execution to line 10.
Resume Program
The Resume Program action will continue execution of program by ignoring all breakpoints.
Stop action
The Stop action helps stop the debugger.
Smart step into
While debugging, we may sometimes reach a line of code that calls several methods. When debugging these lines of code, the debugger typically allows us to use step into and leads us through all child functions and then back to the parent function. However, what if we only wanted to step into one child function? With Smart step-into, it allows us to choose the function to step into.
Intellij Idea Plugin
Now, let us create a Java class with the following line of code −
In the above code, allFunctions() calls 3 more functions. Let us set the breakpoint atthis function. Follow these steps to perform smart step into −
- Go to run
- Select smart step into.
- Select the child function to go.
Inspecting variables
Download Intellij Idea
During debugging, IntelliJ shows value of variable in the Editor window itself. We can alsoview the same information in the Debug window.
Evaluate expression
Intellij Idea Ultimate
Evaluate expression allows to evaluate expression on the fly. Follow these steps to performthis action −
Intellij Idea Download
Start application in debugger
Navigate to Run->Evaluate expression.
Enter expression. In the example given below, the current value of variable ‘i’ is 0;hence, expression ‘i > 100’ will evaluate to false