I finally had some time to have a look. I don't see any more issues, thank you for the fantastic work on this. The defun-type-regexp is not enough to identify a defun in elixir this is the query I am using currently:
(defvar elixir--treesit-query-defun
(let ((query `((call
target: (identifier) @type
(arguments
[
(alias) @name
(identifier) @name
(call target: (identifier)) @name
(binary_operator
left: (call target: (identifier)) @name
operator: "when")
])
(:match ,elixir--definition-keywords-re @type)
))))
(treesit-query-compile 'elixir query)))
Regex will work in most cases I guess, but does not really deal with more complex queries for more complex cases like in elixir as there is not one type which is always the defun. elixir relies heavily on macros and different defun macros can be defined on the fly. Maybe if there is an option for using either a regex or a function?
I am also not sure how forward-sexp can work with the current treesit-search-forward-goto function as it does not take into consideration the level. Is there perhaps a way to move forward/backward, but do not jump to parents or children?