This is an odd one. I've noticed this in a few languages, not just SQL, but sometimes the highlighting just doesn't work on the entire code block. This appears to happen more when the code snippet isn't complete on it'sits own (and so isn't valid syntax on it'sits own).
SUM(CASE WHEN SIPCOD in ('001','500') or (SIPCOD = '013' and SISHCD = 'OTA')
THEN 1
ELSE 0
END) -
SUM(CASE WHEN SIPCOD in ('501','502') and SIHRS >= 3.0
THEN 0.5
ELSE 0
END) as [Days Worked]
Even with the language defined (both with sql or lang-sql), the first line to receive syntax highlighting is the 4thfourth line (END) -),; the prior lines have no highlighting. ImageThe image below is from SO Dark Theme:
I'll try and repro this with some other languages and edit it in, or if I see other examples (I'm sure I've seen at least 1one C# and PowershellPowerShell example over the weekend on my mobile).
This is SQL again, however. However, this one doesn't highlight the last line, for some reason:
Apologies, this is SQL again, but the highlighting is all kinds of wrong in this code block. It starts, then suddenly stops, and then picks up again it the oddest place:

