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

VS Code loading twice at workspace startup #21400

Closed
Tracked by #21503 ...
l0rd opened this issue May 13, 2022 · 11 comments
Closed
Tracked by #21503 ...

VS Code loading twice at workspace startup #21400

l0rd opened this issue May 13, 2022 · 11 comments
Assignees
Labels
area/devworkspace-operator area/editor/vscode Issues related to the Code OSS editor of Che kind/bug Outline of a bug - must adhere to the bug report 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

@l0rd
Copy link
Contributor

l0rd commented May 13, 2022

Describe the bug

When starting a che-code based workspace the IDE gets loaded a first time and shows an error message (Error loading webview) and after a few seconds gets reloaded:

vs-code-loading-twice.mov

Che version

next (development version)

Steps to reproduce

Click here (access to Che dogfooding instance is required).

Expected behavior

VS Code is loaded once.

Runtime

OpenShift

Screenshots

No response

Installation method

OperatorHub

Release Notes Text

An extension was used to open the project folder at VS Code startup. The result was VS Code beeing loaded twice in the user browser. This is not necessary anymore as we use the VS Code startup parameter --default-folder that has been (re-)introduced recently.

@l0rd l0rd added kind/bug Outline of a bug - must adhere to the bug report template. area/editor/vscode Issues related to the Code OSS editor of Che severity/P1 Has a major impact to usage or development of the system. labels May 13, 2022
@azatsarynnyy azatsarynnyy self-assigned this Jun 23, 2022
@azatsarynnyy azatsarynnyy added this to the 7.51 milestone Jun 23, 2022
@azatsarynnyy azatsarynnyy mentioned this issue Jun 27, 2022
68 tasks
@azatsarynnyy azatsarynnyy removed this from the 7.51 milestone Jul 19, 2022
@azatsarynnyy
Copy link
Member

The work on this issue has been postponed. At least, until we fix #21537

@l0rd
Copy link
Contributor Author

l0rd commented Sep 21, 2022

We should try replacing ?tkn=eclipse-che with ?folder=${PROJECT_SOURCE}.

@azatsarynnyy
Copy link
Member

We should try replacing ?tkn=eclipse-che with ?folder=${PROJECT_SOURCE}.

@l0rd it's a good idea. But it works OOTB for ?folder=/projects only. As VS Code doesn't resolve the environment variables passed through the URL query parameters.

Hardcoding ?folder=/projects looks like the following, in Project Explorer:
image

That's why we have che-on-start extension that detects the right path VS Code should navigate to, depending on a few conditions.

As I see it, one of the options for fixing that problem would be to move that logic from the extension to the entry point script. In that case we could provide the correct path to the server side instead of redirecting the client.

@l0rd
Copy link
Contributor Author

l0rd commented Sep 21, 2022

${PROJECT_SOURCE} should be resolved by the DevWorkspace operator

@l0rd
Copy link
Contributor Author

l0rd commented Sep 22, 2022

So the proposal is to resolve ${PROJECT_SOURCE} when setting a DevWorkspace status.mainUrl.

For example, an endpoint with a path that references $PROJECT_SOURCE and with the attribute type: main:

        endpoints:
          - name: che-code
            attributes:
              type: main
              cookiesAuthEnabled: true
              discoverable: false
              urlRewriteSupported: true
            targetPort: 3100
            exposure: public
            path: '?folder=${PROJECT_SOURCE}'
            secure: false
            protocol: https

should result in a DevWorkspace status where the $PROJECT_SOURCE has been resolved:

"status": {
    (...)
    "mainUrl": "https://workspace1bc9e32c0fcd4aed.apps.mloriedo-devworkspaces.devcluster.openshift.com/che-code/?folder=/projects/my-project",
    "message": "https://workspace1bc9e32c0fcd4aed.apps.mloriedo-devworkspaces.devcluster.openshift.com/che-code/?folder=/projects/my-project",
    "phase": "Running"
  }

I am adding the label area/devworkspace-operator.

@azatsarynnyy
Copy link
Member

That sounds great! As most of the workspaces are single-root projects, it should fix the problem for the vast majority of cases.

@azatsarynnyy
Copy link
Member

I've found out how we can do the same in VS Code entrypoint.
We can pass ${PROJECT_SOURCE} when we start VS Code Server
https://github.com/che-incubator/che-code/blob/3072353809a0e30369eb7bddd566a35fdb3c94bd/code/src/vs/server/node/serverEnvironmentService.ts#L46

@azatsarynnyy azatsarynnyy mentioned this issue Oct 9, 2022
67 tasks
@azatsarynnyy azatsarynnyy changed the title Che code loading twice at workspace startup Che-Code loading twice at workspace startup Oct 9, 2022
@l0rd
Copy link
Contributor Author

l0rd commented Oct 9, 2022

I've found out how we can do the same in VS Code entrypoint.

We can pass ${PROJECT_SOURCE} when we start VS Code Server

https://github.com/che-incubator/che-code/blob/3072353809a0e30369eb7bddd566a35fdb3c94bd/code/src/vs/server/node/serverEnvironmentService.ts#L46

👍great! Let's do that then

@azatsarynnyy
Copy link
Member

Fixed by che-incubator/che-code#131.
VS Code is loaded x2 faster now.

@l0rd l0rd changed the title Che-Code loading twice at workspace startup VS Code loading twice at workspace startup Oct 27, 2022
@l0rd l0rd added new&noteworthy For new and/or noteworthy issues that deserve a blog post, new docs, or emphasis in release notes status/release-notes-review-needed Issues that needs to be reviewed by the doc team for the Release Notes wording labels Oct 27, 2022
@max-cx max-cx removed the status/release-notes-review-needed Issues that needs to be reviewed by the doc team for the Release Notes wording label Jan 12, 2023
@max-cx
Copy link

max-cx commented Jan 12, 2023

This issue was not manually cloned into Jira for release notes because VS Code was a Technology Preview feature up until Che 7.56 / DS 3.4, and we don't document known issues or bug fixes for Technology Preview features in DS release notes.

@devstudio-release
Copy link

sync'd to Red Hat JIRA https://issues.redhat.com/browse/CRW-3852

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devworkspace-operator area/editor/vscode Issues related to the Code OSS editor of Che kind/bug Outline of a bug - must adhere to the bug report 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

4 participants