Use GitHub Copilot with VS Code

This document describes how to enhance your coding by installing the GitHub Copilot VS Code extension into a Domino Environment and using it with VS Code Workspaces in Domino.

Prerequisites

Before you can install the GiHub Copilot extension, you’ll need to download and rehost it.

Download the extension

  1. Download the GitHub Copilot extension from Visual Studio Marketplace.

  2. Choose Download Extension under Resources to download the Github.copilot-1.204.942.vsix package.

Download the extension

Rehost the extension

To rehost the GitHub Copilot extension:

  1. Upload the GitHub.copilot-1.204.942.vsix file to either an S3 bucket or other similar object store.

  2. Make it public, or host it on a web server that your Domino deployment can reach during the container image build.

  3. Make a note of the URL from which the file can be downloaded.

Rehost the extension

Install the extension

Now that you have the GitHub Copilot extension downloaded and rehosted, you’re ready to install and configure it for use.

Identify the VS Code version

To get the applicable VS Code version:

  1. View the available versions of VS Code on GitHub’s code-server page.

  2. From the list of Assets, locate the version of VS Code you are using and look for the corresponding amd64.deb build for that version.

  3. Right-click on that URL to Copy link address. Make note of this address.

Note
The GitHub Copilot extension generally works best with the latest version(s) of VS Code.

Create a new Domino Environment

To create a new Domino Environment in your instance of Domino:

  1. Use the Domino 5.10 or 5.11 Minimal Environment as the base: quay.io/domino/compute-environment-images:ubuntu20-py3.9-domino5.10-minimal

  2. Click Customize before building.

Add Dockerfile instructions

Add the following Dockerfile instructions, making the following substitutions:

  1. The URLs you noted earlier for your rehosted .vsix extension file.

  2. The release of VS Code you want to install.

USER root

# Install VS Code (replace URL and update filename)
RUN curl -fOL https://github.com/coder/code-server/releases/download/v4.90.0/code-server_4.90.0_amd64.deb && \
    dpkg -i code-server_4.90.0_amd64.deb

# Add a VS Code start script
RUN mkdir -p /opt/domino/workspaces/vscode && \
    chown -R ubuntu:ubuntu /opt/domino/workspaces/vscode && \
    echo "#!/bin/bash" >> /opt/domino/workspaces/vscode/start && \
    echo "SETTINGS_DIR=\${DOMINO_WORKING_DIR}/.vscode" >> /opt/domino/workspaces/vscode/start && \
    echo "FILE=\${SETTINGS_DIR}/settings.json" >> /opt/domino/workspaces/vscode/start && \
    echo "# Add a user setting file if it doesn't exist. Add in DOMINO_WORKING_DIR so it persists across sessions" >> /opt/domino/workspaces/vscode/start && \
    echo "if [ ! -f \"\$FILE\" ]; then" >> /opt/domino/workspaces/vscode/start && \
    echo "sudo mkdir -p \"\${FILE%/*}\"" >> /opt/domino/workspaces/vscode/start && \
    echo "sudo chown -R ubuntu:ubuntu \${SETTINGS_DIR}" >> /opt/domino/workspaces/vscode/start && \
    echo "printf \"{" >> /opt/domino/workspaces/vscode/start && \
    echo "\t\\\"extensions.autoUpdate\\\": false," >> /opt/domino/workspaces/vscode/start && \
    echo "\t\\\"extensions.autoCheckUpdates\\\": false," >> /opt/domino/workspaces/vscode/start && \
    echo "\t\\\"python.pythonPath\\\": \\\"\$(which python)\\\"," >> /opt/domino/workspaces/vscode/start && \
    echo "\t\\\"workbench.startupEditor\\\": \\\"none\\\"," >> /opt/domino/workspaces/vscode/start && \
    echo "\t\\\"workbench.colorTheme\\\": \\\"Default Dark+\\\"" >> /opt/domino/workspaces/vscode/start && \
    echo "}\" > \${FILE}" >> /opt/domino/workspaces/vscode/start && \
    echo "fi" >> /opt/domino/workspaces/vscode/start && \
    echo "code-server \${DOMINO_WORKING_DIR} --user-data-dir \${SETTINGS_DIR} --auth none --bind-addr 0.0.0.0:8888 --extensions-dir \${HOME}/.local/share/code-server/extensions --disable-telemetry" >> /opt/domino/workspaces/vscode/start && \
    chmod +x /opt/domino/workspaces/vscode/start

USER ubuntu

# Install Copilot extension (replace URL and update filename)
RUN sudo wget -P /tmp/ https://package-serving.s3.us-west-2.amazonaws.com/GitHub.copilot-1.200.925.vsix && \
    code-server --install-extension /tmp/GitHub.copilot-1.200.925.vsix

Configure Pluggable Workspace Tools

Next, add the following Pluggable Workspace Tools configuration:

vscode:
   title: "vscode"
   iconUrl: "https://raw.github.com/dominodatalab/workspace-configs/develop/workspace-logos/vscode.svg?sanitize=true"
   start: [ "/opt/domino/workspaces/vscode/start" ]
   httpProxy:
      port: 8888
      requireSubdomain: false

Finalize the extension installation

After your Dockerfile instructions and Pluggable Workspace Tools fields have been populated as shown, click Build and then wait for the build to complete.

Use GitHub Copilot with VS Code

Once the extension has been installed and configured, you can use it to start writing code by following these steps:

  1. Start VS Code.

  2. Authenticate with GitHub.

  3. Confirm that Copilot is ready.

  4. Start writing code with Copilot.

For more information about each of these steps, see the User Guide tutorial on how to Use GitHub Copilot with VS Code.