From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#67262: python-ts-mode cannot identify triple-quoted-strings Date: Sun, 26 Nov 2023 15:43:22 -0800 Message-ID: References: <66A741A1-38B8-40C9-BE84-AF99F74A079F@gmail.com> <838r6vm3dj.fsf@gnu.org> <9bfc5e6f-3612-115f-a59d-35ad629bdf9e@gutov.dev> <83v89qcfsb.fsf@gnu.org> <9B8C904A-3729-44AF-82F7-3BEA849F46D0@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27877"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 67262@debbugs.gnu.org To: Dmitry Gutov , JD Smith , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 27 00:44:23 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r7OnW-00076g-Q9 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 27 Nov 2023 00:44:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7On8-0007K6-6q; Sun, 26 Nov 2023 18:43:58 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r7On6-0007JW-CD for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2023 18:43:56 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r7On6-0002VC-3m for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2023 18:43:56 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r7OnB-0007eR-Pm for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2023 18:44:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Nov 2023 23:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67262 X-GNU-PR-Package: emacs Original-Received: via spool by 67262-submit@debbugs.gnu.org id=B67262.170104222029368 (code B ref 67262); Sun, 26 Nov 2023 23:44:01 +0000 Original-Received: (at 67262) by debbugs.gnu.org; 26 Nov 2023 23:43:40 +0000 Original-Received: from localhost ([127.0.0.1]:42899 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r7Omq-0007db-89 for submit@debbugs.gnu.org; Sun, 26 Nov 2023 18:43:40 -0500 Original-Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]:45473) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r7Omm-0007dK-Js for 67262@debbugs.gnu.org; Sun, 26 Nov 2023 18:43:39 -0500 Original-Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-2851a2b30a2so2350948a91.3 for <67262@debbugs.gnu.org>; Sun, 26 Nov 2023 15:43:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701042204; x=1701647004; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=d0jwQ5H2+gY9BA7UuH5TACFS1IuRdZ1WlFiGQ1wDnjw=; b=MGz2lfnWgDSpnClrmBlRVvlanFVCHaZlNMDy5jkpwiqfW/U1ceTK69c/6DRroEMZ4t R+DE/S2u4dJGWRTFoUp5MkXz6BQhLx+5c43dfjWE/SKwc3jb9D3unfQxYtVy1ZqIO2Ev FcWDYAzcMtjOqiogDpNBXzOlgORj857QvHmVnJnMgDjJ9uAlojIFrAcnE6wgpw9adoFw +m12vU7WNyzLcEfUmmZi1oHtEsp7OT38FISO6vR3c94HpWnY/02XES2phRWJr+bR11Ce so62TeZiStbWBZvazFbL9warueDya/XZKFuE8K16S9CXKEzgVIKkGtFMp/s3S1xBHuC5 vPPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701042204; x=1701647004; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=d0jwQ5H2+gY9BA7UuH5TACFS1IuRdZ1WlFiGQ1wDnjw=; b=ejJ66ua90CCtXlS6xtUnRtXfWqmPzx0PZgTtFafccA03NO872tjc2mbYZNLdvkXy7r lbktTu9YQy1iTy0RB3biZJn1TsYDdC6JcHsyLu+uqPL+pqxxQu2OdxRqzAjvmXK6VwoT GM6jl2CkDxZRDOU1hCcbM8CMVy5x6HovlJpqido6bVZAPFwghxJahqRqRmd5aRaZM0TU Swwwj8bGuQfTNt/H2V23WvCIHkHFSrs4jnZu7dQ/sz/mvtV/1ZfVjDOVkws8lJYnFbUc brwchOUGyQonHQJZCbTjvWkLkM21XuqXfkvehM8fOdYhS/ZeNNaOiYJK/H9vpON9Q+tW 5NZQ== X-Gm-Message-State: AOJu0Yw925VyMvoCGFZwu9Ffxzvfc2bnvkl+YjKNuHL6djyS73/KisLK imm1Rof89Zyw6rkhOG1fASI= X-Google-Smtp-Source: AGHT+IH+e2nDJHfe0nxF2MH3oLr5vgSAnEK8gC6g2kO8C2Qu3qjdjLXz/NApUpLSDJUeGTXfxXvYTA== X-Received: by 2002:a17:90b:1d0f:b0:285:a2af:31aa with SMTP id on15-20020a17090b1d0f00b00285a2af31aamr3930702pjb.37.1701042204514; Sun, 26 Nov 2023 15:43:24 -0800 (PST) Original-Received: from [192.168.1.7] (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id gb20-20020a17090b061400b002808c9e3095sm6094106pjb.26.2023.11.26.15.43.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Nov 2023 15:43:24 -0800 (PST) Content-Language: en-US In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:275095 Archived-At: 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