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.bugs Subject: bug#61017: 29.0.60; ruby-ts-mode indents class between two lines incorrectly Date: Wed, 25 Jan 2023 06:00:11 +0200 Message-ID: References: <1a2436ef-ff4d-827c-f22f-33b0737d9b1f@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29292"; 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 Cc: 61017@debbugs.gnu.org To: Aaron Jensen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 25 05:01:22 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1pKWyQ-0007VQ-7w for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 Jan 2023 05:01:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKWyB-0001TI-E1; Tue, 24 Jan 2023 23:01:08 -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 1pKWy7-0001Sk-Np for bug-gnu-emacs@gnu.org; Tue, 24 Jan 2023 23:01:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pKWy7-0001vN-1k for bug-gnu-emacs@gnu.org; Tue, 24 Jan 2023 23:01:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pKWy6-0007tb-4R for bug-gnu-emacs@gnu.org; Tue, 24 Jan 2023 23:01:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Jan 2023 04:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61017 X-GNU-PR-Package: emacs Original-Received: via spool by 61017-submit@debbugs.gnu.org id=B61017.167461922230299 (code B ref 61017); Wed, 25 Jan 2023 04:01:02 +0000 Original-Received: (at 61017) by debbugs.gnu.org; 25 Jan 2023 04:00:22 +0000 Original-Received: from localhost ([127.0.0.1]:58021 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKWxR-0007sc-MY for submit@debbugs.gnu.org; Tue, 24 Jan 2023 23:00:22 -0500 Original-Received: from mail-ej1-f48.google.com ([209.85.218.48]:39896) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKWxP-0007sM-D0 for 61017@debbugs.gnu.org; Tue, 24 Jan 2023 23:00:20 -0500 Original-Received: by mail-ej1-f48.google.com with SMTP id v6so44327385ejg.6 for <61017@debbugs.gnu.org>; Tue, 24 Jan 2023 20:00:19 -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:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=WOG4PlX7mMeTyeuZkhlbBB1Ad9oj1jM2gTQ1NbWpyoU=; b=H1Cdpk+SEh0MXGBarel4TA2LxvSZRwlDAqD2ae3+QFHryaJbwf0y5LlhX8IGzRcYA2 7f02lCsFEBbCu7RP1N2o0CAiFv83hlm5IcQu2eB6iBj1jI4DPWA1PO32hquZZ9PtDdpu m9IL10rup5PPcIggFlWSXaHfpUxlXx3YHFWbgNqk9n3Sr4YWv2hykYY4cakwDj6LEvVp UeXlVEkZWIDeKq0S/uAI3Fm4L/TWRwZ9yrnneAAHdt3TXXBJGfPZD394ggFHOmH0xLpp VJ23yUMM4zZ14BQbxg/n9TEHiqC0DbIdwIkXT+pVcRF9Z/5B0SYBgduMNWsLFit7h2fk PItw== 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: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=WOG4PlX7mMeTyeuZkhlbBB1Ad9oj1jM2gTQ1NbWpyoU=; b=pwlPWqsm4ORUjW5F2+TsrEH3Fzf0EBtfugi/42J81wvWiYoUZZKD4AHDY2lMlts1eH 2cBF+e+mn/ySTDqM791jdpazkAV7o1Z/nxiQ58NXgCKoIfQDmyA+Yaw0ohjl/2DTqMeL KaVIqqb+RWPF0H+IxLwnRQEEY77rEdpjKG6xVn3cAo/YIx2s3lDTFfhf5F8RdgLGzwKa xYJ9YhMnxuLDxRz6hQb/WxC6ukoVVF+/0kOaNhm8vZBl5oq28MSl0jFXXl46loUcH/Qk 4QgdLflJyJupQHzqKJ39zJwc0vVlCQOn1NBfD3NJ/UCFGOHUNoz/x8qgPXzCWrJ2Tp/x 5MNg== X-Gm-Message-State: AFqh2krw284nIFRFXWKPbnI1UJ8hic82J7Bwyr1bRx/H9l3ILhfbubWt dt4QCM6oKm0/fPPNE/Ou8D8= X-Google-Smtp-Source: AMrXdXuAN0ELszbI4xumPRKxpOdz4d0mmip0ArML0oZ7XTGbTg4JsgaRDqelMiDONVcS9GPUoOksuA== X-Received: by 2002:a17:906:608d:b0:872:a2ee:271d with SMTP id t13-20020a170906608d00b00872a2ee271dmr29572044ejj.53.1674619213535; Tue, 24 Jan 2023 20:00:13 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id t6-20020a1709067c0600b00871ac327db6sm1747121ejo.45.2023.01.24.20.00.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 24 Jan 2023 20:00:13 -0800 (PST) Content-Language: en-US In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:254098 Archived-At: On 25/01/2023 02:45, Aaron Jensen wrote: >>>> Is it enough of an improvement? >>> >>> That seems to make indentation after an open def not happen: >>> >>> def foo >>> bar >>> end >> >> Not sure what you mean. Is that an example with an "open def"? "end" >> seems to be closing it. In the final state, it indents correctly here. > > Sorry, that's what I meant. If I do type exactly that and do not > reindent, I end up with that though (closing with the end does not > cause the previous line to reindent) All right. But if the proposed patch doesn't make things worse for this example, we might as well install it. Because this "unclosed def" case is distinct from the one you filed this bug report regarding. >>> I applied the patch manually though, so maybe you can confirm that you >>> see the same thing? >> >> If I have a buffer with just the first line: >> >> def foo >> >> then it indeed doesn't indent. But I think that happens with or without >> this patch? >> >> It's a slightly different problem: the grammar parses this code example >> without ERROR nodes, like a full method, for some reason: >> >> (program >> (method def body: (identifier) end)) >> >> And the end position of the "virtual" end node stays at the previous >> line, so our code doesn't know it's inside the method. >> >> I suppose we could add some tricky predicate like (is the previous node >> a method with an "end" child that is 0 characters long), but the grammar >> might change (we should look for any previous reported issues about this >> behavior, or maybe ones that resulted in it), and it only happen this >> way when there is nothing after "def xyz" in the buffer. > > I wonder if this is mistaken handling of endless methods? Those parse to nodes that look a little different (no "end"): (program (method def body: (identifier) = (integer))) So I'm not sure. > I can't > think of a reason that it would parse like that. Should that be > reported upstream? I filed https://github.com/tree-sitter/tree-sitter-ruby/issues/234, let's see if there is any response.