Skip to content

feat: add support for Virtual Space#310341

Open
jamiefutch wants to merge 3 commits intomicrosoft:mainfrom
jamiefutch:virtualspace
Open

feat: add support for Virtual Space#310341
jamiefutch wants to merge 3 commits intomicrosoft:mainfrom
jamiefutch:virtualspace

Conversation

@jamiefutch
Copy link
Copy Markdown

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 virtualSpace option 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

  • Added a new virtualSpace boolean option to the editor's configuration (IEditorOptions, EditorOption, and EditorOptions) to control whether the cursor can move into virtual space. [1] [2] [3]

Cursor Rendering and State Management

  • Updated the ViewCursor and ViewCursors classes to track and render the cursor with a new leftoverVisibleColumns state, ensuring the cursor is visually placed in virtual space when appropriate. [1] [2] [3] [4] [5] [6] [7]
  • Modified cursor events and state propagation to include leftoverVisibleColumns, so all cursor actions and rendering logic are aware of the virtual space offset. [1] [2] [3]

Command and Navigation Handling

  • Updated core navigation commands and ViewController methods to accept and propagate the leftoverVisibleColumns parameter, ensuring that mouse and keyboard navigation correctly support virtual space. [1] [2] [3] [4] [5]
  • Improved column selection logic to correctly calculate and store leftover visible columns when selecting in virtual space. [1] [2] [3]

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:

Copilot AI review requested due to automatic review settings April 15, 2026 23:41
@jamiefutch
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 virtualSpace editor option across Monaco typings, standalone enums, and the editor option registry.
  • Propagates leftoverVisibleColumns through 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).

Comment thread vscode.code-workspace
Comment thread src/vs/editor/common/config/editorOptions.ts
Comment thread src/vs/editor/common/cursor/cursorMoveOperations.ts
Comment thread src/vs/editor/common/cursor/cursorTypeEditOperations.ts Outdated
Comment thread src/vs/editor/browser/viewParts/viewCursors/viewCursor.ts
@jamiefutch jamiefutch changed the title feat: add support for Virtual Space #13960 feat: add support for Virtual Space Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Virtual Space is not implemented.

3 participants