From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: treesit indentation "blinking" Date: Sat, 25 Mar 2023 14:42:50 +0200 Message-ID: <21d018e5-a730-12e3-f97c-fffa4f646ccf@yandex.ru> 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; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34341"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Cc: Daniel Colascione , Yuan Fu , emacs-devel@gnu.org To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Mar 25 13:43:44 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 1pg3FI-0008jV-KZ for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Mar 2023 13:43:44 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pg3Eb-0007l9-J9; Sat, 25 Mar 2023 08:43:01 -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 1pg3EZ-0007jA-DA for emacs-devel@gnu.org; Sat, 25 Mar 2023 08:42:59 -0400 Original-Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pg3EX-0000L4-HQ for emacs-devel@gnu.org; Sat, 25 Mar 2023 08:42:59 -0400 Original-Received: by mail-wr1-x42f.google.com with SMTP id r11so4228478wrr.12 for ; Sat, 25 Mar 2023 05:42:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679748174; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=ZnQ2Ro4S0bzyzGC4/mnMrZyXk5iv2gd/mjnhNUzef+I=; b=Ni32lTD1+KSpqWOH5f7xFObgEhbKd9HHjF7z+HrYxncnx/7jzEHtbPgEiHgNqmFC70 QeDef0ji9+BI/i/BPwT/YTjnwau2nC4EKXOz6edJAgc2kvLei4b0Mxip04Jza7lGL0y2 L+sCvZy7TszB4d/3+/o5inJSgeh0YxBkAN7dAGpaYfHQFgwOZnqtqJSHojnTehV7O6kn QdlNwIY4i0C/tFGXi87+enJs7GQiZvPjZEYin5Lqj9tk+EcKRe802fzhpTJHOsXSdBIv OFPi0Ac819i73fFs971+TLi80ShfZ24hEkD45zGvvWxGwRLuIHwulb79bFmksHmeyw+C 4HTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679748174; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ZnQ2Ro4S0bzyzGC4/mnMrZyXk5iv2gd/mjnhNUzef+I=; b=5SzBk2jb2lMIPAC9tWxEaanQ2ZBEo1oPCLvW922WUAtC9fZvew/dLeh+lZ4clY/Rix NMnBFboly/jA30xGTcWZtVSESsprvrSt7NaVPn33E1ydCgCRpr0+QmlVaCqxIZrWIsmg BC6/pFg32Elw48uNHRCNM1qYOGYPTpGW5EBD+wS9ylTraSgXIra/ESDj5pts78t8YlNB vfrO041I+EAoqMLevgMLM996vzyqqr93YbUI0+J9QCVZvWjx6whYJ+BXp+yofh2KCpuE yQyGVex5MMlhJbT3dWxTYyQeva9WKNNMAWVU/qaajvLdKB4AFKIy0PqLb0gf1NU6Pqv3 +Uew== X-Gm-Message-State: AAQBX9fFFhWfHznXjMbskvBzNxHDuKNTuBYCdCjNyqwHlsi7rGFkT1SK uq+uVWqtqaALDpS2YBWmHoI= X-Google-Smtp-Source: AKy350Yksk+LLQ5NTDNp4NAkvalESbqcUGWAC55JdwEdq8FUR3ki6JMWdJvfoEbUTXrNxw3siKPEzQ== X-Received: by 2002:adf:f8c5:0:b0:2d2:f3e3:114e with SMTP id f5-20020adff8c5000000b002d2f3e3114emr4371584wrq.30.1679748173835; Sat, 25 Mar 2023 05:42:53 -0700 (PDT) Original-Received: from [192.168.0.2] ([85.132.229.92]) by smtp.googlemail.com with ESMTPSA id o17-20020a056000011100b002d30fe0d2fcsm20574213wrx.13.2023.03.25.05.42.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 25 Mar 2023 05:42:53 -0700 (PDT) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=raaahh@gmail.com; helo=mail-wr1-x42f.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-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:304761 Archived-At: On 25/03/2023 11:05, João Távora wrote: > On Thu, Mar 23, 2023 at 9:24 PM Dmitry Gutov wrote: >> >> 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 them. > > 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). The mode is globally on by default, but indeed the contents of electric-indent-chars are much shorter there. > 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. Good point: perhaps either this list should be revisited, or predicated (at runtime) somehow on electric-pair-mode being enabled. >> 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 Not really, just a figure of speech. But not everybody will like it, I suspect. , 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. Yep.