Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable formatting on Copy in Visual Studio 2015

I have a project which has quite large files, ~55000 lines per file. (don't ask why)

Well, anytime I try to copy (!! Not paste !!) a part of text in a .CS file, I'm getting a dialog box saying Formatting which stays for 3-5 seconds. Is getting pretty frustrating.

Is there an option to disable this?

like image 210
Eugen Avatar asked Jun 06 '16 18:06

Eugen


People also ask

How do I turn off formatting in Visual Studio?

The solution was to go to 'Tools > Options > Text Editor > Basic > VB Specific' and turn 'Pretty Listing' OFF.

How do I paste without formatting in Visual Studio?

tip. Even if auto-formatting or auto-indenting on paste are enabled, you can paste code without reformatting it: press Ctrl+Z right after pasting, and only formatting will be undone. Note that by default, Visual Studio applies its own formatting rules for edited and pasted code.

How do you remove formatting in VS code?

Use vs-code default shortcut keys ctrl+k with ctrl+shift+s (windows) for saving without formatting. Alternatively press ctrl+shift+p and search for save without formatting.

How do I enable formatting in Visual Studio?

To access this options page, choose Tools > Options from the menu bar. In the Options dialog box, choose Text Editor > C# > Code Style > Formatting.


2 Answers

You may disable through the following:

Options -> Text Editor -> C# -> Formatting -> "Automatically format on paste"

(You can typically find the "Options" button under the "Tools" and/or "Debug" menu depending on your user interface configurations)

This will improve performance a bit. But, it is known bug after the last update and you won't be able to copy immediately.

like image 79
ilkerkaran Avatar answered Oct 19 '22 04:10

ilkerkaran


ilkerkaran's solution didn't work for me, so I kept Googling and found out this is part of the Productivity Power Tools extension. Far from increasing my productivity, it prevented me from copy/pasting my code entirely!

Here's the solution I found:

Go to Extensions > Manage Extensions > Search for HTML > Copy As HTML > Disable

Then, restart Visual Studio. It seems to have fixed this problem for me after YEARS of dealing with this thinking there was no solution after the above solution didn't work!

(this is a link to what clued me in: https://developercommunity.visualstudio.com/content/problem/251912/htmlcopy-formatting-document-for-copying.html)

This answer is specific to Visual Studio Community 2019, your mileage may vary.

Note: This precludes the need to turn off format on paste, which is a feature I quite like.

like image 39
Sean Kendle Avatar answered Oct 19 '22 05:10

Sean Kendle