8000
Skip to content

Fix intellij plugin warnings#395

Merged
aoli-al merged 3 commits intomainfrom
docsurl
Mar 8, 2026
Merged

Fix intellij plugin warnings#395
aoli-al merged 3 commits intomainfrom
docsurl

Conversation

@aoli-al
Copy link
Copy Markdown
Member
@aoli-al aoli-al commented Mar 8, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 8, 2026 14:33
Copy link
Copy Markdown
Contributor
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

Updates the IntelliJ IDEA plugin utility code to eliminate API usage warnings by switching to the newer read-action API while resolving PSI files from stack traces.

Changes:

  • Replaced deprecated runReadAction { ... } usage with ReadAction.compute { ... } in PSI lookup logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

val fileIndex = ProjectRootManager.getInstance(project).fileIndex
val psiFile = psiClass.containingFile
if (!fileIndex.isInSourceContent(psiFile.virtualFile)) return@runReadAction null
if (!fileIndex.isInSourceContent(psiFile.virtualFile)) return@compute null
Copy link
Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

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

PsiFile.virtualFile can be null for non-physical/in-memory files; passing it into fileIndex.isInSourceContent(...) can trigger an NPE at runtime. Consider null-checking psiFile.virtualFile (and returning null) before calling isInSourceContent.

Suggested change
if (!fileIndex.isInSourceContent(psiFile.virtualFile)) return@compute null
val virtualFile = psiFile.virtualFile ?: return@compute null
if (!fileIndex.isInSourceContent(virtualFile)) return@compute null

Copilot uses AI. Check for mistakes.
@aoli-al aoli-al enabled auto-merge (squash) March 8, 2026 16:33
@aoli-al aoli-al merged commit 0a8c0e1 into main Mar 8, 2026
4 checks passed
@aoli-al aoli-al deleted the docsurl branch March 8, 2026 16:46
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

0