-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Paste into editor with format on paste removes pasted word #48006
Comments
I cannot reproduce this on windows. Up for a quick meeting? |
Yes |
Henning figured out that this is a bug in the typescript formatter and it reproduces as simple as with this: const x = f('aaaa', 'aaaa').x() When you try to paste the |
Here's the
|
Repro explained: Turn on Format on Paste, then write const a = f('').x(); Put the caret between the quotes and paste const a = f().x(); instead of const a = f('bar').x(); |
@RyanCavanaugh I'm marking this as a VSCode priority for 4.7 as we've seen a few reports of it now |
So far, it looks like the tree walking part of the formatter doesn't correctly increment the scanner, so the end-of-tree section of the code ends up formatting Now I have to go understand how the tree walk works. |
Broken in #46875, which is not surprising since that PR adds the end-of-tree section. Edit: The tree walk was probably already incorrect, it's just the new end-of-tree code relies on it being correct. |
processChildNodes needs to skip processing when the node array is outside the target range, just like processChildNode already does for a single node. Fixes #48006
processChildNodes needs to skip processing when the node array is outside the target range, just like processChildNode already does for a single node. Fixes #48006
I also have this issue on mac |
TS Template added by @mjbvz
TypeScript Version: @4.7.0-dev.20220222
Search Terms
I have auto save enabled and format on paste. When I paste a string into a another string, that string is removed. See
//cc @sandy081
The text was updated successfully, but these errors were encountered: