Skip to content

ADFA-2435 | Enable per-plugin tooltips on bottom-sheet tabs#1297

Open
fryanpan wants to merge 2 commits into
stagefrom
feature/ADFA-2435-tab-tooltip-tag
Open

ADFA-2435 | Enable per-plugin tooltips on bottom-sheet tabs#1297
fryanpan wants to merge 2 commits into
stagefrom
feature/ADFA-2435-tab-tooltip-tag

Conversation

@fryanpan
Copy link
Copy Markdown

@fryanpan fryanpan commented May 12, 2026

Adds TabItem.tooltipTag so plugin bottom-sheet tabs surface their own
help 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); the
long-press handler routes through the plugin's tooltip category.

Paired with the random-xkcd plugin in plugin-examples that wires
itself 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:

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

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>
fryanpan added a commit to appdevforall/plugin-examples that referenced this pull request May 12, 2026
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>
fryanpan added a commit to appdevforall/plugin-examples that referenced this pull request May 12, 2026
- 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>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds plugin-aware tooltip categorization for editor bottom sheet tabs. A new tooltipTag field on TabItem lets plugins declare custom tooltip tags. The adapter now tracks which plugin owns each contributed tab and provides a getTooltipCategory method that returns either the IDE or plugin-specific tooltip category. The bottom sheet integrates this by passing the category to the tooltip manager on tab long-press.

Changes

Plugin Tooltip Categorization for Editor Tabs

Layer / File(s) Summary
Plugin tooltip tag contract
plugin-api/src/main/kotlin/com/itsaky/androidide/plugins/extensions/UIExtension.kt
TabItem declares an optional tooltipTag property with documentation describing tooltip tag resolution order and plugin-based fallback behavior.
Adapter tooltip category infrastructure
app/src/main/java/com/itsaky/androidide/adapters/EditorBottomSheetTabAdapter.kt
Imports add plugin-aware tooltip helpers. A new map stores the origin pluginId for each contributed tab. The getTooltipCategory method returns IDE or plugin-specific categories. Plugin tab registration populates the map and resolves tooltip tags using the plugin id when not explicitly provided.
Bottom sheet tooltip integration
app/src/main/java/com/itsaky/androidide/ui/EditorBottomSheet.kt
Tab long-press handler calls TooltipManager.showTooltip with the tooltip category from the adapter, replacing the prior showIdeCategoryTooltip call.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • appdevforall/CodeOnTheGo#1017: Introduces TooltipTag.PROJECT_PLUGIN_TAB for plugin-contributed tab tooltips; this PR extends that by generalizing to plugin-aware tooltip categories via TabItem.tooltipTag and getTooltipCategory.
  • appdevforall/CodeOnTheGo#1224: Adds tooltipTag = TooltipTag.PROJECT_GIT for the Git tab; this PR generalizes the approach to support per-tab tooltip categories and plugin-scoped resolution.
  • appdevforall/CodeOnTheGo#1268: Extends plugin tooltip categorization to MenuItem and NavigationItem; this PR applies the same pattern to TabItem and editor bottom sheet tooltips.

Suggested reviewers

  • itsaky-adfa
  • Daniel-ADFA
  • jomen-adfa

Poem

🐰 Whiskers twitching with plugin delight,
Tabs now whisper their tooltip bright,
Adapters map each borrowed name,
Categories flow—plugin and same,
Tooltips dance where bottom sheets dwell! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: enabling per-plugin tooltips on bottom-sheet tabs, which is the primary purpose of the changeset.
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.
Description check ✅ Passed The pull request description accurately describes the changeset, detailing the addition of TabItem.tooltipTag to enable per-plugin tooltips on bottom-sheet tabs, the implementation across three files, and the context within the broader plugin-UI tooltip pattern.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/ADFA-2435-tab-tooltip-tag

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.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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

🧹 Nitpick comments (1)
app/src/main/java/com/itsaky/androidide/adapters/EditorBottomSheetTabAdapter.kt (1)

149-156: ⚡ Quick win

Clear pluginIdsByTabItemId for consistency.

The clearAll() method clears pluginFragmentFactories and pluginExtensions but not pluginIdsByTabItemId. 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

📥 Commits

Reviewing files that changed from the base of the PR and between c9205d3 and 8e51271.

📒 Files selected for processing (3)
  • app/src/main/java/com/itsaky/androidide/adapters/EditorBottomSheetTabAdapter.kt
  • app/src/main/java/com/itsaky/androidide/ui/EditorBottomSheet.kt
  • plugin-api/src/main/kotlin/com/itsaky/androidide/plugins/extensions/UIExtension.kt

Comment thread app/src/main/java/com/itsaky/androidide/adapters/EditorBottomSheetTabAdapter.kt Outdated
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>
@fryanpan
Copy link
Copy Markdown
Author

Addressed in 9279d3c:

  1. getTooltipTag + getTooltipCategory now index tabs (visible list) instead of allTabs (master list) — fixes CodeRabbit's two critical findings about ViewPager position divergence after removeFragment / restoreFragment. Pre-existing bug in getTooltipTag carried in from earlier; fixed it here since the new getTooltipCategory was duplicating the pattern.
  2. clearAll() now clears pluginIdsByTabItemId alongside the other per-plugin maps.
  3. TabItem.tooltipTag KDoc updated to document the placeholder fallback when the plugin id can't be resolved at registration time.

Skipping @JvmOverloads on the new tooltipTag parameter — mirrors how the same field landed on MenuItem / NavigationItem in #1268 without it. Happy to add if Daniel prefers the binary-compat shim.

🤖 Generated with Claude Code

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