Conversation
Add new `onContextMenuOpenAsync` suspend callback parameter that waits for completion before displaying the context menu. This enables use cases like refreshing dynamic menu items (e.g., AI assistant detection) before the menu is shown. Changes: - ProperTerminal.kt: Refactor right-click handler to support async callback - TabbedTerminal.kt: Add parameter threading - EmbeddableTerminal.kt: Add parameter threading - SplitContainer.kt: Thread parameter through all composable functions - docs/wiki/API-Reference.md: Update API documentation - docs/release-notes/v1.0.73.md: Add release notes Closes #220 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- embedded-example: Use onContextMenuOpenAsync with simulated delay - tabbed-example: Use onContextMenuOpenAsync with simulated delay - Add comments explaining sync vs async callback usage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code Review: PR #222 - Async Context Menu CallbackOverviewThis PR adds a new ✅ Strengths
🔍 Potential Issues & Suggestions1. Race Condition with Hover State (Minor)Location: While you correctly capture
Current behavior seems correct - the menu should be based on what was hovered when clicked, not what's hovered after async work. 2. Error Handling Missing (Moderate)Location: Problem: If Suggested Fix: This ensures the menu always appears, even if the async operation fails. 3. No Timeout Protection (Low Priority)If Note: This is low priority since apps should handle their own timeouts, but it provides a safety net for user experience. 4. Documentation: Behavior When Both Callbacks Provided (Minor)Location: Release notes and KDoc The release notes state: "If onContextMenuOpenAsync is provided, it takes precedence over onContextMenuOpen" Looking at the code, only ONE callback is invoked, not both - they are mutually exclusive. Suggestion: Clarify in KDoc that if both are provided, only the async one is called. Add a note like: "NOTE: If provided, onContextMenuOpen is ignored." 🧪 Testing RecommendationsThe PR description mentions test plan items but they are unchecked. Consider testing:
🔒 Security ConsiderationsNo security concerns identified. The callback is user-provided and runs in the same coroutine scope as the UI. 📊 Performance Considerations
✨ Code Quality
📝 SummaryRecommendation: ✅ Approve with minor fixes Required before merge:
Nice to have: Can merge as-is:
Great work on this feature! The use case (dynamic AI assistant detection) is compelling, and the implementation is solid. Once error handling is added, this will be a valuable addition to the API. Closes #220 |
PR Review: Async Context Menu CallbackThis PR adds support for async callbacks before context menu display. Overall, this is a solid implementation with good documentation. Strengths
Potential IssuesCoroutine Scope Lifecycle (ProperTerminal.kt:926-929)
UX Concern: No Visual Feedback
Test CoverageMissing unit tests for:
Suggestions for Follow-up
Final Verdict✅ Approve with minor recommendations The code quality is good, backward compatibility is maintained, and documentation is comprehensive. The concerns above are medium/low priority and can be addressed in follow-up PRs. Current implementation is production-ready for callbacks under 200ms. Great work! Review conducted following BossTerm development guidelines from CLAUDE.md |
Summary
onContextMenuOpenAsyncsuspend callback parameter that waits for completion before displaying the context menuonInitialCommandCompleteandonContextMenuOpencallbacksChanges
Test plan
onContextMenuOpen) still worksCloses #220
🤖 Generated with Claude Code