Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-root Che Theia Workspaces #17212

Closed
1 task done
azatsarynnyy opened this issue Jun 23, 2020 · 10 comments
Closed
1 task done

Multi-root Che Theia Workspaces #17212

azatsarynnyy opened this issue Jun 23, 2020 · 10 comments
Assignees
Labels
area/editor/theia Issues related to the che-theia IDE of Che kind/enhancement A feature request - must adhere to the feature request template. new&noteworthy For new and/or noteworthy issues that deserve a blog post, new docs, or emphasis in release notes severity/P1 Has a major impact to usage or development of the system.
Milestone

Comments

@azatsarynnyy
Copy link
Member

azatsarynnyy commented Jun 23, 2020

Is your enhancement related to a problem? Please describe.

A lot of VS Code extensions require multi-root layout to work properly.
To set up a multi-root Che Theia Workspace, one needs to do several repetitive steps on each start of Che Workspace.

Describe the solution you'd like

Che Theia should automatically switch the layout of the users' projects to a multi-root Che Theia Workspace.

Since not all of VS Code extensions are supporting multi-root mode yet,
Che Theia should provide a command to quickly switch between multi/single root modes.

Switching to a multi-root mode should happen as earlier as possible, e.g.:
1/ clone the projects
2/ convert each project to a Workspace root
3/ LS initialization, import Commands as Tasks, etc.

As multi-root mode affects several areas (LS, Tasks, etc.),
it's not expected to get a completely working solution as a result of this issue.
It may be PoC of the described idea, at least. Then, we'll see if some areas require more adaptation.

Additional context

https://code.visualstudio.com/docs/editor/multi-root-workspaces

Sub-tasks

@azatsarynnyy azatsarynnyy added kind/enhancement A feature request - must adhere to the feature request template. severity/P1 Has a major impact to usage or development of the system. area/editor/theia Issues related to the che-theia IDE of Che labels Jun 23, 2020
@azatsarynnyy azatsarynnyy added this to the 7.16 milestone Jun 23, 2020
@sunix
Copy link
Contributor

sunix commented Jun 23, 2020

@azatsarynnyy isn't it a duplicate of #15347?

@azatsarynnyy
Copy link
Member Author

@azatsarynnyy isn't it a duplicate of #15347?

it isn't, as #15347 is about persisting in devfile, and this one is about automatic switch the layout

@sunix
Copy link
Contributor

sunix commented Jun 24, 2020

ok I have just referenced this one as the second item of #15529

@azatsarynnyy azatsarynnyy mentioned this issue Jun 25, 2020
20 tasks
@tsmaeder
Copy link
Contributor

Some stuff will be broken if we move to multi-root: #17191

@tsmaeder
Copy link
Contributor

There is also already an open PR from @JPinkney introducing workspace-root per project here: eclipse-che/che-theia#408

@azatsarynnyy
Copy link
Member Author

Thanks, Thomas! We'll take a look at it as well.

