bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Yuan Fu
Subject: bug#67262: python-ts-mode cannot identify triple-quoted-strings
Date: Sun, 26 Nov 2023 15:43:22 -0800
User-agent: Mozilla Thunderbird


On 11/26/23 6:58 AM, Dmitry Gutov wrote:
On 26/11/2023 04:04, Dmitry Gutov wrote:
As for what to do about this one -- probably something involving syntax-propertize-extend-region-functions, adding an entry which would initialize the parser, but not call syntax-ppss-flush-cache directly (or at least not just that). It would signal the earlier position to extend to through some dynamic variable. This is getting tricky enough to move from the individual major modes into treesit.el proper, I think.

Alternatively, we'd trigger updates eagerly from within treesit_record_change -- that would make it slower, invalidating the comment above it. Not sure by how much, though.

It seems to me that what we need is to force a re-parse at the beginning of syntax-propertize or in syntax-ppss-flush-cache; the re-parse would cause the notifier to run, which runs python--treesit-parser-after-change.

I'm not quite sure about how do we cause this re-parse. The straightforward approach would be calling treesit-force-reparse[1] in syntax-propertize/syntax-ppss-flush-cache. But ideally I'd like to keep tree-sitter transparent for syntax.el. Maybe we can add a hook in syntax-propertize/syntax-ppss-flush-cache.

[1] This function doesn't exist yet, but it's easy to define in lisp.

Yuan







reply via email to

[Prev in Thread] Current Thread [Next in Thread]