Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

How to run VS Code with OpenShift Dev Spaces

July 12, 2022
Mario Loriedo
Related topics:
IDEsKubernetes
Related products:
Developer ToolsRed Hat OpenShift Dev Spaces

Share:

    Red Hat OpenShift Dev Spaces (formerly CodeReady Workspaces) is an OpenShift-native developer environment server. Version 3.0 has just been released, and it allows you to choose the IDE that will be included in the development environment. Currently, the editors included with OpenShift Dev Spaces are Eclipse Theia and JetBrains IntelliJ IDEA.

    What about Visual Studio Code? Although we plan to use it as the default IDE in future versions of OpenShift Dev Spaces, Visual Studio Code is not included in version 3.0. But Eclipse Che, which is the upstream project for OpenShift Dev Spaces, already includes it, and we can easily use it in OpenShift Dev Spaces too. Read on to learn how this works.

    Select Visual Studio Code as the editor of a Dev Space environment

    Visual Studio Code is included in the Eclipse Che plugin registry with the identifier che-incubator/che-code/insiders. OpenShift Dev Spaces has its own internal plugin registry, but it can use external registries too, including the online Eclipse Che plugin registry. We can reference the online Che registry using a file in the Git repository or through a URL parameter. We'll take a quick look at each approach.

    Option 1: Adding che-editor.yaml in the Git repository

    The easiest way to use Visual Studio Code for a given project is to reference it from a che-editor.yaml file in a Git repository.

    Create a .che folder and add a che-editor.yaml file with the following content in it:

    id: che-incubator/che-code/insiders
    registryUrl: https://eclipse-che.github.io/che-plugin-registry/main/v3

    The first line specifies the identifier of the editor. The second line contains the URL of the plugin registry where the editor is published. We are using the online Eclipse Che plugin registry in this example.

    Just commit and push the change to the project Git repository (Figure 1). Once the file is pushed, any OpenShift Dev Spaces remote development environment started using the Git repository URL (GitHub, GitLab and Bitbucket are supported) will use Visual Studio Code as the editor.

    Adding the file .che/che-editor.yaml in a git repository
    Figure 1: Adding file .che/che-editor.yaml in a git repository
    Figure 1: Adding the file .che/che-editor.yaml in a Git repository

    Visual Studio Code is not the only editor that can be used from the online Che plugin registry. Here is a list of the editor IDs that can be referenced in from .che/che-editor.yaml:

    EditorEditor ID in the Che plugin registry
    Visual Studio Codeche-incubator/che-code/insiders
    JetBrains IntelliJ IDEA

    che-incubator/che-idea/next

    che-incubator/che-idea/latest

    JetBrains PyCharm

    che-incubator/che-pycharm/next

    che-incubator/che-pycharm/latest

    Option 2: Using the URL parameter che-editor

    It's not always possible to add the file .che/che-editor.yaml into a Git repository. In these cases, it's still possible to specify the editor using the che-editor URL parameter:

    https://<devspaces-hostname>#<git-repository-url>?che-editor=<editor-definition-url>

    Here's an example of such a URL:

    https://devspaces.apps.mloriedo-devworkspaces.devcluster.openshift.com/#https://github.com/devfile/api?che-editor=https://eclipse-che.github.io/che-plugin-registry/main/v3/plugins/che-incubator/che-code/insiders/devfile.yaml
    Using the che-editor URL parameter
    Figure 2: Using the che-editor URL parameter

    Here is a list of available editors definitions in the Che plugin registry that can be used in the che-editor URL parameter:

    EditorLink to the Che Plugin Registry definition
    Visual Studio Codedevfile.yaml
    JetBrains IntelliJ IDEA

    devfile.yaml (latest version)

    devfile.yaml (next most recent version)

    JetBrains PyCharm

    devfile.yaml (latest version)

    devfile.yaml (next most recent version)

    What Visual Studio Code extensions are available?

    The Visual Studio Code binary that is included in the Che plugin registry is pre-configured to use the online Open VSX Registry, which contains thousands of extensions and is owned by the Eclipse Foundation. Those extensions can be installed from Visual Studio Code itself as usual (Figure 3).

    Browsing and installing Visual Studio Code extensions from Open VSX
    Figure 3: Browsing and installing Visual Studio Code extensions from Open VSX

    Using Open VSX extensions in air gapped scenarios is currently not supported. We are working on an offline version of Open VSX Registry that can be used with OpenShift Dev Spaces to support such environments, but that won't be available before OpenShift Dev Spaces 3.3.

    Is Visual Studio Code supported for OpenShift Dev Spaces?

    Visual Studio Code is currently only a community project and, as such, it is not included in OpenShift Dev Spaces customer support. (The rest of your OpenShift Dev Spaces environment is fully supported; only the changed editor would not be fully supported if you installed it.) For this change, Red Hat will offer "commercially reasonable" support, which means we will try to help you but cannot make the same guarantees (with SLAs) that we make for the rest of OpenShift Dev Spaces.

    What's the difference between this editor and Microsoft Visual Studio Code?

    The Visual Studio Code-based editor used by Eclipse Che, called che-code, is a customization of Visual Studio Code Open Source (Code OSS). It's not a fork of Code OSS (the source code is included as a Git subtree) and that makes it easy to automatically fetch the latest changes from Code OSS multiple times a day (currently every four hours).

    The che-code customizations include:

    • Eclipse Che icons and labels (branding)
    • A few extra built-in extensions (resource monitoring, port plugin, devfile commands, projects, and remote terminal support)
    • The configuration to use the online Open VSX Registry
    • An opt out from Microsoft telemetry

    Microsoft Visual Studio Code is built on top of Code OSS as well, but includes some closed source built-in extensions, uses the Microsoft Visual Studio Code extensions marketplace, and has telemetry turned on.

    We considered using an existing project like coder or openvscode-server to run Visual Studio Code in the browser. But those are forks (making them harder to rebase), and the code to run Visual Studio Code in the browser is, as of now, open source and available in Code OSS, so we don't think there is currently any value to using an intermediate project.

    What's the roadmap for including Visual Studio Code in OpenShift Dev Spaces?

    The default OpenShift Dev Spaces editor is still Eclipse Theia, but the number of Visual Studio Code extensions that can be run properly by Theia is limited. That has been our main issue for the last three years. Developers don't care much about the question of Visual Studio Code vs. Eclipse Theia, but they want to run the myriad of extensions that are available out there.

    Our main goal for 2022 Q3 is to include a Code OSS-based editor using Open VSX Registry in OpenShift Dev Spaces and make it the default editor. To do that, we are currently closing the feature gap with Theia. In particular, we are working on an idling mechanism to stop environments that have been inactive for a given amount of time, as well as working on support for air gapped environments.

    Is it possible to use Visual Studio Code on the Developer Sandbox?

    The Red Hat Developer Sandbox hasn't been updated to OpenShift Dev Spaces yet, and it's not possible to use CodeReady Workspaces 2.15 to provision Visual Studio Code-based development environments. But the DevWorkspace Operator, the new dev environments engine used by OpenShift Dev Spaces, is installed on the Developer Sandbox (because the Web Terminal depends on it), and it supports running a Visual Studio Code-based development environment.

    Here are some command line instructions to do that from the OpenShift Web Terminal. You can see the results in Figure 4.

    VSCODE_SAMPLE_DW="https://eclipse-che.github.io/che-devfile-registry/main/devfiles/nodejs/devworkspace-che-code-insiders.yaml"
     
    curl  -sSL "${VSCODE_SAMPLE_DW}" | sed 's/^[[:space:]]\{8,\}container:/        container:^          env: [{name: CODE_HOST, value: "0.0.0.0"}]/g' | # <-- CHE IS NOT THERE
    sed 's/template:/template:^    attributes:^      controller.devfile.io\/storage-type: ephemeral/g' | # <-- EPHEMERAL IS FASTER
    sed 's/volume: {}/volume: {ephemeral: true}/g' |
    sed '/tkn=eclipse-che/d' |
    tr '^' '\n' | \
    oc apply -f -
    oc get dw nodejs-web-app --watch
    
    Running Visual Studio Code in the Red Hat Developer Sandbox using the DevWorkspace Operator
    Figure 4: Running Visual Studio Code in the Red Hat Developer Sandbox using the DevWorkspace Operator

    We're still working on expanding editor support in OpenShift Dev Spaces. But by following the steps outlined here, users can take advantage of their familiarity with Visual Studio Code and its ecosystem of extensions today.

    A special thank you to Rick Wagner and Florent Benoit for their review and suggestions for this article.

    OSZAR »
    Last updated: October 29, 2024

    Related Posts

    • CodeReady Workspaces scales up, is now Red Hat OpenShift Dev Spaces

    • Install OpenShift's Web Terminal Operator in any namespace

    Recent Posts

    • LLM Compressor: Optimize LLMs for low-latency deployments

    • How to set up NVIDIA NIM on Red Hat OpenShift AI

    • Leveraging Ansible Event-Driven Automation for Automatic CPU Scaling in OpenShift Virtualization

    • Python packaging for RHEL 9 & 10 using pyproject RPM macros

    • Kafka Monthly Digest: April 2025

    What’s up next?

    Cover of the ebook OpenShift for Developers

    Get a hands-on introduction to daily life as a developer crafting code on OpenShift, the open source container application platform from Red Hat, with OpenShift for Developers.

    OSZAR »
    Get the e-book
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue

    OSZAR »