fix(editor): implement missing methods, fix cursor position clearing#38603
Conversation
Code Review Agent Run #87713bActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Sequence DiagramThis PR completes two extension-facing APIs and fixes cursor movement behavior in the Ace editor integration. It adds content change subscriptions and panel switching support, and ensures selections are cleared before programmatic cursor jumps. sequenceDiagram
participant Extension
participant EditorHandle
participant AceEditor
participant SQLLabAPI
participant Store
Extension->>EditorHandle: Subscribe to content changes
EditorHandle->>AceEditor: Attach session change listener
AceEditor-->>Extension: Send full editor content on each edit
Extension->>SQLLabAPI: Set active panel by panel id
SQLLabAPI->>Store: Dispatch set active south pane tab
Extension->>EditorHandle: Move cursor to position
EditorHandle->>AceEditor: Clear selection and move cursor
Generated by CodeAnt AI |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| const bound = (thisArgs ? listener.bind(thisArgs) : listener) as ( | ||
| value: string, | ||
| ) => void; | ||
| const handler = () => bound(editor.getValue()); |
There was a problem hiding this comment.
Is there risk that getting the full editor value could be excessively expensive in some editors? I wonder if we should rather pass a handle that offers getting the contents when/if needed. For instance, to control load, one may want to debounce rather than eagerly reacting to every content change.
There was a problem hiding this comment.
Great observation @villebro.
The onDidChangeContent event has been updated to deliver a ContentChangeEvent instead of a raw string — providing a lazy getValue() to avoid unnecessary work on every keystroke, alongside a changes array describing the individual edits. Debouncing is left to consumers rather than built in, since different subscribers have different latency requirements and no single delay can satisfy all of them — following the convention of VS Code, Monaco, and CodeMirror.
|
Yes, calling |
Code Review Agent Run #b91498Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Sequence DiagramThis PR completes two missing extension APIs and fixes cursor behavior. Extensions can now subscribe to editor content changes, switch SQL Lab south pane panels programmatically, and move the cursor without leaving stale text selections. sequenceDiagram
participant Extension
participant EditorHandle
participant AceEditor
participant SQLLabAPI
participant Store
participant SouthPane
Extension->>EditorHandle: Subscribe to content changes
EditorHandle->>AceEditor: Register change listener
AceEditor-->>Extension: Emit change event with content access
Extension->>EditorHandle: Move cursor to position
EditorHandle->>AceEditor: Clear selection and move cursor
Extension->>SQLLabAPI: Set active panel by id
SQLLabAPI->>Store: Dispatch active south pane tab action
Store-->>SouthPane: Activate target panel
Generated by CodeAnt AI |
villebro
left a comment
There was a problem hiding this comment.
Approving, but at the risk of overthinking this, couldn't the same apply to changes, too? Any reason why we don't want to do getChanges(): ReadonlyArray<ContentChange>? I just want to make sure we're as broadly compatible with the entire population of editors, and if the changes aren't eagerly produced by all editors, I'm not sure we should require them to do so. But again, this may be overkill..
Code Review Agent Run #33f9feActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
The |
User description
SUMMARY
Adds two missing methods to the extension APIs and corrects a bug in cursor positioning:
EditorHandle.onDidChangeContent— adds a content-change subscription method toEditorHandleand implements it inAceEditorProvider. Useseditor.session.on('change', ...)and returns aDisposablefor cleanup. The listener receives the full editor content on every change.sqlLab.setActivePanel— adds a missingsetActivePanel(panelId)function to the SQL Lab extension API. DispatchesSET_ACTIVE_SOUTHPANE_TABto programmatically switch between south pane panels ('Results','History', or a pinned table panel ID).moveCursorToPositionfix — clears any active selection before moving the cursor inAceEditorProvider, preventing leftover highlighted text after a programmatic cursor jump.TESTING INSTRUCTIONS
onDidChangeContentEditorHandleviaonReady.const d = editor.onDidChangeContent(sql => console.log(sql));d.dispose()and confirm the listener stops firing.setActivePanelsqlLab.setActivePanel('Results')— the Results tab should become active.sqlLab.setActivePanel('History')— the History tab should become active.moveCursorToPositionfixeditor.moveCursorToPosition({ line: 0, column: 0 }).ADDITIONAL INFORMATION
CodeAnt-AI Description
Implement editor content-change subscription, add SQL Lab panel switch, and stop leftover selection when moving the cursor
What Changed
Impact
✅ Immediate content-change notifications for extensions✅ Ability to programmatically focus Results/History/pinned tables✅ No leftover highlighted text after programmatic cursor jumps💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.