Adding VSCode to Workbench#

You can install VSCode as an optional component of Data Science & AI Workbench. Technically, the stock Microsoft version of VSCode will not run in a browser-based environment, so Anaconda relies on code-server, a patched version of VSCode that allows it to be run in the browser.

Note

Anaconda recommends installing VSCode during a scheduled maintenance interval to prevent users from creating new sessions during installation. Existing sessions or deployments do not need to be halted.

Installing VSCode#

  1. Download the VSCode tarball file.

  2. Open a browser and log in to Workbench as the anaconda-enterprise user.

  3. Open any existing project and view its settings.

  4. If necessary, change the Default Editor to JupyterLab.

  5. Open a project session.

  6. Upload the VSCode tarball you just downloaded into the project.

  7. Open a terminal for your session.

  8. Unpack the tarball you just downloaded into the tools directory by running the following command:

    tar xzvf vscode.tar.gz -C /tools
    

Enabling VSCode as an editor option#

Once you have unpacked the tarball, you must enable VSCode as an editor option for project sessions.

  1. Access your Kubernetes cluster resource management console.

  2. Open the anaconda-enterprise-anaconda-platform.yml file.

  3. Find the tools: section of the file.

  4. Add the following line, nested under tools::

    vscode: VSCode
    
  5. Save your work and close the file.

  6. Open a terminal window and restart the workspace and ui pods by running the following command:

    kubectl delete --wait=false $(kubectl get pods -o name|grep -E 'worksapce|ui')
    

Removing VSCode as an editor option#

  1. Access your Kubernetes cluster resource management console.

  2. Open the anaconda-enterprise-anaconda-platform.yml file.

  3. Search for the tools: section of this file and remove the following line:

    vscode: VSCode
    
  4. Save your work and close the file.

  5. Open a terminal and restart the workspace and ui pods by running the following command:

    kubectl delete --wait=false $(kubectl get pods -o name|grep -E 'worksapce|ui')
    

Verifying your installation#

  1. Return to Workbench in your browser and navigate to the projects grid.

  2. Create a new project.

  3. Open your project and view its settings.

  4. Open the Default Editor dropdown menu and select Visual Studio Code.

  5. Click Save.

  6. Open a session for your project.

Uninstalling VSCode#

To completely remove VSCode from your instance of Workbench:

  1. Stop any existing project session that is currently using VSCode. These sessions must also choose a different default editor, such as JupyterLab.

    Caution

    If you do not choose a different default editor, sessions will fail to start for these projects.

  2. Access your Kubernetes cluster resource management console.

  3. Open the anaconda-enterprise-anaconda-platform.yml file.

  4. Search for the tools: section of this file and remove the following line:

    vscode: VSCode
    
  5. Save your work and close the file.

  6. Open a terminal and restart the workspace and ui pods by running the following command:

    kubectl delete --wait=false $(kubectl get pods -o name|grep -E 'worksapce|ui')
    
  7. Once the cluster is stable, you can remove VSCode from the /tools volume by running the following command:

    rm -r /tools/vscode
    

Upgrading to a new version of Workbench#

Upgrading Workbench will not affect the VSCode installation. However, the upgrade process will re-hide VSCode as an editor option. For more information, see Enabling VSCode as an editor option.

Updating the VSCode installation#

Anaconda recommends performing a fresh installation if you need to upgrade VSCode, as this minimizes the risk of unexpected issues.

  1. Stop any existing project session that is currently using VSCode.

  2. Download the latest VSCode installation project and save it locally.

  3. Open a browser and log in to Workbench as an administrator with managed persistence permissions.

    Tip

    The anaconda-enterprise user account has these permissions.

  4. Open a session for your VSCode installation project.

  5. Open a terminal in your session.

  6. Move the existing VSCode installation aside in case you need it by running the following command:

    mv /tools/vscode /tools/vscode.old
    

    Tip

    If an error occurs, you can restore this file to avoid downtime.

  7. Remove the directory by running the following command:

    rm -r /tools/vscode
    
  8. Upload your new VSCode tarball file to the project.

  9. Install VSCode by running the following command:

    bash install_vscode.sh
    
  10. Verify your installation by running the following command:

    bash /tools/vscode/start_vscode.sh
    

    If your command returns an “address already in use” error, your installation was successful.

  11. Remove the /tools/vscode.old directory once the update is complete.

    rm -rf /tools/vscode.old
    

Installing VSCode extensions#

Anaconda relies on the Open VSX Registry as a source for VSCode extensions.

Installing an extension into a project#

  1. Open a session in your project using the VSCode editor.

  2. Click the extensions extensions icon in the left-hand navigation.

  3. Enter an extension’s name in the search field.

  4. Click Install next to the extension you want.

If you do not have a connection to the registry, you will need to obtain the extension’s .vsix file manually, then upload it to the project you want to use it in.

Installing an extension manually#

  1. Open a browser and log in to Workbench as an administrator with managed persistence permissions.

    Tip

    The anaconda-enterprise user account has these permissions.

  2. Open a project session using the VSCode editor.

  3. Upload your .vsix file to the project.

  4. Click the extensions extensions icon in the left-hand navigation.

  5. Click the more actions actions icon, then select Install from VSIX….

  6. Navigate to /opt/continuum/project/ and select your extension from the list.