feat: expose active console as vscode.TextEditor via positron.window - #15154
Draft
samclark2015 wants to merge 5 commits into
Draft
feat: expose active console as vscode.TextEditor via positron.window#15154samclark2015 wants to merge 5 commits into
samclark2015 wants to merge 5 commits into
Conversation
…onsole API Expose the currently active console and a change event via the Positron extension API, with startup seeding to handle consoles active before the ext host starts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tor API Adds three commands to the Zed test runtime for manually exercising the new positron.window.activeConsoleEditor and onDidChangeActiveConsoleEditor APIs added in the previous commit. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Register the console Monaco editor with MainThreadDocumentsAndEditors so it appears as a real vscode.TextEditor in the ext host, while preserving isSimpleWidget: true so it never becomes vscode.window.activeTextEditor. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
E2E Tests 🚀 Why these tags?
More on automatic tags from changed files. |
The console input assigns its code editor before calling setModel(), so onDidSetCodeEditor fired while the widget still had no model. registerConsoleEditor then hit its `if (!model) return` guard and silently never registered the editor, leaving positron.window.activeConsoleEditor permanently undefined. Defer registration until a model is attached (via onDidChangeModel) instead of giving up. Also add Zed `console edit/append/insert/select` commands that exercise the mutating side of the TextEditor interface (edit(), insertSnippet(), selection). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a Vitest for MainThreadDocumentsAndEditors.registerConsoleEditor covering the deferred-model branch: when the code editor starts without a model, registration waits for onDidChangeModel rather than silently skipping. A companion case covers the model-present path. Uses a real ModelService + createTestCodeEditor so the model-attach event fires genuinely, mirroring the sibling upstream Mocha suite's wiring. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 #1507
Adds
positron.window.activeConsoleEditorandpositron.window.onDidChangeActiveConsoleEditorto the Positron extension API, exposing the console input as avscode.TextEditor(parallel to VS Code'sactiveTextEditorandactiveNotebookEditor). The console editor is registered with the extension host's text editor machinery via a Positron-specific path that preservesisSimpleWidget: true, so it is never surfaced asvscode.window.activeTextEditor-- only through the new Positron API.Release Notes
New Features
positron.window.activeConsoleEditorandonDidChangeActiveConsoleEditor-- expose the active console input as avscode.TextEditorso extensions can read and edit console text using the standard editor API (Console: API to get the active console #1507)Bug Fixes
Validation Steps
@:console
console active-- the output should show the console'sinmemory://URI, language ID, and current input text.console watch, then switch between different language consoles -- each switch should fire an event showing the new editor's URI. Runconsole watch stopto stop.vscode.TextEditorAPI against the console input:console edit foo-- replaces the input withfooviaTextEditor.edit().console append bar-- insertsbarat the end viaTextEditor.edit().console insert baz-- insertsbazat the cursor viaTextEditor.insertSnippet().console select-- selects the whole input and reportsTextEditor.selection.