fix(editor): make result pinning reachable from the result tabs (#1982) - #1988
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1982.
Root cause
The pin feature was not broken. The right-click never reached it.
EditorEventRouterinstalled one process-global.rightMouseDownmonitor and decided which view owned the click withtextView.bounds.contains(point).TextViewis the document view of a scroll view, sized to the whole query, soboundscovered everything below the visible editor. Any query taller than the editor pane made the editor claim right-clicks on the result tab strip, the data grid, and the status bar, andreturn nilswallowed the event so the result tab's own menu never ran.The reporter's screenshots show exactly this: right-clicking near the result tabs opens the SQL editor's menu. The same bug also took out the data grid's row menu and Clear Results in query tabs.
Two more problems sat behind it. The pin glyph only appeared after a result was pinned, so there was nothing to discover. And
canPinActiveResultSetandshowsResultTabBarwere separate predicates that disagreed in JSON view, in Structure view, and during Explain, where View > Pin Result stayed enabled with no tab on screen.What changed
Right-click routing. The monitor is gone.
TextView.menu(for:)now prefers a menu assigned to the view and keeps its editing default when there is none,SQLEditorCoordinatorassigns the AI menu to the text view, and the gutter forwards to the editor. AppKit decides ownership, which is whatNSView.menu(for:)is for.A visible pin. Each result tab carries a pin control on the trailing edge with close moved to the leading edge, matching Xcode's documented tab controls. It shows on the tab you are on and when you point at a tab, and stays visible once pinned. Both controls sit in fixed 12x12 slots so a tab never changes width. VoiceOver gets a named action for each, since a control revealed by pointing is not reachable any other way. Pinned results move to the front of the strip, which is where the next run puts them anyway.
One rule for pinning.
ResultTabBarPolicyis now the single source of truth for the View menu, the tab menu, and whether the strip renders, withcanPindefined in terms ofshowsTabBarso a pinnable result always has a tab on screen. Result tabs also render in JSON view, so a multi-statement run is switchable there.Testing
ResultTabBarPolicyTestscovers the gating matrix, including the invariant that pinning is never offered without a strip.ResultPinningTestsgains coverage for pin ordering, the active result surviving a pin, and parity between the View menu and the strip.EditorContextMenuRoutingTestscovers menu resolution: an assigned menu wins, and a text view without one keeps the standard editing items.ResultTabPinUITestsruns the reported flow end to end against the sample database, with a query padded past the editor height, and asserts the result tab's own menu opens.The change was reviewed in two adversarial passes. The first caught a hard compile error in the pin toggle and two regressions in the vendored text view, including one that stripped the editing menu from the JSON, DDL, and trigger editors. The second caught a replacement test that could not fail, which was removed rather than kept.
I could not build or lint this.
swiftlintis not installed on the machine that produced the change andxcode-selectpoints at Command Line Tools, so there is noxcodebuild. Line lengths and the SwiftLint opt-in rules were checked by hand and the writing-style gate passes, but CI is the first real build.Notes for review
LocalPackages/change. Both are small and both keep existing behaviour: the text view gains an assigned-menu path ahead of its default, and the gutter forwards its menu to the editor so right-clicking line numbers still answers.TableProMobile.xcodeprojuses explicit file references and does not pick up the newResultTabBarPolicy.swift. It already omitsQueryTabState.swiftwhile referencingMainContentCoordinator+SidebarActions.swift, so it looked stale before this change and was left alone.