Skip to content

Editor: Expand and Shrink Selection (Shift+Alt+Right/Left) are no-ops #71

Description

@KrisPowers

The Edit menu has Expand Selection (Shift+Alt+Right) and Shrink Selection (Shift+Alt+Left), but both are wired to no-ops. These commands should progressively extend the selection outward to the next syntactic boundary (word, string, expression, statement, block, function body, file) or shrink it back inward.

What needs to happen

Since we already have tree-sitter parsing on the backend, this is achievable via AST node expansion:

  • On Expand Selection, find the smallest AST node that fully contains the current selection, then select it.
  • On Shrink Selection, move back to the previously selected region before the last expand.
  • If there is no selection, start by selecting the word at the cursor.

This requires a round-trip to the C++ backend to query the tree-sitter node at a given range, then returning the parent node's span.

Files likely involved

  • cpp/src/editor_buffer.cpp -- tree-sitter node-at-range query would go here
  • app/frontend/src/components/GpuEditor.tsx -- keybinding handler and selection update
  • app/frontend/src/fullscreen/FullscreenIDE.tsx -- menu command handler (currently a no-op)

Acceptance criteria

  • Shift+Alt+Right with cursor inside a string literal first selects the string content, then the full string including quotes, then the expression containing it, and so on
  • Shift+Alt+Left reverses each step
  • Works in at minimum JS, TS, TSX, Python, C, C++, Rust
  • Falls back gracefully for unsupported languages (no error, just no-op with a small notice)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions