Adding a VS Code extension to a workspace

This section describes how to add a VS Code extension to a workspace using the workspace configuration.

Prerequisites

Adding a VS Code extension using the workspace configuration

Prerequisites
  • A running instance of Che. To install an instance of Che, see Installing Che.

  • An existing workspace defined on this instance of Che.

  • The VS Code extension is available in the Che plug-in registry, or metadata for the VS Code extension are available. See Publishing metadata for a VS Code extension.

Procedure

To add a VS Code extension using the workspace configuration:

  1. Click the Workspaces tab on the Dashboard and select the plug-in destination workspace.

    The Workspace <workspace-name> window is opened showing the details of the workspace.

  2. Click the devfile tab.

  3. Locate the components section, and add a new entry with the following structure:

     - type: chePlugin
       id:              (1)
    1 ID format: <publisher>/<plug-inName>/<plug-inVersion>

    Che automatically adds the other fields to the new component.

    Alternatively, you can link to a meta.yaml file hosted on GitHub, using the dedicated reference field.

     - type: chePlugin
       reference:              (1)
    1 https://raw.githubusercontent.com/<username>/<registryRepository>/v3/plugins/<publisher>/<plug-inName>/<plug-inVersion>/meta.yaml
  4. Restart the workspace for the changes to take effect.

Adding a VS Code extension using recommendations

Prerequisites
  • A running instance of Che. To install an instance of Che, see Installing Che.

  • Featured VS Code extensions are available in the Che plug-in registry.

Procedure

Open a workspace without any existing devfile using the Che dashboard:

The recommendations plug-in will scan files, discover languages and install VS Code extensions matching these languages. Disable this feature by setting extensions.ignoreRecommendations to true in the devfile attributes.

The recommendations plug-in can suggest VS Code extensions to install when opening files. It suggests extensions based on the workspace content, allowing the user to work with the given files. Enable this feature by setting extensions.openFileRecommendations to true in the devfile attributes.