feat: add support for Virtual Space#310341
Open
jamiefutch wants to merge 3 commits intomicrosoft:mainfrom
Open
feat: add support for Virtual Space#310341jamiefutch wants to merge 3 commits intomicrosoft:mainfrom
jamiefutch wants to merge 3 commits intomicrosoft:mainfrom
Conversation
Author
|
@microsoft-github-policy-service agree |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an opt-in virtual space mode to the editor so the caret can move and operate beyond end-of-line, carrying that state through navigation, rendering, and typing/paste behaviors.
Changes:
- Introduces a new
virtualSpaceeditor option across Monaco typings, standalone enums, and the editor option registry. - Propagates
leftoverVisibleColumnsthrough cursor state events and view cursor rendering to place the caret in virtual space. - Updates navigation/typing/paste/column-selection paths to track and apply virtual-space offsets.
Reviewed changes
Copilot reviewed 15 out of 17 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| vscode.code-workspace | Adds a workspace file (appears unrelated to the feature). |
| src/vs/monaco.d.ts | Exposes virtualSpace on Monaco editor options and enums. |
| src/vs/editor/common/viewEvents.ts | Extends cursor state view event to include leftover visible columns. |
| src/vs/editor/common/standalone/standaloneEnums.ts | Adds virtualSpace to standalone EditorOption enum with adjusted numbering. |
| src/vs/editor/common/cursorCommon.ts | Stores virtualSpace on CursorConfiguration and recreates on config change. |
| src/vs/editor/common/cursor/cursorTypeOperations.ts | Threads leftoverVisibleColumns through typing/paste entry points. |
| src/vs/editor/common/cursor/cursorTypeEditOperations.ts | Applies leftover columns during typing/enter/paste operations. |
| src/vs/editor/common/cursor/cursorMoveOperations.ts | Implements left/right movement behavior into/out of virtual space. |
| src/vs/editor/common/cursor/cursorMoveCommands.ts | Allows moveTo to carry leftover visible columns. |
| src/vs/editor/common/cursor/cursorColumnSelection.ts | Captures leftover visible columns for column selections (incl. beyond EOL). |
| src/vs/editor/common/cursor/cursor.ts | Emits leftover columns in view events; passes them into type/paste operations. |
| src/vs/editor/common/config/editorOptions.ts | Registers the new virtualSpace option and adds it to IEditorOptions / EditorOption. |
| src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts | Feeds leftover columns into primary/secondary view cursors. |
| src/vs/editor/browser/viewParts/viewCursors/viewCursor.ts | Renders caret offset using leftover visible columns when virtual space is enabled. |
| src/vs/editor/browser/view/viewController.ts | Computes leftover columns from mouse column for move/select commands. |
| src/vs/editor/browser/coreCommands.ts | Extends move command args to include optional leftover visible columns. |
| .gitignore | Adds .antigravity/ ignore entry (appears unrelated). |
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 #13960
This pull request introduces support for "virtual space" in the editor, allowing the cursor to move beyond the end of lines (past trailing whitespace) when the new
virtualSpaceoption is enabled. The changes span configuration, cursor rendering, and command handling to ensure the cursor's position and visual rendering correctly account for extra columns beyond the line's content.The most important changes are:
Virtual Space Feature Implementation
virtualSpaceboolean option to the editor's configuration (IEditorOptions,EditorOption, andEditorOptions) to control whether the cursor can move into virtual space. [1] [2] [3]Cursor Rendering and State Management
ViewCursorandViewCursorsclasses to track and render the cursor with a newleftoverVisibleColumnsstate, ensuring the cursor is visually placed in virtual space when appropriate. [1] [2] [3] [4] [5] [6] [7]leftoverVisibleColumns, so all cursor actions and rendering logic are aware of the virtual space offset. [1] [2] [3]Command and Navigation Handling
ViewControllermethods to accept and propagate theleftoverVisibleColumnsparameter, ensuring that mouse and keyboard navigation correctly support virtual space. [1] [2] [3] [4] [5]These changes together enable the new virtual space feature, ensuring that both the cursor's logical position and its visual representation are consistent and accurate when the user moves the cursor past the end of a line.<!-- Thank you for submitting a Pull Request. Please:
https://github.com/microsoft/vscode/wiki/How-to-Contribute#pull-requests
mainbranch.