mickeynp / combobulate

Structured Editing and Navigation in Emacs with Tree-Sitter
GNU General Public License v3.0
945 stars 54 forks source link

Question about navigation use case #8

Closed chaoyi closed 1 year ago

chaoyi commented 2 years ago

Hi, I want to improve my code navigation skill and I am glad I found combobulate. I am trying to adapt it for Rust. However, I run into an issue that I am not able to navigate to some node.

For example, I have setup combobulate as such

(setq combobulate-navigation-node-types '(source_file
                                          call_expression
                                          arguments
                                          identifier)))

I have reduced my use case to a snippet

f(g());
f2();

print from tree-sitter-debug-mode

source_file:
  call_expression:
    identifier:
    arguments:
      call_expression:
        identifier:
        arguments:
  call_expression:
    identifier:
    arguments:

My cursor is at f the first call_expression. I want to navigate to f2 which is the second call_expression but I am not able to do so. I tried combobulate-navigate-next but it doesn't work for me. I think combobulate considers my current node is at identifier node which has the same start position as call_expression node. Is there a way to tell combobulate to select the parent node to disambiguate my intention?

mickeynp commented 2 years ago

Hi chaoyi,

I just tried it out and yeah there's apparently a bit of a problem with overlap here; if call_expression is removed from the navigable node types, the code seems to work fine.