Subject: bug#67262: python-ts-mode cannot identify triple-quoted-strings

From: Eli Zaretskii <[email-masked]>
Date: Sat, 23 Dec 2023 11:52:11 +0200

Ping!  Can we please make further progress here to resolve this issue?

> Date: Sun, 17 Dec 2023 15:46:29 +0200
> Cc: Eli Zaretskii <[email-masked]>, JD Smith <[email-masked]>,
>  [email-masked]
> From: Dmitry Gutov <[email-masked]>
> 
> On 17/12/2023 01:36, Yuan Fu wrote:
> > How do you think of this patch? This extends the patch in bug#66732, and adds correct text property to the quotes (I think).
> 
> I do believe the common pattern should be followed here: a 
> syntax-propertize-function and a call to syntax-ppss-flush-cache to 
> invalidate when appropriate. See my patch in this bug for reference.
> 
> The reasons are performance (deferring work) and keeping state 
> management logic in one place.
> 
> With your patch in particular, try this:
> 
> 1. Type """foo -- no text properties.
> 2. Add """. Check the 3rd and 4th quote characters with 'C-u C-x ='. 
> Both should have the (15) 'syntax-table' text property applied.
> 4. Backspace. Syntax highlighting changes -- the string is not 
> highlighted now (that's good, I guess). But both 3rd and 4th quote chars 
> retain the text property. (python-info-triple-quoted-string-p) still 
> returns the same value, and, more importantly, (syntax-ppss) does too.
> 5. Backspace 2 more times (the text in the buffer is now '"""foo'). The 
> 4th quote is gone now, but the 3rd still has the text property.
> 
> (nth 3 (syntax-ppss)) still returns t, and 
> (python-info-triple-quoted-string-p) still returns the same value.
> 
> On steps 1 and 5 the buffer contents are the same, but the syntax-table 
> properties are different.
> 
> > It doesn’t handle the case of “””””” (no content inside the quotes), but I think that’s fine?
> 
> It might be important for some callers of 
> (python-info-triple-quoted-string-p). But it should be pretty easy to 
> fix, now or later.
>