this post was submitted on 04 Feb 2025
38 points (97.5% liked)

Programming

18304 readers
241 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] Kissaki@programming.dev 25 points 2 weeks ago* (last edited 2 weeks ago) (6 children)

"" to '' … There is nothing to highlight for SemanticDiff.

Really? I definitely want to see that. I want to be deliberate about my code. I am not only targeting compiled code. I am also targeting developers through maintainable code.


I'm surprised they did not list an alternative that would be my preference: Highlight the entire string. The f prefix changes the entire text value type. I would like the `f´ to be highlighted strongly, and string it changes the interpretation of weakly, and the placeholder variable more strongly again.

[–] DarkPlayer@lemmy.world 5 points 2 weeks ago (5 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.

[–] Kissaki@programming.dev 2 points 2 weeks ago* (last edited 2 weeks 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.

load more comments (4 replies)
load more comments (4 replies)