Code with JetBrains IDEs

In this page, we cover the common topics regarding using JetBrains IDEs, such as IntelliJ, RubyMine, PyCharm, GoLand, WebStorm, CLion, etc. to work on code inside the Crafting Sandbox.

Directly edit code in sandbox using JetBrains Gateway and Client

JetBrains offers a suite of powerful and feature-rich IDEs for common programming languages. For remote development, it offers JetBrains Gateway on the client side to work with IDE backend running on the server. After the Gateway sets up IDE backend, it launches an IDE frontend JetBrains Client to connect with the backend via SSH.

Crafting Sandbox supports JetBrains Gateway natively with Crafting Plugin. It can be installed by simply run cs jetbrains command.

$ cs jetbrains
Downloading JetBrains Gateway ...
Downloading Crafting plugin
Unpacking Crafting plugin

It will download the latest version of JetBrains Gateway, and install the Crafting Plugin into the downloaded version. After that, it will automatically connect to the workspace you selected and launch JetBrains Client to edit the code inside the sandbox.

In this way, the IDE backend will run on the workspace on cloud, taking the heavy-lifting work of indexing the code, build, and run tests, etc., and a generic IDE frontend (JetBrains Client) will run on your local machine providing the native editing experience with GUI.

You can select which IDE backend to launch on the workspace to match the corresponding language you want to edit, like the following, by default it would use IntelliJ

$ cs jetbrains --ide=IntelliJ
$ cs jetbrains --ide=PyCharm
$ cs jetbrains --ide=RubyMine
$ cs jetbrains --ide=GoLand
$ cs jetbrains --ide=WebStorm
$ cs jetbrains --ide=CLion

Note that if the corresponding IDE backend is used first time on the workspace, it needs to be downloaded and installed, which will take a few minutes. We suggest you to pre-install the IDE into corresponding location on the workspace, i.e., under ~/.cache/JetBrains/RemoteDev/, and include the directory into Home Snapshot(see here) or Personal Snapshot (see here) so that it's loaded into any new sandbox you created.

Alternatively, you can also use a command to launch the JetBrains Gateway with GUI on your local machine and use the installed Crafting Plugin.

$ cs jetbrains --gateway

This way, you can select which workspace, which IDE you want to use in the GUI. Or in the address bar, simply paste the corresponding WebIDE link and click Connect.

It will also save the most recent connected workspaces in the list to help you quickly connect to them.

Use JetBrains IDE on local codebase in hybrid mode

If you prefer using your desktop version of IDE (e.g. IntelliJ) directly instead of using JetBrains Client, Crafting supports two ways for hybrid development as follows:

  • Code locally, build and run remotely with code sync: see here
  • Code and run one service locally, with context services on remote with port forwarding: see here