How can we improve Azure DevOps?

pull request diff ignore whitespace

This suggestion is migrated to Developer Community. Please use below link to view the current status.
https://developercommunity.visualstudio.com/content/idea/365666/pull-request-diff-ignore-whitespace.html
When comparing pull request changes, could the whitespace be ignored in the file diff tab.

110 votes
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)

    We’ll send you updates on this idea

    Anonymous shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    We’re starting to take a look at this feature, and have some questions about exactly what people are expecting from this suggestion.

    Currently, the pull-request diff experiences ignore leading and trailing whitespace by default. For example, if only the indentation of a line changed, that line will not be highlighted as having any changes. This leads us to believe that this suggestion is about some other whitespace diffing behavior.

    We have some ideas about what this might mean, but we want to hear from our users. If you have any insights you wish to share to help us better understand this suggestion, please reply to this email and let us know.

    Thank you!

    20 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • Samuel Huet commented  ·   ·  Flag as inappropriate

        What I'm looking for is the ability to ignore any space character modification in a file. I'm talking about spaces added or removed by a file format function or when a generation tool decide to add a trailing space at each line in a file. In those situtations, it is very hard to spot real diff from added or removed spaces.

        The best would to have a toogle button to activate or ignore the spaces in file diff like they have in Atlassian BitBucket.

      • Rich Evans commented  ·   ·  Flag as inappropriate

        Changes to spacing within a line such as others have mentioned below:
        if (something) -> if ( something )

        also, conversion to/from tabs/spaces.

        In the file list there should be an option to toggle visibility of files with whitespace changes only, as well as the ability to hide lines in a file which contain only whitespace changes

      • Andy commented  ·   ·  Flag as inappropriate

        If two users don't have the exact same spacing settings in Visual Studio. A pull request will basically mark an entire file as changed. Below is an example that gets flagged as changes in a Pull Request.

        --Original code
        if(someVar==someOtherVar)
        callSomething();

        --Change code
        if( someVar == someOtherVar )
        callSomething( );

      • Anonymous commented  ·   ·  Flag as inappropriate

        When reviewing PRs, some changes can be pure whitespace formatting changes... such as:

        if (something) -> if ( something )

        It would be very useful to have the option to ignore (or not) these changes when reviewing pull requests.

        I think all whitespace should be treated the same in this regard (leading, trailing, mid-line, etc) -- have the ability to ignore all of it or none of it.

        Also, keep in mind that indentation matters for languages like Python, so you shouldn't ignore such changes by default...

      • Kris commented  ·   ·  Flag as inappropriate

        This would be amazing to have -- automated linters are great, but they end up making PRs really difficult to read and make it harder to find the 'actual' changes in the code.

      • Pieter commented  ·   ·  Flag as inappropriate

        It should be an option, toggle or something that you can switch on and off. It should be available on all compares, so also on reviewing changes before commit

      • Swarna commented  ·   ·  Flag as inappropriate

        Need this feature to avoid going through long lines of formatted code

      • Andy commented  ·   ·  Flag as inappropriate

        I have shifted most of my code reviewing to VSO, but when there are a plethora of whitespace changes, I literally do the diff in tortoisegit because it has the ignore white space option.

      • Oded Ha commented  ·   ·  Flag as inappropriate

        This is extremely important in my opinion. Sometimes developers select the entire document and let the editor auto-format the code. This fills the file with white space changes. Then its very hard to find the actual code changes and easy to miss stuff during the PR.

      • Hari commented  ·   ·  Flag as inappropriate

        If this is added, I hope there will be a toggle-button somewhere. Sometimes, whitespace differences are not unimportant.

      Feedback and Knowledge Base