@l0rd l0rd added the new&noteworthy For new and/or noteworthy issues that deserve a blog post, new docs, or emphasis in release notes label Jul 1, 2020
@azatsarynnyy azatsarynnyy self-assigned this Jul 7, 2020
@azatsarynnyy azatsarynnyy modified the milestones: 7.16, 7.18 Jul 14, 2020
@azatsarynnyy azatsarynnyy modified the milestones: 7.18, 7.19 Aug 20, 2020
@azatsarynnyy azatsarynnyy mentioned this issue Aug 26, 2020
13 tasks
@azatsarynnyy azatsarynnyy modified the milestones: 7.19, 7.20 Sep 15, 2020
@azatsarynnyy azatsarynnyy mentioned this issue Sep 17, 2020
18 tasks
@azatsarynnyy azatsarynnyy modified the milestones: 7.20, 7.21 Oct 7, 2020
@RomanNikitenko RomanNikitenko added the status/in-progress This issue has been taken by an engineer and is under active development. label Oct 7, 2020
@azatsarynnyy azatsarynnyy mentioned this issue Oct 8, 2020
15 tasks
@RomanNikitenko RomanNikitenko removed the status/in-progress This issue has been taken by an engineer and is under active development. label Oct 21, 2020
@azatsarynnyy azatsarynnyy mentioned this issue Nov 18, 2020
15 tasks
@azatsarynnyy azatsarynnyy modified the milestones: 7.22, 7.23 Nov 18, 2020
@RomanNikitenko RomanNikitenko removed the status/in-progress This issue has been taken by an engineer and is under active development. label Dec 1, 2020
@azatsarynnyy azatsarynnyy modified the milestones: 7.23, 7.24 Dec 2, 2020
@nickboldt nickboldt modified the milestones: 7.24, 7.25 Jan 8, 2021
@azatsarynnyy azatsarynnyy modified the milestones: 7.25, 7.26 Jan 14, 2021
@azatsarynnyy azatsarynnyy added the status/in-progress This issue has been taken by an engineer and is under active development. label Jan 14, 2021
@azatsarynnyy azatsarynnyy mentioned this issue Jan 20, 2021
16 tasks
@azatsarynnyy azatsarynnyy modified the milestones: 7.26, 7.27 Feb 9, 2021
@azatsarynnyy azatsarynnyy mentioned this issue Feb 11, 2021
10 tasks
@azatsarynnyy azatsarynnyy changed the title Multi-root Che Theia Workspaces, by default Multi-root Che Theia Workspaces Feb 12, 2021
@azatsarynnyy
Copy link
Member Author

I've renamed the issue to "Multi-root Che Theia Workspaces , by default"
in order to reflect our plan to make a multi-root mode optional at the first iteration.
Once we decide it's stable enough, we will enable it by default for all workspaces.

@RomanNikitenko RomanNikitenko added status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. and removed status/in-progress This issue has been taken by an engineer and is under active development. labels Feb 12, 2021
@RomanNikitenko
Copy link
Member

RomanNikitenko commented Feb 13, 2021

There are couple questions about preferences for the multi-root mode, so I would like to discuss the topic here.

It's expected for theia that some preferences are stored in the workspaceFolder/.theia/settings.json.
So setting preference to ${CHE_PROJECTS_ROOT}/.theia/settings.json for master branch works well because ${CHE_PROJECTS_ROOT} is a workspace folder by default.

For a multi-root workspace it's expected that preferences are stored in workspace config file, like che.theia-workspace.
So, for the case like this the preference is stored to workspace config file /projects/che.theia-workspace and it is available under the Workspace scope of settings, please see eclipse-che/che-theia#778 (comment)

For the case, like this one a multi-root workspace knows nothing about the preference, as ${CHE_PROJECTS_ROOT} is NOT a workspace folder, so the preference is ignored.

I could provided some logic for the multi-root mode and export preferences from ${CHE_PROJECTS_ROOT}/.theia/settings.json to /projects/che.theia-workspace, but for me it makes sense only if it's expected that a user wants to turn on and turn off the multi-root mode for the same workspace.
For this case we have to handle both exports:

  • ${CHE_PROJECTS_ROOT}/.theia/settings.json ===> /projects/che.theia-workspace
  • /projects/che.theia-workspace ===> ${CHE_PROJECTS_ROOT}/.theia/settings.json

Also we should think about conflicts or just overwrite preferences at switching the multi-root mode - if preferences are not equal.

Note: As I mentioned above - I don't see any problems and we don't need provide any logic to export preferences for the case like this - it's handled automatically for both modes: multi-root is ON and OFF.

To be honest I'm not sure that it's usual use case for che and expected behavior - if a user creates Go or Java maven multi-root workspace - does the user want to turn off the multi-root mode after a workspace creation?
But sure we can handle such case if it's required. Maybe I missed other use cases related to ${CHE_PROJECTS_ROOT}/.theia/settings.json ===> /projects/che.theia-workspace

@benoitf @azatsarynnyy @ericwill @tsmaeder
please share your opinion
Thanks in advance!

