Add multi-cursor support to select/navigate/move commands#188
Add multi-cursor support to select/navigate/move commands#188selfint merged 12 commits intoselfint:mainfrom
Conversation
This commit adds multi-cursor support to selectBlock, updateSelection, moveSelection, and navigate commands. When multiple cursors or selections exist, each is processed independently and results are merged intelligently. Changes: - selectBlock: Maps over all selections to find blocks at each cursor - updateSelection: Updates each selection independently (parent/child/next/prev) - moveSelection: Orders moves to prevent interference, handles single vs multi - navigate: Collects navigation targets for all cursors - Add mergeSelections helper to combine overlapping selections - Add dedupeSelections helper to remove duplicate cursor positions - Add comprehensive test suite (MultiSelectBlockMode.test.ts)
e4fbb04 to
e3d9647
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR updates the project's dependencies, including major version upgrades to testing frameworks (mocha, chai), build tools (esbuild, typescript), and the tree-sitter library. The changes also include updates to tree-sitter parser files for TypeScript/TSX and Rust, along with code changes to support multi-cursor functionality and improve type safety.
Key changes:
- Major dependency upgrades: tree-sitter (0.22.0 → 0.25.0), mocha (10.x → 11.x), chai (4.x → 6.x), typescript (5.1.6 → 5.9.3)
- Added multi-cursor support for block selection, navigation, and movement operations
- Updated tree-sitter parser files with new grammar features and bug fixes
- Type safety improvements in Installer.ts and FileTree.ts
Reviewed Changes
Copilot reviewed 32 out of 45 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Updates all dependency versions |
| package.json | Updates devDependencies and dependencies with version bumps, adds Rust field_declaration query, changes install script to use --frozen-lockfile |
| tsconfig.json | Updates target and lib from ES2020 to ES2022 |
| src/BlockMode.ts | Adds multi-cursor support for selectBlock, updateSelection, moveSelection, and navigate functions |
| src/Installer.ts | Improves type safety by properly typing Language and Buffer parameters |
| src/FileTree.ts | Removes unnecessary Language type assertion |
| src/test/suite/*.test.ts | Updates tests to support multi-cursor scenarios and fixes glob API usage |
| test-parsers/* | Updates tree-sitter parser files for TypeScript/TSX and Rust with new grammar features |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }, | ||
| "scripts": { | ||
| "install:all": "yarn install && cd webview-ui && yarn install", | ||
| "install:all": "yarn install --frozen-lockfile && cd webview-ui && yarn install --frozen-lockfile", |
There was a problem hiding this comment.
The --frozen-lockfile flag is a good addition for CI/CD environments, but this change may cause local development issues if developers need to update dependencies. Consider documenting this behavior change or creating separate scripts for CI vs local development (e.g., install:all:ci for frozen installs).
| "install:all": "yarn install --frozen-lockfile && cd webview-ui && yarn install --frozen-lockfile", | |
| // For local development, use 'install:all'. For CI/CD, use 'install:all:ci'. | |
| "install:all": "yarn install && cd webview-ui && yarn install", | |
| "install:all:ci": "yarn install --frozen-lockfile && cd webview-ui && yarn install --frozen-lockfile", |
| `${npm} pack --verbose --json --pack-destination ${parserDir} ${parserNpmPackage}`, | ||
| {}, | ||
| onData | ||
| (d) => onData?.(d.toString()) |
There was a problem hiding this comment.
The callback now receives a Buffer and converts it to string inline. While this works, consider documenting the Buffer-to-string conversion or handling potential encoding issues. The toString() method uses UTF-8 by default, which should be fine for most cases but may fail with non-UTF-8 output.
| (d) => onData?.(d.toString()) | |
| // We expect npm output to be UTF-8 encoded. If this changes, update the encoding below. | |
| (d) => onData?.(d.toString('utf8')) |
What: Multi-cursor support for selectBlock, selectParent/Child/Next/Previous, navigate*, and moveUp/Down
How: Iterates over editor.selections; move ordering to avoid conflicts; tests added
Scope: No package manager/config churn; no new commands
Validation: tsc and tests pass; lint unchanged from upstream