vscode-apple-swift-format icon indicating copy to clipboard operation
vscode-apple-swift-format copied to clipboard

New line added when pasting

Open adam-rocska opened this issue 1 year ago • 4 comments

I'm really sorry but I don't know how to provide repro-steps.

I've been happily using this extension for a few days now, but today all of a sudden it started to add new lines whenever I paste anything anywhere. Even in comments.

What I do know is that the bug itself is pretty evasive. It comes up occasionally, annoys me for 15-20 minutes then it's gone again.

I'll keep this ticket updated if I finally figure out how to reproduce it, or if it's not a big deal, could also land a PR.

@vknabel if you have any blind guess what might be happening, you could save the remaining survivor neurons in my brain.

adam-rocska avatar Nov 02 '23 00:11 adam-rocska

@vknabel I FINALLY GOT IT! Here's how to reproduce the bug :)

Have the "Editor: Format on paste" option enabled. It is consistently reproducible this way on my local machine even with a totally virgin VSCode.

Képernyőfotó 2024-02-06 - 12 46 01

I've disabled this feature for now on my setup, but I really love the format on paste :(

I hope it helps!

P.S.: If I'll have time to try to address the issue myself, I will.

adam-rocska avatar Feb 06 '24 11:02 adam-rocska

Thanks for nailing it down! Does this still occur? Or have you still deactivated formatting on paste?

vknabel avatar Jun 26 '24 05:06 vknabel

This still occurs for me. 100% with format on paste on. Every CMD+V adds a new, trailing newline.

In this example I'm simply marking a line, copying it (CMD+C) and pasting it (CMD+V). Notice that the newline isn't included in what's copied.

https://github.com/user-attachments/assets/45af5db7-b89b-4996-8d0a-80b96ae83dc6

AlexGustafsson avatar Jul 13 '24 10:07 AlexGustafsson