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

feat: Improve ProtocolClient initialization and GUI loading #4759

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lkk214
Copy link
Contributor

@lkk214 lkk214 commented Mar 21, 2025

Description

  • ContinueBrowser adds LoadHandler before loading the GUI
  • Load the url after protocolClient is initialized

Some messages will be lost if the "Continue" tool window is open during JetBrains IDE startup, as this can cause the GUI to initialize without data.

Affected message types: jetbrains/isOSREnabled, jetbrains/getColors, jetbrains/onLoad, etc.

Currently, it is obvious that you can't right-click and "Open Dev Tools", and the theme color of the GUI is unexpected. These issues occur specifically when the "Continue" tool window is open during JetBrains IDE startup.

- Introduce `onProtocolClientInitialized` to handle client initialization events.
- Use `Delegates.observable` for `ideProtocolClient` to trigger listeners on changes.
- Ensure URL loading is deferred until protocol client is initialized.
@lkk214 lkk214 requested a review from a team as a code owner March 21, 2025 18:54
@lkk214 lkk214 requested review from sestinj and removed request for a team March 21, 2025 18:54
Copy link

netlify bot commented Mar 21, 2025

Deploy Preview for continuedev canceled.

Name Link
🔨 Latest commit 6d47951
🔍 Latest deploy log https://app.netlify.com/sites/continuedev/deploys/67e6d66aebe19c0009626f67

@AfterStories
Copy link

hi @lkk214
I noticed your PR and it seems that it may solve a problem I previously discovered. When using plugins in IntelliJ, it is possible that colors cannot be obtained, and many components in the UI do not have colors rendered.
Screenshots and descriptions can be found here:
https://discord.com/channels/1108621136150929458/1346780535200157716/1352193700888969270

I would like to ask if you think this color rendering issue is related to your PR this time. If it is, I think I should merge your fix code this time

@lkk214
Copy link
Contributor Author

lkk214 commented Mar 30, 2025

@AfterStories I haven’t encountered this specific issue before, but I believe it might be related to this PR. Could you try using it to see if the color rendering issue can be reproduced?

@sestinj
Copy link
Contributor

sestinj commented Apr 1, 2025

@lkk214 I like the changes here! I think this is important enough that we should probably attempt to write a quick e2e test to capture the behavior. I want to make sure that this doesn't cause a loop where the tool window is waiting infinitely, and it's an opportunity to make sure that the colors actually arrive.

I think many different tests could suffice, but one example would be checking that the tool window correctly gets the colors.

@lkk214
Copy link
Contributor Author

lkk214 commented Apr 1, 2025

@sestinj I can add an e2e test for it, but I see that the code for the GUI test is commented. I don't understand why it is commented, maybe the GUI test cannot pass normally.I can add some e2e tests after reusing the GUI tests.

This PR will not cause the tool window to wait indefinitely. It just ensures that the URL is not loaded before the ideProtocolClient is initialized, ensuring that ideProtocolClient?.handleMessage is executed as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants