Skip to content

Fix threading issues with showDocument #2431

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

Merged
merged 2 commits into from
Oct 10, 2024

Conversation

mkondratek
Copy link
Contributor

@mkondratek mkondratek commented Oct 10, 2024

Fixes #2151.

The problem was that the descriptors constructor needs to be called in BGT while ::navigate requires EDT.

Test plan

A good approach to test it is to verify all code paths. There are three:

  1. Context Menu > Generate Unit Tests
  2. Cody Tool Window > Options (...) > Open Cody Settings Editor
  3. In the chat ask Cody to generate a file (e.g. "hello world page in html") > Apply (creating a new file)

@mkondratek mkondratek self-assigned this Oct 10, 2024
val selection = params.options?.selection
val preserveFocus = params.options?.preserveFocus
CodyEditorUtil.showDocument(project, vf, selection, preserveFocus)
true
Copy link
Contributor

Choose a reason for hiding this comment

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

We can delate that true as it is incorrect, showDocument already returns true if it succeeded.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

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

@mkondratek mkondratek enabled auto-merge (squash) October 10, 2024 12:34
@mkondratek mkondratek merged commit 0e8d25b into main Oct 10, 2024
6 of 7 checks passed
@mkondratek mkondratek deleted the mkondratek/fix/showDocument-threading-issues branch October 10, 2024 12:56
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.

bug: java.lang.Throwable: Slow operations are prohibited on EDT. See SlowOperations.assertSlowOperationsAreAllowed javadoc.
2 participants