|
| 1 | +[id="connect-visual-studio-code-to-che-workspace"] |
| 2 | + |
| 3 | += Connecting Visual Studio Code to a {prod-short} workspace |
| 4 | + |
| 5 | +{prod} supports connecting your desktop Visual Studio Code to a running {prod-short} workspace over link:https://code.visualstudio.com/docs/remote/tunnels/[Remote Tunnels]. |
| 6 | + |
| 7 | +.Connecting Visual Studio Code desktop to a new workspace |
| 8 | + |
| 9 | +Follow the steps below to connect a new workspace with your local Visual Studio Code. |
| 10 | + |
| 11 | +.Prerequisites |
| 12 | + |
| 13 | +. link:https://code.visualstudio.com/[Visual Studio Code] is installed. |
| 14 | + |
| 15 | +.Procedure |
| 16 | + |
| 17 | +. Create a workspace on the {prod-short} Dashboard and choose *Visual Studio Code (desktop)* as your editor. |
| 18 | ++ |
| 19 | +image::vscode-remote/select-editor.png[IntelliJ IDEA Ultimate on Dashboard,link="{imagesdir}/vscode-remote/select-editor.png"] |
| 20 | + |
| 21 | +. Wait for the login page to appear. |
| 22 | ++ |
| 23 | +image::vscode-remote/login.png[Open Gateway prompt,link="{imagesdir}/vscode-remote/login.png"] |
| 24 | ++ |
| 25 | + |
| 26 | +. Log in with your Microsoft or GitHub account. |
| 27 | ++ |
| 28 | +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. |
| 29 | ++ |
| 30 | +image::vscode-remote/login-with-provider.png[Open Gateway prompt,link="{imagesdir}/vscode-remote/login-with-provider.png"] |
| 31 | + |
| 32 | +. Complete the authentication process. |
| 33 | ++ |
| 34 | +Paste in the code from the clipboard and follow the instructions. |
| 35 | +On successful authentication, close the pop-up and wait for the tunnel to your workspace to be created. |
| 36 | ++ |
| 37 | +image::vscode-remote/open-visual-studio-code.png[Open Gateway prompt,link="{imagesdir}/vscode-remote/open-visual-studio-code.png"] |
| 38 | + |
| 39 | +. Open your workspace in Visual Studio Code desktop. |
| 40 | ++ |
| 41 | +Click *Open in Visual Studio Code desktop* to open your workspace in the desktop version of Visual Studio Code. |
| 42 | +Confirm opening the desktop application by clicking *Open Visual Studio Code - URL Handler*. |
| 43 | ++ |
| 44 | +image::vscode-remote/confirm-opening-vscode-desktop.png[Open Gateway prompt,link="{imagesdir}/vscode-remote/confirm-opening-vscode-desktop.png"] |
| 45 | + |
| 46 | +[NOTE] |
| 47 | +==== |
| 48 | +If you are not signed in yet, allow Visual Studio Code to sign in with the same account you used to create the tunnel. |
| 49 | +==== |
| 50 | + |
| 51 | +[TIP] |
| 52 | +==== |
| 53 | +If Visual Studio Code opens your workspace with a delay, open *Remote Explorer* view. |
| 54 | +==== |
| 55 | + |
| 56 | +.Connecting Visual Studio Code to an existing workspace |
| 57 | + |
| 58 | +With link:https://code.visualstudio.com/docs/editor/command-line[Visual Studio Code Command Line Interface (CLI)] you can create a tunnel to an existing workspace. |
| 59 | + |
| 60 | +.Prerequisites |
| 61 | + |
| 62 | +. link:https://code.visualstudio.com/[Visual Studio Code] is installed. |
| 63 | +. link:https://marketplace.visualstudio.com/items?itemName=ms-vscode.remote-server[Remote - Tunnels] extension is installed. |
| 64 | + |
| 65 | +.Procedure |
| 66 | + |
| 67 | +. Install Visual Studio Code CLI in your workspace. |
| 68 | ++ |
| 69 | +Open a terminal and run the following command to install Visual Studio Code CLI in the `/checode` directory. |
| 70 | ++ |
| 71 | +[source,shell,subs="attributes+"] |
| 72 | +---- |
| 73 | +curl 'https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64' --location -o /tmp/code.tar.gz && \ |
| 74 | +tar -xvzf /tmp/code.tar.gz --directory=/checode |
| 75 | +---- |
| 76 | ++ |
| 77 | +[IMPORTANT] |
| 78 | +==== |
| 79 | +If you don't have `gzip` installed in your workspace, you won't be able to install the CLI using the command above. |
| 80 | +In this case you need to: |
| 81 | +
|
| 82 | +. link:https://code.visualstudio.com/Download[Download CLI] for *Linux x64* architecture to your desktop, |
| 83 | +unpack and upload the extracted binary to your workspace root. |
| 84 | +
|
| 85 | +. Move CLI binary to `/checode` directory and make it executable: |
| 86 | +
|
| 87 | +[source,shell,subs="attributes+"] |
| 88 | +---- |
| 89 | +mv $PROJECT_SOURCE/code /checode && chmod +x /checode/code |
| 90 | +---- |
| 91 | +
|
| 92 | +==== |
| 93 | + |
| 94 | +. Launch the Visual Studio Code CLI and log in using your Microsoft or GitHub account. |
| 95 | ++ |
| 96 | +[source,shell,subs="attributes+"] |
| 97 | +---- |
| 98 | +/checode/code tunnel --accept-server-license-terms --name $DEVWORKSPACE_NAME |
| 99 | +---- |
| 100 | ++ |
| 101 | +image::vscode-remote/cli-create-tunnel.png[Open Gateway prompt,link="{imagesdir}/vscode-remote/cli-create-tunnel.png"] |
| 102 | ++ |
| 103 | +After successful login, you will be prompted to open the workspace in your browser. |
| 104 | + |
| 105 | +. Open your workspace in local Visual Studio Code. |
| 106 | ++ |
| 107 | +Open your local Visual Studio Code and navigate to *Remote Explorer* view. A tunnel to your workspace will appear. |
| 108 | +With the buttons on the right, open your workspace in the current or a new window. |
| 109 | ++ |
| 110 | +image::vscode-remote/vscode-remote-explorer.png[Open Gateway prompt,link="{imagesdir}/vscode-remote/vscode-remote-explorer.png"] |
| 111 | + |
| 112 | +[NOTE] |
| 113 | +==== |
| 114 | +A tunnel to your workspace will not appear if you are not signed in yet. |
| 115 | +Sign in using the same account you used to create the tunnel. |
| 116 | +==== |
0 commit comments