Chapter 5. IDEs in workspaces
Chapter 5. IDEs in workspaces 5.1. Supported IDEs The default IDE in a new workspace is Microsoft Visual Studio Code - Open Source. Alternatively, you can choose another supported IDE: Table 5.1. Supported IDEs IDE Status id Note Microsoft Visual Studio Code - Open Source Available che-incubator/che-code/latest che-incubator/che-code/insiders latest is the default IDE that loads in a new workspace when the URL parameter or che-editor.yaml is not used. insiders is the development version. JetBrains IntelliJ IDEA Community Edition Deprecated che-incubator/che-idea/latest che-incubator/che-idea/ latest is the stable version. is the development version. JetBrains IntelliJ IDEA Ultimate Edition (over JetBrains Gateway) Technology Preview che-incubator/che-idea-server/latest che-incubator/che-idea-server/ latest is the stable version. is the development version. 5.2. Repository-level IDE configuration in OpenShift Dev Spaces You can store IDE configuration files directly in the remote Git repository that contains your project source code. This way, one common IDE configuration is applied to all new workspaces that feature a clone of that repository. Such IDE configuration files might include the following: The /.che/che-editor.yaml file that stores a definition of the chosen IDE. IDE-specific configuration files that one would typically store locally for a desktop IDE. For example, the /.vscode/extensions.json file. 5.3. Microsoft Visual Studio Code - Open Source The OpenShift Dev Spaces build of Microsoft Visual Studio Code - Open Source is the default IDE of a new workspace. You can automate installation of Microsoft Visual Studio Code extensions from the Open VSX registry at workspace startup. See Automating installation of Microsoft Visual Studio Code extensions at workspace startup . Tip Use Tasks to find and run the commands specified in devfile.yaml . Use Dev Spaces commands by clicking Dev Spaces in the Status Bar or finding them through the Command Palette : Dev Spaces: Open Dashboard Dev Spaces: Open OpenShift Console Dev Spaces: Stop Workspace Dev Spaces: Restart Workspace Dev Spaces: Restart Workspace from Local Devfile Dev Spaces: Open Documentation Tip Configure IDE preferences on a per-workspace basis by invoking the Command Palette and selecting Preferences: Open Workspace Settings . Note You might see your organization's branding in this IDE if your organization customized it through a branded build. 5.3.1. Automating installation of Microsoft Visual Studio Code extensions at workspace startup To have the Microsoft Visual Studio Code - Open Source IDE automatically install chosen extensions, you can add an extensions.json file to the remote Git repository that contains your project source code and that will be cloned into workspaces. Prerequisites The public OpenVSX registry at open-vsx.org is selected and accessible over the internet. See Selecting an Open VSX registry instance . Tip To install recommended extensions in a restricted environment, consider the following options instead: https://access.redhat.com/documentation/en-us/red_hat_openshift_dev_spaces/3.19/html-single/administration_guide/index#administration-guide:configuring-the-open-vsx-registry-url to point to your OpenVSX registry. Section 5.5, "Defining a common IDE" . Installing extensions from VSX files . Procedure Get the publisher and extension names of each chosen extension: Find the extension on the Open VSX registry website and copy the URL of the extension's listing page. Extract the <publisher> and <extension> names from the copied URL: Create a .vscode/extensions.json file in the remote Git repository. Add the <publisher> and <extension> names to the extensions.json file as follows: { "recommendations": [ " <publisher_A> . <extension_B> ", " <publisher_C> . <extension_D> ", " <publisher_E> . <extension_F> " ] } Verification Start a new workspace by using the URL of the remote Git repository that contains the created extensions.json file. In the IDE of the workspace, press Ctrl + Shift + X or go to Extensions to find each of the extensions listed in the file. The extension has the label This extension is enabled globally . Additional resources Open VSX registry - Extensions for Microsoft Visual Studio Code compatible editors Microsoft Visual Studio Code - Workspace recommended extensions 5.4. Connecting JetBrains IntelliJ IDEA Ultimate Edition to a Dev Spaces workspace Red Hat OpenShift Dev Spaces supports connecting your local IntelliJ IDE to a running OpenShift Dev Spaces workspace over JetBrains Gateway. Prerequisites The JetBrains Gateway application is installed. The Gateway provider for OpenShift Dev Spaces is installed. In your local terminal, you are logged in to your OpenShift server with the OpenShift Client. Note The oc login command establishes the authenticated session and saves the connection information to the configuration file which is read by the Gateway provider for OpenShift Dev Spaces. Procedure Create a workspace on the OpenShift Dev Spaces Dashboard and choose IntelliJ IDEA Ultimate (desktop) editor: Wait for the prompt to open your local JetBrains Gateway application to appear: Click the Open Gateway button to start your local JetBrains Client application connected to your Dev Spaces workspace: Connecting JetBrains IntelliJ IDEA Ultimate Edition to an existing workspace There are two options to connect the local IntelliJ IDE to an existing workspace: from the Che Dashboard from the Gateway application The simplest way to connect to an existing workspace is to start a workspace from the OpenShift Dev Spaces Dashboard and click the Open Gateway button. However, with the Gateway application, you can connect the IntelliJ IDE to your workspace without accessing the OpenShift Dev Spaces Dashboard. Procedure Open the Gateway app and click Connect to Dev Spaces : On the page, provide the parameters to connect to the OpenShift API server and click the Check Connection and Continue button: Choose your workspace and click the Connect button: Verification Your local Gateway application is running the JetBrains Client and connects to the workspace. 5.5. Defining a common IDE While the Section 1.1.1.2, "URL parameter for the IDE" enables you to start a workspace with your personal choice of the supported IDE, you might find it more convenient to define the same IDE for all workspaces for the same source code Git repository. To do so, use the che-editor.yaml file. This file supports even a detailed IDE configuration. Tip If you intend to start most or all of your organization's workspaces with the same IDE other than Microsoft Visual Studio Code - Open Source, an alternative is for the administrator of your organization's OpenShift Dev Spaces instance to specify another supported IDE as the default IDE at the OpenShift Dev Spaces instance level. This can be done with .spec.devEnvironments.defaultEditor in the CheCluster Custom Resource. 5.5.1. Setting up che-editor.yaml By using the che-editor.yaml file, you can set a common default IDE for your team and provide new contributors with the most suitable IDE for your project source code. You can also use the che-editor.yaml file when you need to set a different IDE default for a particular source code Git repository rather than the default IDE of your organization's OpenShift Dev Spaces instance. Procedure In the remote Git repository of your project source code, create a /.che/che-editor.yaml file with lines that specify the relevant parameter. Verification Start a new workspace with a clone of the Git repository . Verify that the specified IDE loads in the browser tab of the started workspace. 5.5.2. Parameters for che-editor.yaml The simplest way to select an IDE in the che-editor.yaml is to specify the id of an IDE from the table of supported IDEs: Table 5.2. Supported IDEs IDE Status id Note Microsoft Visual Studio Code - Open Source Available che-incubator/che-code/latest che-incubator/che-code/insiders latest is the default IDE that loads in a new workspace when the URL parameter or che-editor.yaml is not used. insiders is the development version. JetBrains IntelliJ IDEA Community Edition Deprecated che-incubator/che-idea/latest che-incubator/che-idea/ latest is the stable version. is the development version. JetBrains IntelliJ IDEA Ultimate Edition (over JetBrains Gateway) Technology Preview che-incubator/che-idea-server/latest che-incubator/che-idea-server/ latest is the stable version. is the development version. Example 5.1. id selects an IDE from the plugin registry id: che-incubator/che-idea/latest As alternatives to providing the id parameter, the che-editor.yaml file supports a reference to the URL of another che-editor.yaml file or an inline definition for an IDE outside of a plugin registry: Example 5.2. reference points to a remote che-editor.yaml file reference: https:// <hostname_and_path_to_a_remote_file> /che-editor.yaml Example 5.3. inline specifies a complete definition for a customized IDE without a plugin registry inline: schemaVersion: 2.1.0 metadata: name: JetBrains IntelliJ IDEA Community IDE components: - name: intellij container: image: 'quay.io/che-incubator/che-idea:' volumeMounts: - name: projector-user path: /home/projector-user mountSources: true memoryLimit: 2048M memoryRequest: 32Mi cpuLimit: 1500m cpuRequest: 100m endpoints: - name: intellij attributes: type: main cookiesAuthEnabled: true urlRewriteSupported: true discoverable: false path: /?backgroundColor=434343&wss targetPort: 8887 exposure: public secure: false protocol: https attributes: {} - name: projector-user volume: {} For more complex scenarios, the che-editor.yaml file supports the registryUrl and override parameters: Example 5.4. registryUrl points to a custom plugin registry rather than to the default OpenShift Dev Spaces plugin registry id: <editor_id> 1 registryUrl: <url_of_custom_plugin_registry> 1 The id of the IDE in the custom plugin registry. Example 5.5. override of the default value of one or more defined properties of the IDE ... 1 override: containers: - name: che-idea memoryLimit: 1280Mi cpuLimit: 1510m cpuRequest: 102m ... 1 id: , registryUrl: , or reference: .
https://www.open-vsx.org/extension/ <publisher> / <extension> { "recommendations": [ " <publisher_A> . <extension_B> ", " <publisher_C> . <extension_D> ", " <publisher_E> . <extension_F> " ] } id: che-incubator/che-idea/latest reference: https:// <hostname_and_path_to_a_remote_file> /che-editor.yaml inline: schemaVersion: 2.1.0 metadata: name: JetBrains IntelliJ IDEA Community IDE components: - name: intellij container: image: 'quay.io/che-incubator/che-idea:next' volumeMounts: - name: projector-user path: /home/projector-user mountSources: true memoryLimit: 2048M memoryRequest: 32Mi cpuLimit: 1500m cpuRequest: 100m endpoints: - name: intellij attributes: type: main cookiesAuthEnabled: true urlRewriteSupported: true discoverable: false path: /?backgroundColor=434343&wss targetPort: 8887 exposure: public secure: false protocol: https attributes: {} - name: projector-user volume: {} id: <editor_id> 1 registryUrl: <url_of_custom_plugin_registry> ... 1 override: containers: - name: che-idea memoryLimit: 1280Mi cpuLimit: 1510m cpuRequest: 102m