ADFA-2435 | Enable per-plugin tooltips on bottom-sheet tabs#1297
ADFA-2435 | Enable per-plugin tooltips on bottom-sheet tabs#1297fryanpan wants to merge 2 commits into
Conversation
Previously, long-pressing any plugin's bottom-sheet tab surfaced the generic "Interact with this plugin" placeholder, because the adapter hardcoded `tooltipTag = TooltipTag.PROJECT_PLUGIN_TAB` for every plugin tab and the long-press handler queried CATEGORY_IDE. Three changes: - plugin-api: TabItem gains `tooltipTag: String? = null` (mirrors NavigationItem / MenuItem). Plugins set it to point at one of their PluginTooltipEntry tags. - EditorBottomSheetTabAdapter: plugin tabs derive tag from `tabItem.tooltipTag ?: pluginTooltipTag(pluginId, tabId)`, and the new getTooltipCategory(position) returns pluginCategory(pluginId) for plugin tabs. - EditorBottomSheet long-press: routes through TooltipManager.showTooltip with the resolved (category, tag) instead of showIdeCategoryTooltip. Paired with the random-xkcd plugin example in plugin-examples that sets `tooltipTag = "xkcd.tab"` and ships matching tooltip entries. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pulls in TabItem.tooltipTag from the paired CoGo PR (appdevforall/CodeOnTheGo#1297) so random-xkcd can wire its bottom-sheet tab to its own tooltip entry. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Set `tooltipTag = TOOLTIP_TAG_TAB` on the bottom-sheet TabItem.
Long-pressing the XKCD tab now surfaces the plugin's own Tier-1
tooltip ("Random xkcd comic. Tap to roll a new one.") instead of
the generic platform placeholder. Requires the paired CoGo PR
(appdevforall/CodeOnTheGo#1297).
- Tutorial (assets/docs/index.html):
- Section 3 (bottom-sheet tab UI): include `tooltipTag` in the
TabItem code example + one paragraph explaining the wire to
Step 7's DocumentationExtension.
- Section 7 (tooltip): back-reference noting that `tag` here is
the same string as `TabItem.tooltipTag`.
- Tightening pass: -16% words (2482 → 2087). Cuts: end-to-end
recap section (duplicate of intro callout), sandbox-model
section collapsed to a 3-bullet summary, xkcd license section
halved, redundant phrasing across step intros, dropped the
standalone "6c. User feedback" subsection.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe PR adds plugin-aware tooltip categorization for editor bottom sheet tabs. A new ChangesPlugin Tooltip Categorization for Editor Tabs
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
app/src/main/java/com/itsaky/androidide/adapters/EditorBottomSheetTabAdapter.kt (1)
149-156: ⚡ Quick winClear
pluginIdsByTabItemIdfor consistency.The
clearAll()method clearspluginFragmentFactoriesandpluginExtensionsbut notpluginIdsByTabItemId. For consistency and to avoid retaining stale mappings, clear it as well.♻️ Proposed fix
fun clearAll() { val size = tabs.size if (size == 0) return tabs.clear() pluginFragmentFactories.clear() pluginExtensions.clear() + pluginIdsByTabItemId.clear() notifyDataSetChanged() }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/src/main/java/com/itsaky/androidide/adapters/EditorBottomSheetTabAdapter.kt` around lines 149 - 156, The clearAll() method currently clears tabs, pluginFragmentFactories, and pluginExtensions but leaves pluginIdsByTabItemId populated; update the clearAll() implementation in EditorBottomSheetTabAdapter.kt (function clearAll) to also call pluginIdsByTabItemId.clear() so the mapping is not retained and state is fully reset.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@app/src/main/java/com/itsaky/androidide/adapters/EditorBottomSheetTabAdapter.kt`:
- Around line 347-358: getTooltipCategory currently indexes allTabs with the
ViewPager-provided position, causing the same index mismatch as getTooltipTag;
change it to use the tabs list used by the ViewPager (use tabs[position].itemId)
and then look up pluginIdsByTabItemId for that itemId, falling back to
TooltipCategory.CATEGORY_IDE via pluginCategory(pluginId) as before (update
getTooltipCategory to mirror the indexing fix applied in getTooltipTag,
referencing allTabs, tabs, getTooltipCategory, pluginIdsByTabItemId,
pluginCategory, TooltipCategory.CATEGORY_IDE).
- Line 345: getTooltipTag currently indexes into allTabs using the ViewPager
position, causing index mismatches when fragments are hidden/restored; change
getTooltipTag to use the visible tabs list (tabs) the ViewPager is bound to
(like getTitle does) and safely handle out-of-bounds by returning null if
position is invalid; update references in getTooltipTag so it reads from
tabs[position] and not allTabs, and ensure behavior remains consistent with
removeFragment/restoreFragment.
---
Nitpick comments:
In
`@app/src/main/java/com/itsaky/androidide/adapters/EditorBottomSheetTabAdapter.kt`:
- Around line 149-156: The clearAll() method currently clears tabs,
pluginFragmentFactories, and pluginExtensions but leaves pluginIdsByTabItemId
populated; update the clearAll() implementation in
EditorBottomSheetTabAdapter.kt (function clearAll) to also call
pluginIdsByTabItemId.clear() so the mapping is not retained and state is fully
reset.
🪄 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: 85c69747-e138-4a56-92d0-465b6a24c30a
📒 Files selected for processing (3)
app/src/main/java/com/itsaky/androidide/adapters/EditorBottomSheetTabAdapter.ktapp/src/main/java/com/itsaky/androidide/ui/EditorBottomSheet.ktplugin-api/src/main/kotlin/com/itsaky/androidide/plugins/extensions/UIExtension.kt
Three fixes from CodeRabbit + my own review of PR #1297: - getTooltipTag / getTooltipCategory: index `tabs` (the visible list, what the ViewPager iterates) instead of `allTabs` (the full master list). removeFragment / restoreFragment can diverge the two, and the long-press handler in EditorBottomSheet passes the ViewPager position. Fixes a pre-existing bug in getTooltipTag the new getTooltipCategory was about to duplicate. - clearAll(): also clear pluginIdsByTabItemId so it stays in lock- step with the other per-plugin maps. - TabItem.tooltipTag KDoc: document the fallback to a generic placeholder when the plugin id can't be resolved at registration time (otherwise the contract reads as if `<pluginId>.<id>` is always composed). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Addressed in 9279d3c:
Skipping 🤖 Generated with Claude Code |
Adds
TabItem.tooltipTagso plugin bottom-sheet tabs surface their ownhelp entry on long-press, instead of the generic "Interact with this
plugin" placeholder every plugin currently shares.
Three files: plugin-api adds the field; the bottom-sheet adapter
consumes it (with
${pluginId}.${tabId}convention fallback); thelong-press handler routes through the plugin's tooltip category.
Paired with the
random-xkcdplugin in plugin-examples that wiresitself up via this new field: appdevforall/plugin-examples#6 — see
that PR for the demo + recording.
Context
Fills the third plugin-UI surface using the pattern #1268 already
established for the other two:
TooltipTag.PROJECT_PLUGIN_TABfor every plugin tab. No per-plugintooltips at this stage.
MenuItem) andsidebar (
NavigationItem) items — addedtooltipTag: String?to those data classes, introduced the
pluginCategory()/pluginTooltipTag()helpers, migrated those two surfaces fromshowIdeCategoryTooltiptoshowTooltip(category, tag). Itexplicitly skipped
TabItemandEditorBottomSheet.Add plugin sidebar/toolbar tooltips and directPath URI option #1268's helpers and matching the data-class shape it picked.
Ticket: ADFA-2435 (used as the branch identifier; this is a platform
fix that benefits every plugin with a bottom-sheet tab).
🤖 Generated with Claude Code