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

From: JD Smith <[email-masked]>
Date: Sat, 18 Nov 2023 12:18:02 -0500

> On Nov 18, 2023, at 11:29 AM, Eli Zaretskii <[email-masked]> wrote:
> 
>> From: JD Smith <[email-masked]>
>> Date: Sat, 18 Nov 2023 10:52:05 -0500
>> 
>> Inside this triple-quoted string, in a python buffer:
>> 
>> a = """This is a test"""
>> 
>> python-mode yields (python-info-triple-quoted-string-p)=t, whereas python-ts-mode gives nil,
> 
> Can you figure out which part of python-mode's initialization makes
> the above work correctly, and why?  Then we could discuss whether
> moving that part into python-base-mode is TRT.

I took a look. It’s `syntax-propertize-function' that is not being setup.  From a buffer in `python-ts-mode', this reenables triple-quote recognition:

(progn 
  (setq-local syntax-propertize-function python-syntax-propertize-function) 
  (syntax-ppss-flush-cache (point-min)))

Note that `python-syntax-propertize-function' mentions `python-syntax-stringify', which scans the syntax for triple quotes and marks their 'syntax-table.  I am not sure whether this was an oversight, or was omitted purposefully from the body of python-ts-mode.