-
Notifications
You must be signed in to change notification settings - Fork 99
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
Implement "jumping to declaration" on irony-server. #153
base: master
Are you sure you want to change the base?
Conversation
Here again I'm doubtful about the perfectness of this method. What this returns for forward declaration? If I have class Foo; // in a header file
// later in a cpp file
void bar(Foo *f); Looking for the declaration of What happens if there are multiple forward declarations? Which one is picked? What does is return on out-of-line definitions of methods? The docs says:
If there was an Elisp part to this method to test the feature that would be great, I guess you are not too familiar with Elisp? |
Yes it could take me quite a while to implement the elisp part, as I'm not too familiar with elisp. But we can use the server command line to test this feature any way. I agree that this method is not perfect, but is useful in most cases to find out the prototype, or the header file which contains the prototype. If one really needs a perfect feature to jump to declaration, they can use rtags, which has a disadvantage of not working on Windows, and perhaps not working for a source file not managed by Makefile, Ninja, etc. |
The thing is this is not the most useful feature to me. Sure I can certainly bind all the libclang functions into irony-server but libclang is well tested already, I don't need to test it more than that. What is needed is some well integrated logic into Emacs. I have a few already on my mind, so I'm not too keen to add an "un-perfect" feature, without the proper Elisp binding I'm sorry. You said:
This! This is a feature I would welcome into irony, to find the file pair to a file. We already have the compile options and what is left to do is to integrated with |
Why is this using |
It was first proposed to do this, see #152. I wasn't too fond of the gotchas that come with find-definition so find-declaration was proposed instead but I'm still not convinced enough. |
@Sarcasm If I add some Emacs integration, would you accept this PR, even as a temporary solution? |
It depends how it is implemented. We surely could benefit from knowing the prototype under the function at point, as a side not the location could be provided and you could jump to it if you want to. I think I can accept something like this. FWIW, what I was waiting for in terms of source code indexer seems to be out in the wild now, http://www.kythe.io/, but it still requires a lot of work to setup and to interface in a useful way with Emacs. Sourcegraph is another contender, https://github.com/sourcegraph/emacs-sourcegraph-mode, but doesn't support C/C++ for now... |
Since I was also interested in the feature, and as of right now won't be able to contribute code, but just a suggestion: when using SLIME and wanting to go to the definition of symbol at point, SLIME would create a "slide-in" buffer and display suggestions to what one could possibly mean by "definition". Eg. say you point at a method. This could have implicit or explicit generic function definition along with a couple of concrete method definitions all applicable to the same symbol. So, "jump to definition" wouldn't take you immediately to any one of those locations, but offer a list of choices. The ideal functionality for forward references and headers would be like that too: show the list of all things that may be relevant rather than try to guess. (Now I know that this adds complexity to implementation, but at least this solves the "how to do it" part...) |
Jump to the declaration of the symbol on a specific location.
Besides it can jump to the definition of some symbols, such as macros, it's also useful to find out which header file contains declaration of a symbol.