Open petr-tik opened 2 years ago
This seems like intended behavior. At the very least, I like that it functions the way it does currently!
I often use dbg!() for debug printing and found it confusing when dbg!() printed a method that returns true, but the branch wasn't actually taken, because the negation operator outside dbg!() converted the value to false. I would find it more obvious, if the dbg postfix completion included negation by default to prevent such surprises.
This also happens with .if
completion.
Ye if
is a definite contender here as well, we should look at all the postfixes and check where checking the precedence might make sense
Expected
Calling the postfix dbg completion on a negated expression will wrap the whole expression including the negation operator.
Observed
When the postfix dbg completion is requested, the original negation operator remains outside the freshly inserted dbg!() macro.
Repro
Version info
using lsp-mode in doom emacs, if that's relevant.