Enable/Disable Format On SaveOpen up VSCode Command Palette by pressing Ctrl + Shift + P. Search and select Open Settings (UI). Just start typing and it will auto-fill. Once there's a match, you can hit enter immediately, or manually click on the right option.
The solution was to go to 'Tools > Options > Text Editor > Basic > VB Specific' and turn 'Pretty Listing' OFF.
Every single IDE makes this incredibly difficult. 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.
The code formatting is available in Visual Studio Code (VSCode) through the following shortcuts or key combinations: On Windows Shift + Alt + F. On macOS Shift + Option + F. On Linux Ctrl + Shift + I.
Under Tools -> Options -> Text Editor -> HTML -> Advanced
there is a key value item Paste which says "Format on paste" and has a boolean value next to it. Changing this to false has disabled formatting on paste for me in razor syntax.
I am using VS Professional 2013, Version 12.0.30110.00 Update 1
You cannot. This is built in "feature" of VS since the first .net version (visual studio 2002/2003).
There are tons of connect report about the formatting bugs, but Microsoft ignores them completly, or pushing the fix to the "next version". You can see an example Microsoft answer here.
You can post your own feedback to Microsoft Team here
The places to look:
Tools -> Options -> Web Essentials -> HTML -> Auto-format HTML on Enter
(Requires installation of Web Essentials extension)
Set to False
Tools -> Options -> Text Editor -> HTML -> Advanced -> Format on Paste
Set to False
With these settings I have no trouble in Visual Studio 2013.
I used to have to press Ctrl-Z far too often, and if you forgot untangling the mess once your code was written and tested was a huge pain. I feel Microsoft could do alot to help users configure this as well as make it more accessible.
What did the trick for me was pressing CTRL+Z after pasting, then the formatting is removed.
In my case R# ended up being the culprit, can be disabled here:
ReSharper > Options > Code Editing > Razor > Editor & Formatting
https://www.jetbrains.com/help/resharper/2016.1/Reference__Options__Languages__Razor__Editor.html
Unfortunately the only way to prevent autoformatting on paste is to comment out the location where you're going to paste some new code and after the pasting operation to remove the commenting instructions.
Search & Replace seems not to trigger auto-formatting. But pasting reformats the entire code block.
This is terrible beyond words. It makes Visual Studio IDE virtually unusable for Razor editing. One has to use an external editor for Razor files.
What's even worse, even the latest Visual Studio 2013 Update 1 crashes while editing Razor views all the time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With