1. Syntax Coloring (partially working)
Under menu Edit > Preferences > Appearance > Syntax Coloring > Errors and Warnings
, turn on Possible unwanted assignments
. This will make =
in Solve
red.
However, as explained by @Itai Seggev, this doesn't work for Which
due to a bug. It can be fixed, but it will unfortunately work only for the first argument (which is apparently also a known but not yet fixed bug):
Unprotect[Which];
SyntaxInformation[Which] = SyntaxInformation[Which] /.
("ColorEqualSigns" -> _) -> ("ColorEqualSigns" -> System`Odd);
Protect[Which];
2. Operator Rendering
For versions 12.3.1+, you can use OperatorRenderings
to set more distinct characters for Set
, Equal
and SameQ
. There is a whole variety of interesting Unicode symbols that resemble =
, such as = ﹦ ⩶ ≝ ⌯ ⩸
. You can probably find your own combination of symbols which will help you in easier differentiation between them.
opR = AbsoluteCurrentValue[$FrontEndSession, {StyleHints, "OperatorRenderings"}];
opR["="] = "≜";
opR["=="] = "≡";
opR["==="] = "≣";
CurrentValue[$FrontEndSession, {StyleHints, "OperatorRenderings"}] = opR;
SyntaxInformation[Which]
seems to indicate that equal signs of odd-index arguments should be colored. But they're not. The setting"ColorEqualSigns" -> OddQ
is not documented and seems not to work. A bug? Ask WRI. $\endgroup$"ColorEqualSigns" -> System`Odd
should color=
at odd-index arguments, but it colors only the first argument. (So it's a known bug since 2017.) $\endgroup$