From: Wilhelm H Kirschbaum <wkirschbaum@gmail.com>
To: Yuan Fu <casouri@gmail.com>
Cc: 60355@debbugs.gnu.org
Subject: bug#60355: 29.0.60; Tree sitter incorrectly handles of PRED for treesit-defun-type-regexp
Date: Wed, 28 Dec 2022 08:31:32 +0200 [thread overview]
Message-ID: <87sfh0ujet.fsf@gmail.com> (raw)
In-Reply-To: <1E7949EC-7420-4848-9F45-88A20BAAE1D8@gmail.com>
Thanks Yuan, just checked and both the fix and your suggestion
works.
I see there is a typo in your last change:
@@ -310,7 +310,7 @@ java-ts-mode
;; Imenu.
(setq-local treesit-simple-imenu-settings
'(("Class" "\\`class_declaration\\'" nil nil)
- ("Interface "\\`interface_declaration\\'" nil
nil)
+ ("Interface" "\\`interface_declaration\\'" nil
nil)
("Enum" "\\`record_declaration\\'" nil nil)
("Method" "\\`method_declaration\\'" nil nil)))
(treesit-major-mode-setup))
Yuan Fu <casouri@gmail.com> writes:
> Wilhelm H Kirschbaum <wkirschbaum@gmail.com> writes:
>
>> When `treesit-defun-type-regexp` is set with a cons cell
>> (regexp .
>> some-pred)
>> the following case does not get handled as expected when
>> calling
>> (end-of-defun):
>>
>> ```elixir
>> defmodule Example do
>> def foo() do ; regexp match, pred match
>> end
>>
>> ;; <point here>
>> @impl true ; regexp match, pred does not match
>> def bar() do ; regexp match, pred match
>> end
>> ;; <should jump to here>
>>
>> def baz() do
>> end
>> end
>> ;; <jumps to point here>
>> ```
>
> Thank you very much! The root cause is actually another problem,
> but
> anyway it is fixed now.
>
> May I also suggest you to use this function for the predicate:
>
> (defun elixir-ts-mode--capture-defun (node)
> ;; NODE should be a ‘call’ node.
> (member (treesit-node-text
> (treesit-node-child-by-field-name node "target"))
> elixir-ts-mode--definition-keywords))
>
> This should be more accurate than the current one, and is IMO
> simpler
> too.
>
> Yuan
next prev parent reply other threads:[~2022-12-28 6:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-27 12:09 bug#60355: 29.0.60; Tree sitter incorrectly handles of PRED for treesit-defun-type-regexp Wilhelm H Kirschbaum
2022-12-28 1:47 ` Yuan Fu
2022-12-28 6:31 ` Wilhelm H Kirschbaum [this message]
2022-12-28 8:34 ` Yuan Fu
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=87sfh0ujet.fsf@gmail.com \
--to=wkirschbaum@gmail.com \
--cc=60355@debbugs.gnu.org \
--cc=casouri@gmail.com \
/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).