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: treesit indentation "blinking" Date: Wed, 22 Mar 2023 18:02:02 -0700 Message-ID: References: <87h6ucik61.fsf@dancol.org> <0F406D08-56D4-4B21-B94D-A47681606911@gmail.com> <1870bcadd28.2829.cc5b3318d7e9908e2c46732289705cb0@dancol.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.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="40587"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 23 02:03:27 2023 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 1pf9MV-000AM7-B6 for ged-emacs-devel@m.gmane-mx.org; Thu, 23 Mar 2023 02:03:27 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pf9LP-0000wh-6J; Wed, 22 Mar 2023 21:02:19 -0400 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 1pf9LN-0000wC-7D for emacs-devel@gnu.org; Wed, 22 Mar 2023 21:02:17 -0400 Original-Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pf9LL-0007Yv-46 for emacs-devel@gnu.org; Wed, 22 Mar 2023 21:02:16 -0400 Original-Received: by mail-pj1-x102f.google.com with SMTP id x15so9731919pjk.2 for ; Wed, 22 Mar 2023 18:02:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679533333; 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=Pb8LRIR2ZOR7bpdMqVWslQtdp+krKwCWJgVWyW4aUhQ=; b=TXFO7BP8WUfDKyl1Yn5Dbe1hLuor9D44kcsan23Nwx1F740UjsO6t3iqVORiw+2OdA QXZ93dVhmCmFxH0iTm7naTmz/YTgzV0uYbSnfMiAZ9iy9K6f27iXP2+8Zko7GKQxHeao fqYzM5dwS+Ud2qxYTYYhfh5t0gHme4B1tmr9QNURL3kUMKH4eRVf2hAZPDtCJVKKDek0 dVcO9fyh+sqAPmN1WiPzTxpRZUQ1dEWZy5qSIzlLgRSChi5ijWu8X18AXBWLuCCwXeBk LMmz1cAQbwn50Ib+LXZ0if1a1W2JraIBxr1qeHq77CASjYGuvFTIXWXJe1Vq1Rj2qV4R xv2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679533333; 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=Pb8LRIR2ZOR7bpdMqVWslQtdp+krKwCWJgVWyW4aUhQ=; b=gxYbnIDTmNs5lhtxeQ8vTvMhCoqQCMisd4qGEPolwguWaLpZ7KOwBhAZxnhe9ZnZq+ dKthPi++/pQkyNYrG9XxziwnkdpUS4LSMBi0hriPIR6W0q45fsxeOwASsg30fI14kmak UROhh3usxDP6f2SBC2uCIrShdmn+WM0flzm3VOZ7nuYQEvmI5B3F1IJ6oM8tQDk+jZzM TFcSJzsBIb8/d9suk7Da5FbjLexa5GsXmlSv8FVzYBY6bzw30uYlG56oUb3v4Hla+oTD nEdTCRXkVN4lrZj+oRcHC/9B1LNJtXeW2KmhPu6aRMdq/x/yWp6cjLtn/ZOglpPC82e9 uNQg== X-Gm-Message-State: AO0yUKW8oMb/qIfe/syjF6uZYtqAWYSMgdFAwH0bdCLFSx8ShyQQueDc RwCpGhN/hAEbwhGl3g+L4/SGP1E6j1c= X-Google-Smtp-Source: AK7set/tC7Mmyh1jTwJ0RJw/xhSldOUWVBt/2KFCzU24h6GIFpBcSgMMp+wVA3OWnpPlU764VbNXsw== X-Received: by 2002:a17:902:e744:b0:1a1:b11d:6af5 with SMTP id p4-20020a170902e74400b001a1b11d6af5mr5432200plf.52.1679533333416; Wed, 22 Mar 2023 18:02:13 -0700 (PDT) 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 v16-20020a17090331d000b001a1ca65f434sm7263122ple.189.2023.03.22.18.02.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2023 18:02:13 -0700 (PDT) In-Reply-To: <1870bcadd28.2829.cc5b3318d7e9908e2c46732289705cb0@dancol.org> X-Mailer: Apple Mail (2.3731.400.51.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=casouri@gmail.com; helo=mail-pj1-x102f.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:304729 Archived-At: > On Mar 22, 2023, at 5:07 PM, Daniel Colascione = wrote: >=20 >=20 >=20 > On March 22, 2023 20:00:23 Yuan Fu wrote: >=20 >>> On Mar 22, 2023, at 1:49 PM, Daniel Colascione = wrote: >>>=20 >>> Is there a general-purpose through which we can avoid line = indentation >>> oscillating as the user types when the AST is temporarily invalid, >>> e.g. after '(' or '{'? I'm checking out the C++ tree-sitter mode, = and >>> one of the more disconcerting things is the current line's = indentation >>> changing rapidly as I type. Is it feasible to create ERROR recovery >>> indentation rules for every conceivable situation? >>>=20 >>=20 >> Yes, but in reality, I think all we need is a couple special case for = the unmatched ( and {=E2=80=99s. Can you think of other cases of = blinking indentations? >>=20 >> Yuan >=20 > But TS reacts to missing closing brackets by clarifying the whole = nearby expression as ERROR. It's not, as would be more useful, saying = "here's a stray (, and everything else is normal and parsed as if that ( = were absent=E2=80=9D We can just look at the buffer text directly: if there=E2=80=99s an = ERROR and the previous char (after skipping whitespace chars) is ( or {, = we know what to do. Yuan