Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Generic Expand SelectionNew to Visual Studio Code? Get it now.
Generic Expand Selection

Generic Expand Selection

dandehoon

|
4 installs
| (0) | Free
Smartly expands selection to nearest scoped characters like quotes, brackets, and more.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Generic Expand Selection

Test

Smartly expand or shrink your code selection, recover from misclicks or accidental cursor moves.

Features

Expansion Rules

  • Token Expansion: Expands to word tokens, including identifiers with underscores and dots
  • Quote Scopes: Expands to content within quotes (", ', `)
  • Bracket Scopes: Expands to content within brackets ([], {}, ())
  • Line Expansion: Expands to full line content
  • Selection History: Remember previous selections for step-by-step shrinking

Usage

Keybindings

  • Expand Selection: Ctrl+E (Windows/Linux) or Cmd+E (Mac)
  • Retract Selection: Ctrl+Shift+E (Windows/Linux) or Cmd+Shift+E (Mac)

[!TIP] Both commands work with single and multiple cursor selections.

Expansion Examples

Text: const config = { url: 'https://example.com' };

With cursor on `xamp`, next expansions will be:
→ example
→ example.com
→ https://example.com
→ 'https://example.com'
→ url: 'https://example.com'
→ { url: 'https://example.com' }
→ const config = { url: 'https://example.com' }
→ const config = { url: 'https://example.com' };

Commands

  • genericExpandSelection.expand: Expand Selection
  • genericExpandSelection.shrink: Shrink Selection

Development

# Install dependencies
pnpm install

# Type check and lint (TypeScript and ESLint)
pnpm run check

# Run tests (builds TypeScript, runs esbuild, then executes tests)
pnpm run test

# Build, type check, lint, and package extension as out.vsix
pnpm run build

# Build and install the packaged extension locally (outputs out.vsix and installs it)
pnpm run vsce:install

License

MIT License

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft