Skip to content

Fix compose preview button bug on non compose classes#1236

Merged
Daniel-ADFA merged 3 commits into
stagefrom
ADFA-3202
Apr 23, 2026
Merged

Fix compose preview button bug on non compose classes#1236
Daniel-ADFA merged 3 commits into
stagefrom
ADFA-3202

Conversation

@Daniel-ADFA
Copy link
Copy Markdown
Contributor

No description provided.

@Daniel-ADFA Daniel-ADFA requested a review from a team April 23, 2026 15:42
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 23, 2026

Warning

Rate limit exceeded

@Daniel-ADFA has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 9 minutes and 19 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 9 minutes and 19 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8f0ad9f4-0b95-48dd-8d01-e61f30f6dbd0

📥 Commits

Reviewing files that changed from the base of the PR and between 86eebf1 and 0398ba4.

📒 Files selected for processing (1)
  • app/src/main/java/com/itsaky/androidide/actions/etc/PreviewLayoutAction.kt
📝 Walkthrough

Walkthrough

The PR modifies the Compose preview action's preparation logic to perform content-aware detection. Instead of workspace-wide Compose dependency checks, it now requires both the module's Compose dependency and the presence of at least one @Preview-annotated function within the current editor buffer.

Changes

Cohort / File(s) Summary
Compose Preview Detection Logic
app/src/main/java/com/itsaky/androidide/actions/etc/PreviewLayoutAction.kt
Modified action preparation to require content-aware Compose detection by combining module-level Compose dependency checks with regex-based scanning for @Preview annotations in the current file's editor text.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • itsaky-adfa
  • dara-abijo-adfa

Poem

🐰 A preview needs content, you see,
Not just a dependency tree!
With @Preview now in view,
The compose action knows what to do!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to assess relevance to the changeset. Add a description explaining the bug being fixed, the root cause, and how the regex-based @Preview detection solves the issue.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly describes the main fix: preventing the compose preview button from appearing on non-compose classes, which matches the change to make visibility content-aware by checking for @Preview annotations.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ADFA-3202

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/src/main/java/com/itsaky/androidide/actions/etc/PreviewLayoutAction.kt`:
- Around line 66-69: The current COMPOSABLE_PREVIEW_PATTERN fails to match
annotated preview functions that include Kotlin modifiers (e.g., "private",
"internal", "protected", "public") between annotations and the "fun" keyword;
update COMPOSABLE_PREVIEW_PATTERN to permit optional modifier tokens before
"fun" (for example allow zero or more word tokens like visibility and common
modifiers such as private|internal|protected|public|open|override|suspend etc.
followed by whitespace) so patterns like "@Preview `@Composable` private fun
FooPreview()" are matched; adjust the Regex used by moduleUsesCompose(file:
File, editorContent: String) to use the revised COMPOSABLE_PREVIEW_PATTERN
(keeping existing RegexOption flags) so preview detection works for functions
with modifiers.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 67b4833a-d7ab-44fe-bee0-e3637b351823

📥 Commits

Reviewing files that changed from the base of the PR and between 3354b0c and 86eebf1.

📒 Files selected for processing (1)
  • app/src/main/java/com/itsaky/androidide/actions/etc/PreviewLayoutAction.kt

@Daniel-ADFA Daniel-ADFA merged commit db0fcb5 into stage Apr 23, 2026
2 checks passed
@Daniel-ADFA Daniel-ADFA deleted the ADFA-3202 branch April 23, 2026 16:51
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