Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Block Move - YAML/JSONC Structural MoverNew to Visual Studio Code? Get it now.
Block Move - YAML/JSONC Structural Mover

Block Move - YAML/JSONC Structural Mover

Shunsuke F

|
5 installs
| (0) | Free
Move YAML sequence items and JSON/JSONC array blocks in the text editor while preserving comments, blank lines, and document style.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Marketplace Installs License: MIT

Block Move: structural YAML and JSONC reordering

For developers who reorder YAML sequence items or JSON/JSONC array elements while preserving their attached text. Block Move moves the parsed structural block in the normal editor instead of changing individual lines manually.

日本語版

Demo media: no workflow GIF is published for Block Move yet.

Quick start

  1. Install with ext install ShunsukeF.block-move and reload VS Code if prompted.
  2. Open a YAML, JSON, or JSONC file in a trusted workspace and place the cursor inside a supported block.
  3. Press Alt+Up or Alt+Down, or run Block Move: Move Structural Block Up/Down.

Requirements, privacy, and support

  • Requires VS Code 1.105.0 or later, is UI-hosted, and does not support untrusted workspaces.
  • Commands and default shortcuts: move up/down with Alt+Up and Alt+Down. It contributes no settings.
  • Parsing and edits run locally. If the cursor is outside a supported structural block, VS Code's standard line-move command remains the fallback.
  • Invalid input is not changed; unsupported structures and formatting remain normal source text for manual editing.
  • Support and bug reports. License: MIT.

Move YAML sequence items and JSON/JSONC array blocks directly in the normal VS Code text editor. Comments and formatting stay attached to the text they describe, and the result remains a normal file with standard Undo and Git diff behavior.

Use it

  1. Place the cursor inside a YAML sequence item or JSON/JSONC array element.
  2. Press Alt+Up or Alt+Down.
  3. Keep pressing to move the same structural block through its siblings.

The same operations are available from the Command Palette and editor context menu as Block Move: Move Structural Block Up and Block Move: Move Structural Block Down.

When the cursor is not inside a supported structural block, Block Move falls back to VS Code's standard line move behavior.

What stays safe

  • YAML leading comments and inline comments move with their attached item when no blank line separates them.
  • Blank-line-separated section comments remain at the original slot.
  • Blank lines, indentation, quotes, line endings, and unrelated document text remain unchanged.
  • JSON and JSONC commas are reassigned to the destination slots.
  • Invalid input is never changed. The extension parses the result again before applying an edit.
  • The smallest changed text range is applied as one Workspace Edit, so one Undo restores the previous order.

Supported scope

Block Move 0.1 targets array-like structures in text documents:

  • YAML sequence items
  • JSON array elements
  • JSONC array elements

The editor remains the primary interface. Block Move does not open a Webview or convert the file into a different document model.

Privacy

All parsing and editing happen locally inside VS Code. No document content is sent to a remote service.

Build from source

bun install --frozen-lockfile
bun run build
bun test tests/block-move.test.ts

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft