razor icon indicating copy to clipboard operation
razor copied to clipboard

Add option to turn off Format on Paste

Open davidwengier opened this issue 3 years ago • 12 comments

Along with https://github.com/dotnet/razor-tooling/issues/4336, once https://github.com/dotnet/razor-tooling/issues/6212 is done we should add an option to turn off formatting on paste.

Currently this is, as far as I know, completely done on the platform side, so not sure if we already have a facility to tell them not to format, but we should investigate and request something if not.

See related user feedback here: https://github.com/dotnet/razor-tooling/issues/6212#issuecomment-1290019797

davidwengier avatar Oct 25 '22 06:10 davidwengier

It makes more sense (IMO) for the client to implement these settings and simply not issue the requests. Format on Paste especially, because it is indistinguishable from a Range Formatting request. Such is the model that existed for language services registered through pkgdef, which included being able to enable/disable completion, quickinfo (hover), and a few other features. For LSP, it may make sense to expand the set of language features for which the client exposes an option, and the registration of those options hopefully can be modernized or streamlined for LSP...

jimmylewis avatar Oct 25 '22 06:10 jimmylewis

100% agree

davidwengier avatar Oct 25 '22 07:10 davidwengier

Format on paste is the main reason I have to hit Ctrl + Z hundreds of times per day. Doing a line copy and paste formats both the copied line and pasted line:

Copy-and-paste

michaelcsikos avatar Nov 30 '22 06:11 michaelcsikos

@olegtk @kayle @joseparrams FYI on this since platform controls the Format on Paste in LSP (but also see my comment above about modernizing all the other features previously supported via Language Service registration in pkgdef, since those are also client-initiated features in LSP). This also relates to our internal discussion of consolidating and simplifying settings for LSP vs other VS Editor extensibility.

jimmylewis avatar Nov 30 '22 06:11 jimmylewis

Tracking as internal ask with Bug 1803701: Allow "Format On Paste" to be disabled for LSP

ryzngard avatar Apr 18 '23 21:04 ryzngard

So this just keeps getting kicked down the road? Format on Paste is so frustrating, it forces you to wait up to a second before the format occurs just so you can hit undo. The only workaround is to quickly type a character which prevents the automatic format.

michaelcsikos avatar Sep 21 '23 01:09 michaelcsikos

Any update on this, over a year later? This bug is the main reason I hate Visual Studio.

michaelcsikos avatar Nov 06 '23 05:11 michaelcsikos

Unfortunately this fix can only be done by the Visual Studio editor team, so all we can do is ask and wait. It is one of our highest priority requests from them however.

davidwengier avatar Nov 06 '23 06:11 davidwengier

8 GB of updates today and Paste still sucks in Razor.

michaelcsikos avatar Nov 16 '23 06:11 michaelcsikos

17.9 has come and gone, we can only hope something will be done in 17.10.

michaelcsikos avatar Mar 20 '24 06:03 michaelcsikos

@michaelcsikos if you want to comment in a way that is visible to the team that needs to fix this issue, then https://developercommunity.visualstudio.com/t/CSHTML-File-Format-Problem/10398165 is a much better place.

davidwengier avatar Mar 22 '24 01:03 davidwengier

OK. So, that bug was reported 8 months after this thread and it has 2 votes. The search for the Developer Community is abysmal, but that's a different issue.

michaelcsikos avatar Mar 25 '24 03:03 michaelcsikos

@michaelcsikos if you want to comment in a way that is visible to the team that needs to fix this issue, then https://developercommunity.visualstudio.com/t/CSHTML-File-Format-Problem/10398165 is a much better place.

And now it's Closed - Lower Priority.

michaelcsikos avatar Sep 30 '24 00:09 michaelcsikos

Following up with the VS team. Likely got caught in some automation.

ryzngard avatar Sep 30 '24 01:09 ryzngard

This doesn't seem to work in 17.13 for me. I think the option value might be the problem, as it reset to true after restarting VS. Might be a platform issue?

davidwengier avatar Feb 13 '25 03:02 davidwengier

Okay, tracked it down. Its a bug in our handling of the old options page. The new options page seems to work fine 🤦‍♂️

Sorry, thats a trap of working here, we get auto-opted in to beta test all of the new stuff.

davidwengier avatar Feb 13 '25 22:02 davidwengier

@michaelcsikos we're going to try to get approval to backport the fix to 17.13. Thanks again for raising it with us!

davidwengier avatar Feb 13 '25 22:02 davidwengier