@tsmaeder
Copy link
Contributor

tl:dr:

  1. There will be only multi-root workspaces in the future. Don't worry about migration
  2. Preference values should be merged the same way as tasks
  3. We need to implement the proper workaround I sketched in Allow to define VS Code extensions preferences in Che plugin registry #17975 (comment)

A couple of high-level thoughts here:

First off: I don't think "single-root" mode should exist after a period of transition: they will all be multi-root workspaces, even if they only contain a single project. From a UI point of view, it should not make a difference to the user. Therefore, we should not concern ourselves with single-root when we think about long-term solutions. If we want to prevent losing user settings in existing workspaces, we should write some one-time migration code and keep it separate from the mainline code. But IMO, I don't think we should bother. "Single" vs. "multi-root" is a technical distinction of no value the the Che user.

Second: merging the preference values will have the exact same problems we have with che-command and tasks: it will be impossible to tell how to merge conflicts automatically: whatever we do, the merge policy should be the same as with other artifacts we propagate from the devfile to Theia.

Third: the issue @sunix brings up is because of our workaround for not getting a fix for #17975. Our team cannot properly fix that issue because we do not own the meta.yml format. Even though some might not like the terminology, I consider our current workaround a hack, because the mechanism for translating meta.yaml info into Theia settings should be in a single location, not recreated in each plugin meta.yml. Solving the problem in individual sidecar entrypoints creates unnecessary and implicit coupling in our code and leads to breakage (as we're seeing now) when we make changes.

@azatsarynnyy
Copy link
Member Author

Thanks Roman for raising your concerns.

It's expected for theia that some preferences are stored in the workspaceFolder/.theia/settings.json.
So setting preference to ${CHE_PROJECTS_ROOT}/.theia/settings.json for master branch works well because ${CHE_PROJECTS_ROOT} is a workspace folder by default.

Che-Theia handles settings.json in any workspace folder, so everything works here the same as in VS Code. We don't care what folder the user has opened as a workspace folder.

For a multi-root workspace it's expected that preferences are stored in workspace config file, like che.theia-workspace.
So, for the case like this the preference is stored to workspace config file /projects/che.theia-workspace and it is available under the Workspace scope of settings, please see eclipse/che-theia#778 (comment)

It works as it should. Any preferences come from a Devfile go to Workspace level. If we need to change that behavior in future then we'll reconsider it.

For the case, like this one a multi-root workspace knows nothing about the preference, as ${CHE_PROJECTS_ROOT} is NOT a workspace folder, so the preference is ignored.

It's some hack. We shouldn't handle it in the context of multi-root work.

I could provided some logic for the multi-root mode and export preferences from ${CHE_PROJECTS_ROOT}/.theia/settings.json to /projects/che.theia-workspace, but for me it makes sense only if it's expected that a user wants to turn on and turn off the multi-root mode for the same workspace.
For this case we have to handle both exports:

  • ${CHE_PROJECTS_ROOT}/.theia/settings.json ===> /projects/che.theia-workspace
  • /projects/che.theia-workspace ===> ${CHE_PROJECTS_ROOT}/.theia/settings.json

Also we should think about conflicts or just overwrite preferences at switching the multi-root mode - if preferences are not equal.

Absolutely, no need to handle such cases. Switching the multi-/single-root mode is a temporary stage.

Note: As I mentioned above - I don't see any problems and we don't need provide any logic to export preferences for the case like this - it's handled automatically for both modes: multi-root is ON and OFF.

To be honest I'm not sure that it's usual use case for che and expected behavior - if a user creates Go or Java maven multi-root workspace - does the user want to turn off the multi-root mode after a workspace creation?

That's not expected use-case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/editor/theia Issues related to the che-theia IDE of Che kind/enhancement A feature request - must adhere to the feature request template. new&noteworthy For new and/or noteworthy issues that deserve a blog post, new docs, or emphasis in release notes severity/P1 Has a major impact to usage or development of the system.
Projects
None yet
Development

No branches or pull requests

6 participants