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: More Tree Sitter Questions / Problems. Date: Mon, 26 Dec 2022 18:24:27 +0200 Message-ID: <0da3ad1b-032d-ac8c-6f0a-ca2353b34cff@yandex.ru> References: <365D3BA2-298F-4B99-9707-FE8BC658701F@easesoftware.com> 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="653"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 To: Perry Smith , emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 26 17:25:13 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 1p9qHo-000AXn-RK for ged-emacs-devel@m.gmane-mx.org; Mon, 26 Dec 2022 17:25:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9qHC-0005Qw-LL; Mon, 26 Dec 2022 11:24:34 -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 1p9qHA-0005Qn-Q7 for emacs-devel@gnu.org; Mon, 26 Dec 2022 11:24:32 -0500 Original-Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9qH9-0001hT-81 for emacs-devel@gnu.org; Mon, 26 Dec 2022 11:24:32 -0500 Original-Received: by mail-wm1-x334.google.com with SMTP id k26-20020a05600c1c9a00b003d972646a7dso4381739wms.5 for ; Mon, 26 Dec 2022 08:24:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=3194WT1isFRD7jh7T85CXAlVE9U3LdczY3Cep4jikUg=; b=MBBCtc6ksQ6oNHrU8D0XDYGk/0jo5Ck4XfbKOPEXMYAEs1iVDMKVSX8oXB41w9cijH fcPT4DGtTy4aRbwHgiWeLOJHHEEkb5S+Cpcjm9KV5z5fHHzVf/OuT2YFEweGA36KQA88 sfUivc/TdITV814g+lyLlXpFAZb31VgEYiL470E1l/pGEVY8NhGyx/RKr1eA3temyhaj Fk0HTtOCeSQPU5KCqTFLcZQK37X+WSzJNd5S2DsuzsikZyXbg5hIzbQvBkxC0QyFn2ek PVr62+Eb/i+/PUcf+kU2tzww8BBrbf/Kfv0BSdTcAHcZer59uKvlyh3EmG/mKMLpky3k rPbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references: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=3194WT1isFRD7jh7T85CXAlVE9U3LdczY3Cep4jikUg=; b=CsOrMyNB7OueyVlC0gepc0HbgHZ+069bPFVKi3FaVbxUYw5iO2L9f74wwczU/8sh1g HoWqFtIT1j7IONsT563YSOorXBEPkBUDjrarZRiXWJJ2rmEwoQ922qYITreRah9dHcTd ps49pWKpv/yg3kzLtoEq+v70Wc22+qPpCfYhB30j3oLWpbbpqUx5QwQg/n3GN4IyZVmV j84R1BucFS641vxeIwSR6f63Qw/vKtWUKmMLrEJ2YiNJ0zEaQaYNVc1ljLpPhQ5viquZ Lchw93FRoJ0FsxYsPM2BnQd44E7zpwwM39Nhl0Uwiar7ho68ltaiL5Ao6vRV0WIwu8ol r6UA== X-Gm-Message-State: AFqh2kprqqYasIMyNmuX4IhbrDW0JEcDf7jGqP2B1HkqhR02Kz8TQUSK NDAWjl4qqoGNJXr0XgBzXYQ= X-Google-Smtp-Source: AMrXdXtcrwMEM/L6WmJpR40sGhFHNY044ABrlxxQ2otae84JbGj4zFrLqbxso51/j/CkanNkPXQVVQ== X-Received: by 2002:a05:600c:18a3:b0:3d6:b71c:117a with SMTP id x35-20020a05600c18a300b003d6b71c117amr16820499wmp.31.1672071869383; Mon, 26 Dec 2022 08:24:29 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id h10-20020a05600c2caa00b003c701c12a17sm20358084wmc.12.2022.12.26.08.24.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Dec 2022 08:24:28 -0800 (PST) Content-Language: en-US In-Reply-To: <365D3BA2-298F-4B99-9707-FE8BC658701F@easesoftware.com> Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=raaahh@gmail.com; helo=mail-wm1-x334.google.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-1.147, 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:301936 Archived-At: Hi Perry, On 14/12/2022 22:43, Perry Smith wrote: > All three of ruby-mode, java-mode, and c-mode indent a simple arithmetic > expression broken into lines like this: > > foodog = 12 + 4 * >     18 * 99 + 8 > > I think this is the Java sample which has the indent set to 4.  I’ll > call this “the old way”. > > All three of ruby-ts-mode, java-ts-mode, and c-ts-mode indent it like this: > > variable = 12 + 4 * >                 18 * 99 + 8 First of all, this is IMO not too terrible, as it shows the user how the code is parsed, which can be helpful on different occasions. And as apparent from practice, people who don't like this behavior (e.g. Rubocop frowns on it) will just break the line after "=". Seems like the different indentation behaviors across different editors (when the team uses several ones) converge on this practice anyway. > In Ruby’s case, this rule is doing it: > >            ((parent-is "binary") first-sibling 0) > > If I comment that rule out, then no rule hits and so there is no indent > (the line is left unchanged no matter how it is indented). As luck would have it, I'm finishing work on a feature request for ruby-mode for a user option which switches indentation from this sort of AST-aware to simpler continuations. See the latest patch in debbugs#60186. Further, have you looked into supporting/being more-or-less compatible with existing indentation-related options in ruby-mode? At least those that affect SMIE. It should be helpful to synchronize, both to provide a straightforward upgrade path for existing users, and to ensure good experience for those who don't build tree-sitter yet, and for users of older Emacs.