unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 62086@debbugs.gnu.org
Subject: bug#62086: 29.0.60; ruby-ts-mode regressions
Date: Wed, 05 Apr 2023 09:24:24 +0300	[thread overview]
Message-ID: <865yaakfs7.fsf@mail.linkov.net> (raw)
In-Reply-To: <f0005fe9-7da3-6efb-be17-89faf7998ad5@yandex.ru> (Dmitry Gutov's message of "Wed, 5 Apr 2023 03:06:52 +0300")

>> I wonder is it possible to fix more.
>> Many parens/brackets are still not matched in e.g.
>> test/lisp/progmodes/ruby-mode-resources/ruby.rb
>> such as parens in def argument list:
>>    def test1(arg)
>
> This one was a regression from the addition of strict bos/eos anchors, now
> fixed.

Maybe there are more types that now are not found, but probably easier
to add them one by one after testing than to try finding all of them in
https://github.com/tree-sitter/tree-sitter-ruby/blob/master/src/node-types.json
or in
https://github.com/tree-sitter/tree-sitter-ruby/blob/master/src/grammar.json

>> and in
>>    method (a + b),
>
> When you say that this is broken, do you mean that these parens get jumped
> over unexpectedly (with forward-sexp movement ending at the end of the
> arguments list)?

It seems natural to expect that when point is on an opening paren/bracket
then 'C-M-f' should jump to its closing pair.  At least, this is more WYSIWYG.

> This is an artefact of the implementation of treesit-forward-sexp.
> It might be possible to improve, but from a brief dig, it has some
> internal logic. So some care would need to be taken to decide which
> contract nedds changing.

This is an example where explicit parens conflict with implicit parens.
Visible parens have the type "parenthesized_statements", but invisible
parens have the type "argument_list".  Both start at the same position.
So maybe treesit-forward-sexp should prefer the former over the latter?
And in a similar case

  method [],
         arg2

maybe "array" should take precedence over "argument_list".

>> Also square brackets are not matched by 'C-M-f' in
>>    h[:key]
>
> And this, surprisingly, seems impossible to handle just using
> treesit-sexp-type-regexp. The brackets are present in the tree, but they
> are not at the ends of any node. So that will require some custom Lisp,
> I guess.

This is the same problem that occurs in other places such as in "#{ddf}"
where only '#' but not '{' matches '}'.  So adding "element_reference"
will allow to jump only from the beginning of an identifier.





  reply	other threads:[~2023-04-05  6:24 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09 17:24 bug#62086: 29.0.60; ruby-ts-mode regressions Juri Linkov
2023-03-09 18:08 ` Eli Zaretskii
2023-03-10  7:29   ` Juri Linkov
2023-03-09 22:02 ` Dmitry Gutov
2023-03-10  7:35   ` Juri Linkov
2023-03-10 16:37     ` Dmitry Gutov
2023-04-03 16:29   ` Juri Linkov
2023-04-03 20:42     ` Dmitry Gutov
2023-04-04  7:16       ` Juri Linkov
2023-04-05  0:06         ` Dmitry Gutov
2023-04-05  6:24           ` Juri Linkov [this message]
2023-04-05 14:58             ` Dmitry Gutov
2023-04-05 16:25               ` Juri Linkov
2023-04-05 16:36                 ` Dmitry Gutov
2023-04-11 16:53                   ` Juri Linkov
2023-04-11 23:30                     ` Dmitry Gutov
2023-04-12  7:05                       ` Yuan Fu
2023-04-12 15:31                         ` Dmitry Gutov
2023-04-12 20:13                           ` Dmitry Gutov
2023-04-12 21:50                             ` Yuan Fu
2023-04-12 21:56                               ` Dmitry Gutov
2023-04-12 22:11                                 ` Yuan Fu
2023-04-15  0:08                                   ` Yuan Fu
2023-04-13 17:42                             ` Juri Linkov
2023-04-14 17:03                               ` Juri Linkov
2023-04-12  7:30                       ` Eli Zaretskii
2023-04-12 15:31                         ` Dmitry Gutov
2023-04-12 15:40                           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=865yaakfs7.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=62086@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).