perf: optimize movement commands with count to execute instantly
What this PR does / why we need it:
Previously, movement commands with counts (e.g., 20j, 50k) would loop through each individual movement, causing visible lag and poor performance. This made the extension feel sluggish compared to native Vim, especially with large count values.
This PR optimizes the four basic movement commands (j, k, h, l) by overriding execActionWithCount to calculate the target position directly instead of looping:
- MoveDown (j): Calculates target line as current + count
- MoveUp (k): Calculates target line as current - count
- MoveLeft (h): Calculates target character with surrogate pair handling
- MoveRight (l): Calculates target character with surrogate pair handling
All special cases are preserved:
- Interactive window history navigation
- Foldfix mode compatibility
- Operator context (d20j, y10k work correctly)
- Visual mode selections
- Column preservation for vertical movements
- Boundary checks (don't exceed document limits)
Which issue(s) this PR fixes
Fixes #8557
Special notes for your reviewer:
Additionally fixed build issues encountered during development:
- Updated
test/index.tsto use new glob API (async/await pattern) - Added
skipLibChecktotsconfig.jsonfor node_modules compatibility - Added
ignoreDeprecations: "6.0"to silence baseUrl warning
The optimization provides instant cursor movement for any count value, matching native Vim's performance. Tested on Windows 10 and Ubuntu 22.04 with various count values (1-200) in Normal, Visual, and Operator-pending modes.
Note:
Those changes were made by GitHub Copilot, using Claude Sonnet 4.5 agent