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

Expand context panel tree on EDT #345

Merged
merged 2 commits into from
Jan 25, 2024
Merged

Expand context panel tree on EDT #345

merged 2 commits into from
Jan 25, 2024

Conversation

steveyegge
Copy link
Contributor

This is a fix for the recent exception I'm seeing in nightly.

I unfortunately was not able to repro with a local build. So I'm not sure how it's getting called from a non-EDT thread -- some sort of race condition, possibly. But this looks like the right fix -- I tried it with/without, and the new context panel expands the tree properly for me in both cases.

Test plan

Manual testing. Passed.


add(toolbarPanel)
// Fix for https://github.com/sourcegraph/jetbrains/issues/344
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that fix is right.
Looks like EnhancedContextPanel is created in ChatPanel constructor and ChatPanel in turn in the CodyToolWindowContent.

CodyToolWindowContent is a IJ project-level service object, and its lifecycle is controlled by IJ.
I found this info in IJ documentation:

Getting a service doesn't need a read action and can be performed from any thread. If a service is requested from several threads, it will be initialised in the first thread, and other threads will be blocked until it is fully initialised.

So you are probably right, it's a race. We need to be on a safe side there.

Copy link
Contributor

@pkukielka pkukielka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

2 participants