-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
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-sunixwould 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