Subject: bug#75580: 30.0.93; statements inside string interpolation for csharp modes are fontified incorrectly

From: Jostein Kjønigsen <[email-masked]>
Date: Sat, 1 Feb 2025 13:06:19 +0100

I don’t remember exactly why things ended up the way they did to be honest. 

I tried tweaking around with the rules to see if I could get better results, but ended up with different kinds of regressions. 

Fixing this will take a little effort, and recently my attention was at resolving and closing 2 simpler bugs, just to get them out of the way. 

With those 2 out of the way, I might have more time to invest in this one.  

--
Jostein Kjønigsen
https://jostein.kjønigsen.net

> On 1 Feb 2025, at 12:43, Eli Zaretskii <[email-masked]> wrote:
> 
> Ping! Theo and Jostein, could you please comment?
> 
>> From: Yuan Fu <[email-masked]>
>> Date: Fri, 17 Jan 2025 23:56:51 -0800
>> Cc: Sami Batuhan Basmaz Ölmez <[email-masked]>,
>> [email-masked],
>> Theodor Thornhill <[email-masked]>,
>> Jostein Kjønigsen <[email-masked]>
>> 
>> 
>> 
>>>> On Jan 16, 2025, at 7:42 AM, Eli Zaretskii <[email-masked]> wrote:
>>> 
>>>> From: Sami Batuhan Basmaz Ölmez <[email-masked]>
>>>> Date: Wed, 15 Jan 2025 08:02:50 +0000
>>>> 
>>>> An interpolated string `$"string content {myFunction(myVariable)}
>>>> another string content"` are highlighted incorrectly as expressions
>>>> inside brackets are also fontified with string face for csharp-mode and
>>>> csharp-ts-mode. They should be fontified like statements.
>>>> Interpolation occurs inside curly braces.
>>> 
>>> Thank, but could you please post a minimal C# source file that
>>> exhibits this behavior?
>>> 
>>> Yuan, any comments about this?
>> 
>> The direct cause is that the font-lock rules for strings have :override flag, and string face is applied on the whole string, overriding whatever fontification the function invocation had. But the string rule has :override for a reason, the Theo and Jostein should know more.
>> 
>> Yuan