emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New defun navigation for tree-sitter (Was: Code navigation for sh-mo


From: Yuan Fu
Subject: Re: New defun navigation for tree-sitter (Was: Code navigation for sh-mode with Tree-sitter)
Date: Tue, 13 Dec 2022 10:07:54 -0800


> On Dec 13, 2022, at 8:11 AM, João Paulo Labegalini de Carvalho 
> <jaopaulolc@gmail.com> wrote:
> 
> Great job, Yuan.
> 
> The new `treesit--navigate-defun' does work as documented. However, the 
> behavior does feel a little awkward to me.
> 
> For instance, if I am within a function I would expect to go to its beginning 
> when pressing C-M-a, and not to the beginning of the first leaf function when 
> searching backward. Although the current behavior might be desirable to some 
> users and should be possible as well.
> 
> The navigation style that I came up with for bash-ts-mode is to navigate only 
> to functions in the same level or higher of the tree. That seems to be the 
> motions I usually rely on when writing/editing code. But that might just be 
> me.

Treesit--navigate-defun should, as you did in bash-ts-mode, only navigate in 
the same level (siblings) or higher (parents). Could you show an example of the 
unexpected behavior?

For a function like the following and point at (1), moving back to beg-of-defun 
goes to (2), then (3), and never goes to (X).

(3)def method():
    (2)def method1():
        (X)def method11():
            return 0
        return 0
    (1)def method2():
        def method22():
            return 0
        return 0

Yuan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]