You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running find and replace on files in a workspace which includes multiple packages, each with their own Prettier version, and with format on save enabled, files are sometimes overwritten with the contents of other files.
The text was updated successfully, but these errors were encountered:
mogzol
changed the title
Running Find & Replace on files with formatOnSave enabled overwrites files with incorrect content
Running find & replace on files with formatOnSave enabled overwrites files with incorrect content
Jun 6, 2024
Decided to look into this since the issue is incredibly annoying for me. Turns out it was a very simple issue, I have created a pull request with the fix: #3481
Summary
When running find and replace on files in a workspace which includes multiple packages, each with their own Prettier version, and with format on save enabled, files are sometimes overwritten with the contents of other files.
Github Repository to Reproduce Issue
https://github.com/mogzol/prettier-vscode-plugin-repro
Steps To Reproduce:
npm install
on all packages:bash -c 'for d in ./*/ ; do (cd "$d" && npm i); done'
"1.0.0"
and replace with"2.0.0"
package.json
filespackage.json
files, verify that ONLY that string was replaced in each file (check that package name still matches folder name)Expected result
Files should not be overwritten with the contents of other files.
Actual result
Files are overwritten with the contents of other files.
Additional information
The same issue was reported nearly a year ago, here: #3040
That issue was closed as stale, however the issue is still happening on the latest version of the extension.
VS Code Version:
Prettier Extension Version: v10.4.0
OS and version: macOS Sonoma 14.5
Prettier Log Output
These are the logs from a find & replace operation where all files ended up with the contents of
pkg-c
'spackage.json
file:Log Output
The text was updated successfully, but these errors were encountered: