Connecting Visual Studio Code to a Che workspace

Eclipse Che supports connecting your desktop Visual Studio Code to a running Che workspace over Remote Tunnels.

Connecting Visual Studio Code desktop to a new workspace

Follow the steps below to connect a new workspace with your local Visual Studio Code.

Prerequisites
  1. Visual Studio Code is installed.

Procedure
  1. Create a workspace on the Che Dashboard and choose Visual Studio Code (desktop) as your editor.

    IntelliJ IDEA Ultimate on Dashboard
  2. Wait for the login page to appear.

    Open Gateway prompt
  3. Log in with your Microsoft or GitHub account.

    Click the Copy & Continue to Microsoft or Copy & Continue to GitHub button to copy the authentication code to the clipboard and to open the authenticating pop-up.

    Open Gateway prompt
  4. Complete the authentication process.

    Paste in the code from the clipboard and follow the instructions. On successful authentication, close the pop-up and wait for the tunnel to your workspace to be created.

    Open Gateway prompt
  5. Open your workspace in Visual Studio Code desktop.

    Click Open in Visual Studio Code desktop to open your workspace in the desktop version of Visual Studio Code. Confirm opening the desktop application by clicking Open Visual Studio Code - URL Handler.

    Open Gateway prompt

If you are not signed in yet, allow Visual Studio Code to sign in with the same account you used to create the tunnel.

If Visual Studio Code opens your workspace with a delay, open Remote Explorer view.

Connecting Visual Studio Code to an existing workspace

With Visual Studio Code Command Line Interface (CLI) you can create a tunnel to an existing workspace.

Prerequisites
  1. Visual Studio Code is installed.

  2. Remote - Tunnels extension is installed.

Procedure
  1. Install Visual Studio Code CLI in your workspace.

    Open a terminal and run the following command to install Visual Studio Code CLI in the /checode directory.

    curl 'https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64' --location -o /tmp/code.tar.gz && \
    tar -xvzf /tmp/code.tar.gz --directory=/checode

    If you don’t have gzip installed in your workspace, you won’t be able to install the CLI using the command above. In this case you need to:

    1. Download CLI for Linux x64 architecture to your desktop, unpack and upload the extracted binary to your workspace root.

    2. Move CLI binary to /checode directory and make it executable:

    mv $PROJECT_SOURCE/code /checode && chmod +x /checode/code
  2. Launch the Visual Studio Code CLI and log in using your Microsoft or GitHub account.

    /checode/code tunnel --accept-server-license-terms --name $DEVWORKSPACE_NAME
    Open Gateway prompt

    After successful login, you will be prompted to open the workspace in your browser.

  3. Open your workspace in local Visual Studio Code.

    Open your local Visual Studio Code and navigate to Remote Explorer view. A tunnel to your workspace will appear. With the buttons on the right, open your workspace in the current or a new window.

    Open Gateway prompt

A tunnel to your workspace will not appear if you are not signed in yet. Sign in using the same account you used to create the tunnel.