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.devel Subject: Re: Tree sitter support for C-like languages Date: Mon, 14 Nov 2022 00:23:20 -0800 Message-ID: <186915C1-1C47-43DC-A386-B447A2E7528D@gmail.com> References: <87tu36em9t.fsf@thornhill.no> <45FD2F78-F15B-488B-9348-A8E298D8AD35@gmail.com> <87v8nmyqqp.fsf@thornhill.no> <834jv4nz2g.fsf@gnu.org> <871qq8hsj1.fsf@thornhill.no> <83iljklzmo.fsf@gnu.org> <87v8nkgcqj.fsf@thornhill.no> <87sfiogcbm.fsf@thornhill.no> <83pmdrkyj7.fsf@gnu.org> <87v8njw5th.fsf@thornhill.no> <83leofkwjm.fsf@gnu.org> <9E9244D3-2EFB-4621-91E0-FC8B8C1C2D52@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22387"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , Theodor Thornhill , emacs-devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Nov 15 01:13:07 2022 Return-path: Envelope-to: ged-emacs-devel@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 1oujZb-0005et-IW for ged-emacs-devel@m.gmane-mx.org; Tue, 15 Nov 2022 01:13:07 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ouiqV-00039J-34; Mon, 14 Nov 2022 18:26:31 -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 1ouih4-0005x0-Sl for emacs-devel@gnu.org; Mon, 14 Nov 2022 18:16:47 -0500 Original-Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ouUkX-0002eo-Bl; Mon, 14 Nov 2022 03:23:26 -0500 Original-Received: by mail-pj1-x102c.google.com with SMTP id v4-20020a17090a088400b00212cb0ed97eso9901184pjc.5; Mon, 14 Nov 2022 00:23:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=eJ3JJt9vuxl3i3ENS6c1TtD/Zq8xUicW+fQiYZXK3jo=; b=qdM7pc2VTDGUtCJklXSkXniO1T2vQqx38O01lv1R0EvPXz+RpWRtBkWNp/9KV0x1Yp v1VFRJuKvbZP7LIcRu4ZG44SRnj5kUFfRTIFb1AsVMXpVO9ql4N2ApA39hd6RMCYwaVR lVOmWFpqexjf6plH80yyMnMVDkeJNgD+gIR1Gu49fY2cPair7VDidNjdwILpALonvg06 FvMDjx+T8sXEipmK3vkGVengLlWnZrLW6kWcA/JqS9uuJveCbgLGdA0KSo3IHdEXvRjU FvIjdZnrdlfUbgMB13zqljKXkTXb4LN7WOzWojLNnkoUZ/h+kzZ++BoaAIC8SfGlX+kz WH9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eJ3JJt9vuxl3i3ENS6c1TtD/Zq8xUicW+fQiYZXK3jo=; b=F8QQmXy9W/z9Sh4bmv3ybUs7hAo/SvMsvj40ekEd2Gnc9CKidJk5EmwBh3Fxed9RQV Yh4Lic+cwwGtV+xDE9Ar+Kt+/5XqiJFBftm/B3L2YMDeVw6wKI7zazefJ5huA6WZtrYU yUw/X/XUkPtkXXUS+7sc7oK2ula2Y4cGRSdcT2CX3y2N9yG800fDyvZV03+FfP7WjTrp /eCltSE4xJpRInju2h+y5ECZQ9SZdGKrhXAc+vQcPcu1rONmSS/9CxmUP+K/bm0FcyvR GSgi7vQDKX8eZPsjd2R8iXazyNDcw11rbUrreWZkmiixWjM6D07FRbkai9YiU/BMco09 8vNw== X-Gm-Message-State: ANoB5ply7XuX1WKPhq5cSiItBxvNV9FUMRvm66DUyFRCrohOik8/t4sX Ef00qsWhXnsCaWwLWa4iBIk= X-Google-Smtp-Source: AA0mqf6EHTo/lmQA9lbe0viNVInGqQIg7mH8c6wUnpLB4D0QSRd/JoGj7CC7j6iYxRZzUxb+O4A2NA== X-Received: by 2002:a17:90a:db50:b0:214:e1:cabe with SMTP id u16-20020a17090adb5000b0021400e1cabemr12883819pjx.153.1668414203203; Mon, 14 Nov 2022 00:23:23 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id k18-20020aa79d12000000b0056bb0357f5bsm6065536pfp.192.2022.11.14.00.23.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Nov 2022 00:23:22 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=casouri@gmail.com; helo=mail-pj1-x102c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:299788 Archived-At: > On Nov 13, 2022, at 7:48 PM, Stefan Monnier = wrote: >=20 >> The parse tree has errors and it fontifies int in warning face. >>=20 >> Then when you insert the closing bracket, the parse tree is complete >>=20 >> int >> foo (void) >> { >> int bar =3D 0; >> } >>=20 >> Int is still in warning face because jit-lock doesn=E2=80=99t know it = needs to be >> refontified. >=20 > Doesn't tree-sitter tell us that the node for `int` has changed? Yes and no, but mostly no. Tree-sitter can tell if a node =E2=80=9Chas = changes=E2=80=9D. But you need to keep the node updated as the buffer = changes, which we currently don=E2=80=99t do. Even if we add this = feature, I don=E2=80=99t know if =E2=80=9Chas changes=E2=80=9D includes = =E2=80=9Cpreviously inside an ERROR node but not anymore=E2=80=9D. IIUC = =E2=80=9Chas changes=E2=80=9D means =E2=80=9Ccorresponding text = edited=E2=80=9D. I need to add this feature and experiment with it to = figure out what does =E2=80=9Chas changes=E2=80=9D mean exactly. Keeping some nodes updated (ie, =E2=80=9Cwatch=E2=80=9D those nodes) = isn=E2=80=99t too hard to implement, but it wouldn=E2=80=99t be a = trivial change. I don=E2=80=99t know if we want to introduce non-trivial = changes now. Yuan=