feat: AI inline assistant for SQL editor#1084
Merged
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…assistant # Conflicts: # CHANGELOG.md
This was referenced May 7, 2026
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.
Summary
Adds an inline AI assistant to the main SQL editor (PR F from
docs/refactor/ai-chat-redesign.md).Ctrl+Return(or pick Rewrite with AI... from the right-click menu) to open a floating prompt strip anchored above the selection.Cmd+Returnto replace the selection in place via the editor's existing edit pipeline. Reject withEscto dismiss.Architecture
InlineAssistantSession(@Observable @MainActor) drives request → streamed response. ReusesAIProviderFactory.resolve(...)andChatTransport.streamChat(...); no duplicated streaming logic.AIPromptTemplates+Rewriteadds the system + user prompts for rewrite-in-place. Schema context is included when the user has it enabled in AI settings.InlineAssistantPromptViewis a SwiftUI view: text field, action buttons, and a streamed diff with monospaced strikethrough red / green tinting.InlineAssistantOverlayControllerhosts the view in a borderlessNSPanelchild window anchored to the editor selection rect viatextView.layoutManager.rectForOffset(...). The panel repositions on parent move/resize and clamps to the visible screen.InlineAssistantPresenterowns the lifecycle inside the editor coordinator: builds the session, presents the overlay, applies the replacement on accept, and dismisses on reject/cancel.SQLEditorCoordinatorinstalls the presenter and a per-editorNSEvent.addLocalMonitorForEventsfor Ctrl+Return. The monitor fires only when the editor is first responder, has a non-empty selection, and AI is enabled. The existingEditorEventRouteris untouched.Test plan
Ctrl+Return. Confirm the prompt strip appears anchored above the selection.Cmd+Returnto accept. Confirm the selection is replaced in place and undo (Cmd+Z) reverts it.Escto reject. Confirm no edit and the panel closes.Ctrl+Return. Confirm beep and no panel (Ctrl+Return passes through to default text view behavior when nothing is selected).Ctrl+Returnno longer triggers the assistant.References
docs/refactor/ai-chat-redesign.mdPR F.docs/features/keyboard-shortcuts.mdxanddocs/features/ai-assistant.mdx.