I suggest you ...

Put an option to disable indentation after pasting code

Vertically line up arguments of a function call. Then copy the block of code. Paste it somewhere else. The allignment which you carefully made is all gone. You have to do the same custom formatting every single place you paste your code.

Unfortunately, there is no way of preventing this in Visual Studio 2015. I checked for a solution on the internet. Most people are complaining about the same problem and there is no cure.

Please provide an option for disabling this behavior.

3,265 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    HanHan shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    20 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Kristian HellangKristian Hellang commented  ·   ·  Flag as inappropriate

        Just being able to temporarily disable "format on paste" by having a separate "raw paste" shortcut, like Ctrl+Shift+V, would go a long way...

      • Vuong HoangVuong Hoang commented  ·   ·  Flag as inappropriate

        I thinks the visual studio developer used strong computers so they never feel as you - crazy, when I always have to type Ctrl-Z a lot !

      • andreszsandreszs commented  ·   ·  Flag as inappropriate

        Pressing Ctrl+Z undoes the formatting. Also, you can customize the VB formatting to match whatever styles you want, so why would you want different formatting styles on the same file? This idea makes no sense.

      • daviddavid commented  ·   ·  Flag as inappropriate

        Please add this option. It drives me crazy, when I always have to type Ctrl-Z

      • Alexander MartensAlexander Martens commented  ·   ·  Flag as inappropriate

        Ctrl+z undoes the autoformatting. Don't you think the autoformatting is more useful than annoying after pasting a lot of code? Wouldn't having to toggle this rather than undoing formatting on a per case basis end up being more annoying than helpful?

      • tsahitsahi commented  ·   ·  Flag as inappropriate

        If your method takes so many parameters they need to be listed vertically, you should consider refactoring it to smaller methods, or use a DTO.

      • AnonymousAnonymous commented  ·   ·  Flag as inappropriate

        If all the auto-formatting in turned off in settings, my code should stay exactly where I type it...period.
        Forget about how I SHOULD be formatting, it boils down to my choices. It I tell the editor "don't do it", I expect it work. In previous versions it worked fine and does not auto-format. Bottom line is, it's broken in VS 2015.

      • Dinesh ygvDinesh ygv commented  ·   ·  Flag as inappropriate

        Even after unchecking Tools\Options\Text Editor\C#\Formatting\Automatically format pasted code, it still formats after pasting. This could be a bug.

      • cbhackingcbhacking commented  ·   ·  Flag as inappropriate

        What Kevin said... this option already exists, has existed for years, did you even check the Options panel's Formatting sections? I mean, it's a big thing to check, but it's also the obvious place for this.

      • William MoussiauxWilliam Moussiaux commented  ·   ·  Flag as inappropriate

        It's 'my' code.

        I'll format it however I choose, not how someone else thinks it should be.
        The editor should not touch my code unless I say it can.
        There's no reason I should have to Ctrl-Z or any other function to undo what I didn't want done to start with.

      • ChiramisuChiramisu commented  ·   ·  Flag as inappropriate

        I'm sure you have your reasons, but I'm not sure why you'd want to do this. One should use proper formatting and indentation to make the code more standardized and easy to read by other developers who are also used to seeing the code displayed in that way. ;)

      • tsahitsahi commented  ·   ·  Flag as inappropriate

        I would be worried that you are copying and pasting code. Keep your code DRY.

      • JonathanJonathan commented  ·   ·  Flag as inappropriate

        Whenever this happens to me I do Ctrl+Z which undoes the formatting without undoing the pasting.

      • AnonymousAnonymous commented  ·   ·  Flag as inappropriate

        Does control-z help? Sometimes when I paste, I can press control-z to undo the new formatting, and pressing control-z a second time will undo the paste.

      Feedback and Knowledge Base