I suggest you ...

Add an 'Ignore space...' for all format options

Autoformat can be great, but it can also greatly work against when you have some exceptions.

Please add option to turn off all whitespace autoformatting.

I never hit accidentally the space button, and I'm also perfectly well to press the space button when I do want a space.

169 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…)
    Dirk Boer shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    8 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...
      • Anonymous commented  ·   ·  Flag as inappropriate

        I'd like to have this fixed as well. I'm using a style where { is at the end of the line, and Visual Studio 2015 insists on inserting a space before it, which drives me nuts. Even Monodevelop has an option to disable this.

      • Anonymous commented  ·   ·  Flag as inappropriate

        @Yane Nekam
        Sorry, I got off track, and was thinking about disabling it in specific areas. I definitely think disabling it for the whole language should be an option (and further, disabling specific parts of the formatting). It might also be possible to disable it for certain files in VS.

      • Yane Nekam commented  ·   ·  Flag as inappropriate

        @Anonymous (June 28)
        We're talking about spacing in the Editor - not the output. This should be a consistent setting within the IDE for a certain language (C#, ...) and not parts of the code. A developer won't change his or her coding style for certain ifs.

      • KNX commented  ·   ·  Flag as inappropriate

        Also default values for method parameters are affected.

        public void MyMethod(bool fix=true)

        is formatted to

        public void MyMethod(bool fix = true)

      • KNX commented  ·   ·  Flag as inappropriate

        Also inline-if statements are formatted with a white space ...

        return hasResult?1:0;

        is formatted to

        return hasResult ? 1 : 0;

        Please fix that - give us an option to disable the insertion of white spaces!

      • Yane Nekam commented  ·   ·  Flag as inappropriate

        Visual Studio automatically adds spaces here:

        Code:
        void calc()
        {
        using (FancyCalculator calc=new FancyCalculator())
        {
        // ...
        }
        }

        Code AFTER Format Document
        void calc()
        {
        // WRONG SPACES INSERTED HERE!!!
        using (FancyCalculator calc = new FancyCalculator())
        {
        // ...
        }
        }

      • Alex commented  ·   ·  Flag as inappropriate

        @NeoKenshinX

        yeah, I can also reproduce this issue you're talking about.
        @vsstudioteam can you please add an option to disable to add a space here? (usings)

      • Anonymous commented  ·   ·  Flag as inappropriate

        I would also like to disable all whitespace autoformatting. My specific case is the automatic added space between an end parenthesis and an opening curly brace: "public void doStuff() {" -- I need an option to turn that off.

      Feedback and Knowledge Base