Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to navigate in a function call chain #100

Closed
drcxd opened this issue Sep 25, 2021 · 4 comments
Closed

How to navigate in a function call chain #100

drcxd opened this issue Sep 25, 2021 · 4 comments

Comments

@drcxd
Copy link

drcxd commented Sep 25, 2021

First, I've read the documentation but I just don't understand what does <left> and <right> means in the section "Follow a function call chain". I've tried the left and right arrow key on the keyboard but they just move the cursor. Maybe you can clarify that more in the documentation.

Another thing, maybe I should not talk it here, is that I tried Citre with Unreal Engine code and, just like any tagging based code navigation solution, it is almost unpractical. One important problem about these tagging system, is that they do not recognize macros. Consider the following code:

#define SOME_MACRO(...)

struct T
{
    SOME_MACRO(some, annotation)
    int x;
};

This snippet could compile. However, a tagging system could not recognize x as a member variable of struct T. Also, if you try to find definition of SOME_MACRO, the tagging system could not provide the right answer. It can only list all the occurrence of the macro, which includes the #define statement among them.

I guess this is the limitation of the tagging system which makes them not practical to use with heavily macrofied code base.

@AmaiKinono
Copy link
Member

AmaiKinono commented Sep 25, 2021

<left> and <right> calls citre-peek-chain-backward and citre-peek-chain-forward. These are defined in citre-peek-keymap. It's likely your configuration are shadowing these keys, e.g., maybe other minor mode binds <left> and <right> and its precedence is above citre-peek-keymap.

About your second question, Universal Ctags could expand macro to some extent, see:

It's in an early stage, but I think is still better than other tagging systems as the developers are actually preparing infrastructures for dealing with macros.

@AmaiKinono
Copy link
Member

Also, if you try to find definition of SOME_MACRO, the tagging system could not provide the right answer. It can only list all the occurrence of the macro

I think this happens because universal ctags can tag both definitions and references of macros. You'll notice an <R> marker in the references. Also, Citre sorts the result so definitions comes before references.

@drcxd drcxd closed this as completed Sep 28, 2021
@drcxd
Copy link
Author

drcxd commented Sep 28, 2021

I still have something to say about the <left> and <right> key mapping. Since Emacs's default binding for these keys are simply moving the cursor around. I doubt that some configuration will shadowing these keys but still keeps their original behavior. It's just a waste of time, isn't it?
Could you give me some advice so I could confirm what is going on here?

@drcxd drcxd reopened this Sep 28, 2021
@drcxd
Copy link
Author

drcxd commented Sep 28, 2021

Nevermind, I just typed C-h k <left> and found that it is bound to evil-backward-char.

@drcxd drcxd closed this as completed Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants