you are viewing a single comment's thread
view the rest of the comments
[–] [S] 5 points 2 years ago (3 children)

Many code formatters decide whether to use " or ' based on some configuration and whether the default one would require escaping. So if you are using such a code formatter, this is no longer a deliberate choice unless you explicitly override the behavior with annotations.

I am not sure whether your solution of using a less intense color for the unchanged part of the string would make it clearer. It is just more similar to other diff tools that highlight the whole line with a less intense color if it contains changes.

  • source
  • parent
  • hideshow 6 child comments
  • [–] 4 points 2 years ago (1 child)

    Then with a code formatter you definitely want to show this change. In a normal usage the code formatter should ensure that this kind of diff can't happen, then it's useful to see if it was not used during a code review.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 2 points 2 years ago*

    would make it clearer

    Would make what clearer?

    If I change a string to a raw string or an interpolated string, it is a semantic change on the entire string, even if it leads to consequential changes only on subsections of it. The next time or additional changes I make must take different semantics into account.

  • source
  • parent
  • [–] 1 point 2 years ago

    If the formatting configuration forces one specific style then that is the deliberate choice; to have that one.

    If there is no uniform single string quoting it is useful to differentiate between them; for example if for normal strings ' is preferred while for specific cases where escaping characters like \n is required, " must be used.

  • source
  • parent