Enhance preview(?) when pointing to code
Is it possible to show the short code snippets of variables/marcos/functions, besides from their locations and signatures like some other mainstream IDEs do?
Yes and no. The libclang itself does not provide it to us. But theoretically we could achieve that by copying the contents of the file and showing it. However, it is a lot of work. I'm afraid I won't have the time for this anytime soon. But I will leave it hanging and would love to merge a pull request for this.
What exactly would you like to see?
Signature and code for those short marcos/inline functions. @simia
It has been a great tool for reading source code.I was wondering if it could go further.But it seems unnecessary and inefficient as it's not easy to do for now.
No-no I would leave it open. Maybe some time I get some free time and want something to implement. Or @simia will ship his current PRs and will want something to implement :)
Hmm. You want to see those when hovering over variable/function or when selecting item for auto completion?
If hovering than this is inline with my plans for this feature if for completion it's very good feature to add but I am not sure if possible :)
@Rinate could you elaborate on what you would like to be added?
@simia, I would love to do that, but I'm junior in college, occupied with my courses and intern, and totally have no idea with how to contribute.
Oh. I just wanted you to describe in more details what you would like to be added...
The basic idea is that I don't want to jump, I want to see related informations in situ as much as possible.
By shortcuts or just hovering over those variables/marcos/functions, I want to see
- signature for some variable or function(done)
- definition/impl for some marco or short function(Todo, to avoid from too many jumps) The current version doesn't support generic type.
And I wish we could see different code that could not fit into one page by point to minimap like pycharm does.(Maybe it should be another plugin)
I've spent some time thinking about it. It does not look good from my standpoint. I would say, it is also closely related to #124. We need a way to magically know where the actual code for our method lives. Consider an example. Let's say, we have a file main.cc and we call a function foo there which is declared in foo.h and defined in foo.cc. If foo.h and foo.cc are bundled into a library, there is no way for clang to know anything about the existence of foo.cc when we have main.cc open. These files live in separate translation units. So in order to access the actual implementation we need to know that the implementation is actually in foo.cc, where exactly it is in the file, etc. All this information is build system and/or file system dependent, which is a huge hassle to deal with. So as of now, I do not see any realistic way of implementing this feature. I will keep in open, but will move it to backlog.
@dibalavs has added the PR that solves this as well as possible. We do not always have access to the definition of the method in the same translation unit, so for now only the class declaration will be fully shown. This issue will close once the commit referenced above hits master.