Skip to content

Fix meerkat compatibility#20

Merged
abeade merged 6 commits into
masterfrom
fix-meerkat-compatibility
May 1, 2025
Merged

Fix meerkat compatibility#20
abeade merged 6 commits into
masterfrom
fix-meerkat-compatibility

Conversation

@abeade
Copy link
Copy Markdown
Owner

@abeade abeade commented Apr 30, 2025

Fixes error:

java.lang.Throwable: 'psi.Element' is requested on EDT by ImportAction#presentation@ProjectViewPopup 

This error is caused by accessing PSI (Program Structure Interface) elements on the EDT (Event Dispatch Thread), which is not allowed in recent versions of IntelliJ Platform-based IDEs like Android Studio. The platform enforces this to avoid performance and UI freezing issues.

This PR is using ActionUpdateThread.BGT by overriding getActionUpdateThread method in the ImportAction.
Also replaces the usage of the deprecated API DumbService.getInstance(project).runReadActionInSmartMode by using ReadAction.nonBlocking<T> { }.inSmartMode(project) instead.

closes #19

@abeade abeade added the bug Something isn't working label Apr 30, 2025
@abeade abeade self-assigned this Apr 30, 2025
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 30, 2025

Qodana Community for JVM

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked

View the detailed Qodana report

To be able to view the detailed Qodana report, you can either:

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true,
so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/qodana-action@v2024.2.5
        with:
          upload-result: true
Contact Qodana team

Contact us at qodana-support@jetbrains.com

@abeade abeade requested a review from Copilot April 30, 2025 17:23

This comment was marked as resolved.

@abeade abeade requested a review from Copilot April 30, 2025 17:31
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request fixes the compatibility issue by preventing PSI element access on the EDT and ensuring actions run on the background thread. Key changes include:

  • Updating the getMinSdkVersion function to use the nonBlocking ReadAction with a Project parameter.
  • Overriding getActionUpdateThread in ImportAction to return ActionUpdateThread.BGT.
  • Updating the CHANGELOG to document these changes.

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

File Description
src/main/kotlin/com/abeade/plugin/figma/utils/AnActionEventExtensions.kt Updated getMinSdkVersion to use nonBlocking ReadAction and include a Project parameter.
src/main/kotlin/com/abeade/plugin/figma/ImportAction.kt Added getActionUpdateThread override and refactored PSI element handling in update().
CHANGELOG.md Recorded changes for Meerkat compatibility and API usage updates.
Files not reviewed (1)
  • gradle.properties: Language not supported

@abeade abeade merged commit afdf41e into master May 1, 2025
6 checks passed
@abeade abeade deleted the fix-meerkat-compatibility branch May 1, 2025 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Import Option Missing in Meerkat

2 participants