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#62416: 30.0.50; Symbols skipped in the navigation in ruby-ts-mode Date: Wed, 29 Mar 2023 01:24:49 +0300 Message-ID: References: <9cfb677e-2c3b-94f3-e09f-8b231dd9b8f5@yandex.ru> <86v8iomzk3.fsf@mail.linkov.net> <7f03efd3-b3d8-2a93-3414-63a7a2604943@yandex.ru> <86v8imfrbt.fsf@mail.linkov.net> <385443e1-4d17-317b-decf-36a3cf50111e@yandex.ru> <86o7odmlnr.fsf@mail.linkov.net> 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="13609"; 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: =?UTF-8?Q?Bo=C5=A1ko_?= =?UTF-8?Q?Ivani=C5=A1evi=C4=87?= , 62416-done@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Mar 29 00:25:15 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 1phHkg-0003Fk-O3 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Mar 2023 00:25:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1phHkV-0001sb-PC; Tue, 28 Mar 2023 18:25:03 -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 1phHkU-0001sL-RO for bug-gnu-emacs@gnu.org; Tue, 28 Mar 2023 18:25:02 -0400 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 1phHkU-0001Cv-Jh for bug-gnu-emacs@gnu.org; Tue, 28 Mar 2023 18:25:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1phHkU-0001Jc-3H for bug-gnu-emacs@gnu.org; Tue, 28 Mar 2023 18:25:02 -0400 Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 Mar 2023 22:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 62416 X-GNU-PR-Package: emacs Mail-Followup-To: 62416@debbugs.gnu.org, dgutov@yandex.ru, bosko.ivanisevic@gmail.com Original-Received: via spool by 62416-done@debbugs.gnu.org id=D62416.16800422995041 (code D ref 62416); Tue, 28 Mar 2023 22:25:01 +0000 Original-Received: (at 62416-done) by debbugs.gnu.org; 28 Mar 2023 22:24:59 +0000 Original-Received: from localhost ([127.0.0.1]:50827 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phHkQ-0001JE-RX for submit@debbugs.gnu.org; Tue, 28 Mar 2023 18:24:59 -0400 Original-Received: from mail-wm1-f47.google.com ([209.85.128.47]:54183) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phHkP-0001J0-6Q for 62416-done@debbugs.gnu.org; Tue, 28 Mar 2023 18:24:57 -0400 Original-Received: by mail-wm1-f47.google.com with SMTP id p34so7815875wms.3 for <62416-done@debbugs.gnu.org>; Tue, 28 Mar 2023 15:24:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680042291; 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=hUeSbMgWBir2LnX1lIB47/fo7n2p765QUM+gzpX+prc=; b=FmWhXE++AswtzWIbVddp9taLBfkH5ERe+Rh1MwAK79O1lPwVg2fWbtdz9aM8QM67mR y8Xm5rpigJ0gcrg/Fe+f24i9fk8FacHT3x1HXk5IzK86zCW9dRX++4zX92/iliT6LtFX o3V1RWm5nfRm5MIg1IiAS8A8c76M3CaE5+uCQMz43azgZ+FpaNQYi1sgztEHcS+mE2hI hPu0WIrrQBUgbCdwHVOQflNPCrQSKOzS97NxIj5h5AXjPFls6UIAsaGIWtQazvoACPu8 tQZ0IAu64bOJuCB6uyu+E9haDjknbUQkgeqE4sn7UHGVXu2cl3NqMkeIyQV0cVQJDYih Q4yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680042291; 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=hUeSbMgWBir2LnX1lIB47/fo7n2p765QUM+gzpX+prc=; b=sSG4Xqsh3Pxs25rr0x3TI8VTPW/yA3MWssWevrBw5sFrEESrKuPq876zz2esr0FBkm T6yRSznnGv1GB4cpzIue1TwzduWMS41A21/TP/YYoQ4OGwF0r24X7wkCWM09CF1VbEj9 Lr7RBVxJumPB2b7WKbDIy8FG1WFqI4Zpna8I4iUuPSSdxPUaPLHwwgegjNK5mQZfnway 8cG3Vf3R6oflgexI05iNNyAoi4r2yiMKefkuNoWW3qqd2igFGLLhU5553+7oaz1LyEa3 fjwFTjlrYaxN1cvD8t4BaGQUCvzNYOIwr71CCOJuAWLJiBfn0PnRzGJiGvdoTrEIrO1W wXWQ== X-Gm-Message-State: AO0yUKW+MFsiESj5yY3xyIGYRuDyIrw4UHC6YTWqNDrG9R+paoi4wHu/ +XIE5wryJf++hDv7ES+iaDk= X-Google-Smtp-Source: AK7set/zzTU+70o0nVUGr1gNfgM0Q+g4ikFZySKIbeO3XmsoEvN5ZXGSY7liH002NN45MqMwNgumxQ== X-Received: by 2002:a1c:ed08:0:b0:3ee:95c:b73e with SMTP id l8-20020a1ced08000000b003ee095cb73emr12796226wmh.24.1680042291229; Tue, 28 Mar 2023 15:24:51 -0700 (PDT) Original-Received: from [192.168.1.2] ([31.216.80.60]) by smtp.googlemail.com with ESMTPSA id c1-20020a05600c0a4100b003ee5fa61f45sm177697wmq.3.2023.03.28.15.24.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Mar 2023 15:24:50 -0700 (PDT) Content-Language: en-US In-Reply-To: <86o7odmlnr.fsf@mail.linkov.net> 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:258828 Archived-At: On 28/03/2023 09:31, Juri Linkov wrote: >>> This will break other cases, e.g. >>> b = %Q{This is a "string"} >>> c = %w!foo >>> bar >>> baz! >>> d = %(hello (nested) world) >>> when point is after "b", 'C-M-f' will move to "c" instead of the end of >>> line. >> >> That is because the string literals aren't recognized as sexps yet. Try >> this: >> >> @@ -1129,8 +1129,11 @@ ruby-ts-mode >> "block" >> "do_block" >> "begin" >> - "binary" >> - "assignment"))) >> + "integer" >> + "simple_symbol" >> + "string" >> + "string_array" >> + ))) > > Thanks, this definitely is an improvement since it handles all mentioned cases. Very good, I've pushed that change, and with that I'm closing this bug. Thank you both. > However, there are still a lot of more things that need fixing. > When point is on the left curly bracket in > > b = %Q{This is a "string"} > > 'C-M-f' doesn't move to the right curly bracket. > Also double quotes inside the string are not matched by 'C-M-f'. > > In > > d = %(hello (nested) world) > > 'C-M-f' doesn't move to the closing parens from opening parens. > > Looking at test/lisp/progmodes/ruby-mode-resources/ruby.rb > for example here curly brackets are not matched with 'C-M-f C-M-b' > in string interpolation and regexps: > > "abc/#{ddf}ghi" > > /foo/xi != %r{bar}mo.tee > > Do you think it is possible to handle these cases > by crafting treesit-sexp-type-regexp? I don't think so. tree-sitter parse tree has no information about these parens or their positions. So we'd need to do this with some custom code: check the context (e.g. see that we are inside a string) and then move over parens and etc. It's not out of the question to do that in the common tree-sitter code, too (Ruby doesn't look very special in having strings). But whether this is useful enough to expend that effort, seems like a subject for a separate discussion (report-emacs-bug or emacs-devel -- your choice).