VSCodeVim / VSCodeVim/Vim

undo/redo search and replace operations is non-atomic and slow

Open
#4,293 0 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/performance
Dominant language
TypeScript
Stars
15.2k
Forks
1.5k
Avg merge
3d 18h
Merged PRs (30d)
6

Description

Describe the bug

undo/redo a "search and replace" operation is non-atomic and thus very slow.

First I had the issue with the search and replace being non-atomic. But I found this issue which suggested activating neovim, and it worked:

https://github.com/VSCodeVim/Vim/issues/737

However, it did not make the undo/redo atomic.

To Reproduce

  1. Open a non-trivial file (200 rows and 30 replaces takes almost 2 full seconds on my laptop)
  2. Type :
  3. Type %s/something/blahblahblah/g and hit enter
  4. Type u

I can see how the undo operation slowly rewrites the document. If I press ctrl+r to redo the operation it is also slow and non-atomic.

Expected behavior
An atomic and quick undo/redo.

Environment (please complete the following information):

  • Extension (VsCodeVim) version: 1.11.3
  • VSCode version: 1.40.1
  • OS: Windows 10

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the search-and-replace sequence on a non-trivial file: enter :%s/something/blahblahblah/g, then undo with u and redo with ctrl+r. Trace the command and undo/redo handling from that entry point; done means both operations are quick and atomic rather than visibly rewriting the document.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.