From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: treesit indentation "blinking" Date: Sat, 25 Mar 2023 09:05:26 +0000 Message-ID: References: <87h6ucik61.fsf@dancol.org> <0F406D08-56D4-4B21-B94D-A47681606911@gmail.com> <1870bcadd28.2829.cc5b3318d7e9908e2c46732289705cb0@dancol.org> <1870cce6690.2829.cc5b3318d7e9908e2c46732289705cb0@dancol.org> <35A837A9-59B4-4F1F-A5FA-8483C8024D76@gmail.com> <187104f6b48.2829.cc5b3318d7e9908e2c46732289705cb0@dancol.org> Mime-Version: 1.0 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="12465"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Daniel Colascione , Yuan Fu , emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Mar 25 13:59:33 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 1pg3Ua-000341-It for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Mar 2023 13:59:32 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pg3U1-0000qM-GB; Sat, 25 Mar 2023 08:58:57 -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 1pg3U0-0000oR-MD for emacs-devel@gnu.org; Sat, 25 Mar 2023 08:58:56 -0400 Original-Received: from mail-vs1-xe31.google.com ([2607:f8b0:4864:20::e31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pg3Tz-0005eb-23 for emacs-devel@gnu.org; Sat, 25 Mar 2023 08:58:56 -0400 Original-Received: by mail-vs1-xe31.google.com with SMTP id h27so3723841vsa.1 for ; Sat, 25 Mar 2023 05:58:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679749133; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=GQb9kKoKxrn+2kw1M+RhJv/guKmggvpOBjgpTKWv3N4=; b=PNZ+t/oZEV2SstAmm2SE9T7lGSVyQivvQJpwI4rP9e09ZU1Xdk4JMIFimtnpYw94ox JulT5AOs+S086rexOG21MjeJ28hsFJDpQsp2pvLc4bA1slJol94sLofvRn2tzAMXN+Bg 7y//QDn6LfNnaPoOGoCiHxXodOKRXe5ckl/jEYKR9AjQ30TXzJXITX9/+mUJ5R9ffwDh ggLWofiT2zRTs6HP4oGp8ubc/XfLKtw9jori+lxOd1ANHIxHPJXlsZeebNY3wobLT7G1 Rn6ESK8OjjbutNnD6m5tCKNOCJY/TUWjbstrg1MbgRZhYj7YXXGfasX7ETGtB1YdnBEJ XOIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679749133; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GQb9kKoKxrn+2kw1M+RhJv/guKmggvpOBjgpTKWv3N4=; b=YND9numM3XX+QmqAMmMrKlzxFTI9m3mzSIy6IkYVPja8NxsmwBCk1V4EiTAZfLPy8y 1bxYcZ32xFvUpXIyH2u0avrumV1r3Y/j5CfyDofzg6xOFtyu4cTsVdpjB3P+GEgE21S4 a9/hrrxGH3SpFxIzMXJB54gKXM04UTLrFlOsUnGgPEFnn8dfrDEs40SABXy+fygHA2dc iGE369qkXmowhtOiLXdQyf9mKrs/RMQ587S3GRCyhJCUYjbJ5EYLnkO13Bw7vmqGOykN 9FJabL84P/FfnKKiPedE0/bgTN6HU3EqfFtJO2nmpEIyaf3+65ckbjilQaGFC43ceWOO pU6Q== X-Gm-Message-State: AAQBX9c+Pk5CvHAfWprOKDVhoqo9e9xJHT+J1WoOb05MxGOmOzXel/PN LD7PcfjOffwhYl+PaxaoKmDZREhi3cbw1YzER0I5uOT05n0= X-Google-Smtp-Source: AK7set8UlUFe/cW45Vk6LJnKsrjglCD2tQbAJoPtotNVgSelQC6M1Gb2nBeaV53ccHXcCqGNfjK2wEHE1X0Sj5d7tZE= X-Received: by 2002:aca:6508:0:b0:384:420d:6671 with SMTP id m8-20020aca6508000000b00384420d6671mr1810816oim.5.1679735016488; Sat, 25 Mar 2023 02:03:36 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::e31; envelope-from=joaotavora@gmail.com; helo=mail-vs1-xe31.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, 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=no 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:304762 Archived-At: On Thu, Mar 23, 2023 at 9:24=E2=80=AFPM Dmitry Gutov wro= te: > > On 23/03/2023 23:10, Daniel Colascione wrote: > > Editing can cause all sorts of transient nonsense in the AST, and it's > > impossible to predict in a general manner what this nonsense might be. > > The wrong kind of bracket can cause the entire rest of the file to be > > parsed as nonsense. This or that error recovery rule isn't going to > > solve the problem: such a strategy is a fragile whack a mole. There > > needs to be some general solution to prevent indentation blinking. This > > blinking makes TS modules unusable for me. > > It seems to me it will only be feasible to support a number of > "incomplete" syntax constructs. Maybe it will constitute a majority of th= em. I don't think this problem has anything to do with tree-sitter. It would happen just as well in regular c++-mode if electric-indent-mode were on by default there (but it isn't). So it's just the fact that electric-indent-mode is on by default _and_ c-ts-mode.el does this: (setq-local electric-indent-chars (append "{}():;,#" electric-indent-chars)= ) so people are getting what the mode author (and Emacs defaults) ask for: electric indentation doing its thing. > Have you tried using electric-pair-mode, though? I'd hate to make it our > strong recommendation for all ts modes, but it does reduce the odds of > incomplete code a lot. Maybe you'd hate it, but it would at least be consistent with the setting for electric-indent-mode, which is much more jarring. See also bug#62412 which is basically the same problem with a recipe. Jo=C3=A3o