Some Domino Standard Environments support launching Visual Studio Code (VSCode) in interactive Workspaces. VSCode is an open-source multi-language editor maintained by Microsoft. Domino can serve the VSCode application to your browser with the power of code-server from Coder.com.
VSCode support is available in the latest versions of the following Domino Standard Environments:
- Domino Analytics Distribution for Python 2.7
- Domino Analytics Distribution for Python 3.6
- Domino Analytics Distribution for Python 3.7
When using a VSCode-equipped Domino environment, there are two ways to launch the VSCode application.
Option 1: Launch VSCode directly
You can launch VSCode directly from the Workspaces dashboard or Quick Action menu, the same way you would launch RStudio or Jupyter.
If launched this way, your Workspace will open with the Domino controls around a VSCode editor. You can work with your project files in VSCode, and commit and sync with the Domino Workspace UI as normal.
Option 2: Launch VSCode from JupyterLab
In VSCode-equipped environments, you will also find VS Code IDE as a notebook option in JupyterLab.
If launched this way, JupyterLab will open a new tab that will serve the VSCode application. This editor is running in the same Domino Run container as your JupyterLab application. However, the VSCode tab will not show the Domino Workspace controls. If you want to sync, commit, or stop your Workspace after working in VSCode, you must do so from the JupyterLab tab.
You can use the extensions manager in VSCode to install extensions from the marketplace as you would usually. However, note that these extensions are installed only in the current Workspace session, and will not persist once the session is shut down.
To install persistent extensions that will be available in every new VSCode Workspace, you must build them into your environment. Use the following steps to set up such an environment.
Microsoft obscures the download URL for the extension by default, so you will need to first open your browser’s development tools, then click the Download extension link.
You can retrieve the download URL for the extension by looking at the request details in your browser’s development tools. It should end with
/vspackage. Copy this URL for use in your custom environment.
In Domino, create a new environment. As the base image, you must use one of the VSCode-equipped Domino Standard Environments, listed in the prerequisites at the beginning of this article.
Add the following instructions to your new environment’s Dockerfile, replacing the folder names and example
/vspackageURL with the extension URL you retrieved earlier. These commands download the extension, extract the required files, and adds them to the appropriate folder.
apt-get update apt-get install -y bsdtar mkdir -p /home/ubuntu/.local/share/code-server/extensions/ms-python.python-2019.3.6558 && \ cd /home/ubuntu/.local/share/code-server/extensions/ms-python.python-2019.3.6558 curl -JL https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-python/vsextensions/python/2019.3.6558/vspackage | bsdtar -xvf - extension cd /home/ubuntu/.local/share/code-server/extensions/ms-python.python-2019.3.6558/extension/ && mv * ../ chown ubuntu:ubuntu /home/ubuntu/.local/share/code-server/
When finished, click Build. Following a successful build you can use this new environment to launch VSCode Workspace sessions with your desired extensions already installed.
VSCode can be added to some older environments by adding the following to your compute environment. The base environment must be 2018-05-23 or newer.
You can add the following to your compute environment docker file instructions:
#note: Make sure you are using the latest release if you'd like the latest version of the workspaces #https://github.com/dominodatalab/workspace-configs/releases RUN cd /tmp && wget https://github.com/dominodatalab/workspace-configs/archive/2019q2-v1.3.zip && \ unzip 2019q2-v1.3.zip && cp -Rf workspace-configs-2019q2-v1.3/vscode /var/opt/workspaces/vscode && \ rm -rf /var/opt/workspaces/workspace-logos && \ rm -rf /tmp/workspace-configs-2019q2-v1.3 RUN \ chmod +x /var/opt/workspaces/vscode/install && sleep 2 && \ /var/opt/workspaces/vscode/install
Next, add the following to your compute environment’s Pluggable Workspace Tools:
vscode: title: "vscode" iconUrl: "https://raw.github.com/dominodatalab/workspace-configs/develop/workspace-logos/vscode.svg?sanitize=true" start: [ "/var/opt/workspaces/vscode/start" ] httpProxy: port: 8888