dotnet / razor

Compiler and tooling experience for Razor ASP.NET Core apps in Visual Studio, Visual Studio for Mac, and VS Code.
https://asp.net
MIT License
489 stars 190 forks source link

Add option to turn off Format on Paste #7025

Open davidwengier opened 1 year ago

davidwengier commented 1 year ago

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

jimmylewis commented 1 year ago

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...

davidwengier commented 1 year ago

100% agree

michaelcsikos commented 1 year ago

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

jimmylewis commented 1 year ago

@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.

ryzngard commented 1 year ago

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

michaelcsikos commented 11 months ago

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 commented 10 months ago

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

davidwengier commented 10 months ago

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.

michaelcsikos commented 9 months ago

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

michaelcsikos commented 5 months ago

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

davidwengier commented 5 months ago

@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.

michaelcsikos commented 5 months ago

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.