Skip to content

Add ability to defined any subfolders of a git project as workspace roots. #15347

@sunix

Description

@sunix

Is your enhancement related to a problem? Please describe.

By default, che workspaces have only 1 workspace root: /projects but Theia could accept multiple roots.

Edit: with #17212 each git-repo/project is turned into a workspace root. So what is missing is to have a way to define 1+ subfolders of a git repo as workspace root.

A workspace root is the top folders that the user would see in the explorer. Each folder is a kind of view of a folder in the file system. See https://code.visualstudio.com/docs/editor/multi-root-workspaces (quite same behaviour in VSCode)

Some extensions are relying on workspace roots to work well.
For instance, with the vscode openshift connector extension, having multiple components in a same workspace is requiring that each component source code folder to be a workspace root.

So the user would have to set a workspace root with the command Add folder to workspace for each component. there are some problems:

  • workspace roots defined are lost after restart.
  • user has to set workspace roots manually even if the devfile author knows in advanced which folder would be need to be workspace root

Describe the solution you'd like

Each projects defined in a workspace, would possibly have a list of folder that would be workspace roots of the Che workspace. /projects is the default one.

  - source:
      type: git
      location: 'https://github.com/sunix/che-quarkus-demo'
      branch: microservices
    roots: ['quarkus-backend', 'node-frontend']
    name: che-quarkus-demo

  - source:
      type: git
      location: 'https://github.com/sclorg/nodejs-ex'
    name: nodejs-ex

  - source:
      type: git
      location: 'https://github.com/sunix/nodejs-ex'
    roots: []
    name: nodejs-ex-sunix

would add the 3 folders /projects/nodejs-ex, /projects/che-quarkus-demo/quarkus-backend, /projects/che-quarkus-demo/node-frontend as workspace root.

Of course if the user is using the command Add folder to workspace, the devfile of the workspace would need to be updated.

/projects/nodejs-ex-sunix is not added as a workspace root because of it has roots array empty.
/projects/nodejs-ex is added as a workspace root because it is the default behaviour if no roots element is defined.

Alternative solution

By default, set each repo of the defile as workspace root. But we would still want to support workspace root on a sub folder of a git repo.

Additional context

This is one solution to fix #15273

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/editor/theiaIssues related to the che-theia IDE of Chekind/enhancementA feature request - must adhere to the feature request template.lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.severity/P1Has a major impact to usage or development of the system.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions