No announcement yet.

Possible to ignore tabs in Java multi-line comments?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Possible to ignore tabs in Java multi-line comments?

    I have set 'Comments' to be important for Java source compares
    so that I don't miss any important documentation any developer
    has entered in the file.
    However, I am getting false-positives due to tab/space differences
    within a multi-line Java comment:

    19    /* 1) Template was deleted, or
    20     * 2) Template was updated, or   <- these three lines in highlighted red
    21     * 3) Bogus record exists in DB  <- but only difference is tab vs. space
    22     */                              <-  before the '*' character
    i.e. one version of the file has:

    19 - four spaces
    20 - 1 tab then 1 space
    21 - 1 tab then 1 space
    22 - 1 tab then 1 space

    while the other version has had its tabs converted to four spaces:

    19 - four spaces
    20 - five spaces
    21 - five spaces
    22 - five spaces

    Any suggestions on how to handle this?

  • #2

    Whitespace within an Important grammar will be marked as an important change if there is a difference. You could delete the "Comments" grammar element (or make a cloned copy of the file format, and delete the grammar from the cloned copy). This would revert the text to "Everything Else" text, which can mark whitespace as unimportant while the text itself would be important.

    Adding the ability to mark whitespace as unimportant within grammars is on our wishlist.

    With Java files, you could also process them with an external conversion to tidy the whitespace. This would actually alter the files, giving them the same whitespace characters, and is available for download in our Alternatives section, here:
    Beyond Compare is a multi-platform utility that combines directory compare and file compare functions in one package. Use it to manage source code, keep directories in sync, compare program output, etc.
    Aaron P Scooter Software