microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.16k stars 28.53k forks source link

Search and replace bug #222031

Open BerendKemper opened 1 month ago

BerendKemper commented 1 month ago

Does this issue occur when all extensions are disabled?: Yes/No

Steps to Reproduce:

  1. Use the global Search feature in order to find certain string occurences in your repository (in my case up: `out`)
  2. For 70 files inside the repository replace the matching string occurence with another string (in my case op: `in`). image
  3. It can turn out that a few of these files are incorrectly handled by the global search and replace feature.

Proof below in the form of screenshots: image image image image image image image image

BerendKemper commented 1 month ago

My colleague tells me he experiences the same issue occasionally.

andreamah commented 1 month ago

Hmm.. that's strange. when it first matches, does it match the correct ranges? Do you have a repo that I could test with?

BerendKemper commented 1 month ago

Please give me some time to provide an example repository. The repository where it is taking place is not public and owned by my employer. I cannot share the repository from my employer. Can provide a repository over the weekend.

BerendKemper commented 1 month ago

I am adding some screenshots from git differences in order to help this ticket and or ticket 223289.

74 files were changed during a single search and replace action. Amongst these 74 files:

6 corrupted files - 2 instances keywords:

image

image

image

image

image

image

27 not corrupted files - 2 instances keywords:

image

41 not corrupted files - 1 instance keyword:

image

andreamah commented 2 days ago

That's really strange. In the issue you linked, it was a different issue because the corrupted lines were the ones that had multiple matches in one line. However, it seems like there's no matches that were meant to be on the same line. Do you have a repo that I can clone to try to reproduce this?