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
{{ message }}
Repository navigation
Format selection (and thus format-on-paste) causes destructive edits #50076
Create a simple template string in a Javascript or Typescript file as below
constTEST_STRING=`${TEST_VAR_1}, this is some text`;
Copy any text and paste anywhere after the closing expression bracket "}". All text including the last "}" is deleted.
In my example I've copied the word "TEST_STRING " by double clicking on it. I've tried pasting just before the end back tick
constTEST_STRING= `${TEST_VAR_1;
If you press undo the expected initial result is shown.
constTEST_STRING=`${TEST_VAR_1}, this is some textTEST_STRING`;
VS Code version: Code 1.69.2 (3b889b090b5ad5793f524b5d1d39fda662b96a2a, 2022-07-18T16:12:52.460Z)
OS version: Windows_NT x64 10.0.19043
Restricted Mode: No
Activity
mjbvz commentedon Jul 27, 2022
Confirmed with
^4.8.0-dev.20220727. Requireseditor.formatOnPasteto be enabledHere's the sequence of events for pasting
abc:mjbvz commentedon Jul 27, 2022
Seems very similar to #48006
amcasey commentedon Jul 27, 2022
+1. Nathan Shively-Sanders (@sandersn) ?
DanielRosenwasser commentedon Jul 27, 2022
Simpler repro is
Select
abcand run format selection.Note that:
DanielRosenwasser commentedon Jul 27, 2022
Another similar one
[-]Pasting inside Javascript or Typescript template literal/string deletes content[/-][+]Format selection (and thus format-on-paste) causes destructive edits[/+]DanielRosenwasser commentedon Jul 28, 2022
First appears on
typescript@4.6.0-dev.20221130which is hard to test because VS Code assumes4.6.*can run with IPC. That means it's one of https://github.com/microsoft/TypeScript/pulls?q=is%3Apr+merged%3A2021-11-29+is%3Aclosed, and likely #46875.It's been in the product for over 8 months so I guess I feel weird labeling it "High Priority", but I think we should get it fixed for 4.8