niosus / EasyClangComplete

:boom: Robust C/C++ code completion for Sublime Text 3/4
https://niosus.github.io/EasyClangComplete/
MIT License
575 stars 78 forks source link

Add option for detailed documentation view #728

Closed LexouDuck closed 3 years ago

LexouDuck commented 3 years ago

System info:

What happens:

This is rather more of a suggestion or a feature request than a true issue, really. I'm very glad that this plugin shows brief documentation for functions, following the doxygen style(s) of comments. image So I was wondering, could you add an option to show detailed documentation, as well as @param and @return doc comments ? It would be very cool to be able to see all the relevant doc without having to "Go to definition" all the time. Im thinking an option like this should probably be off by default (or rather, 'false', to be precise), since it could take up too much space. Otherwise, you could make @param and @return doc only appear when hovering elements inside the function definition which is in the "ECC: Info" hover area.

In any case, this has been an extremely useful plugin for me for quite a while now, great work here.

niosus commented 3 years ago

@LexouDuck I think this is already there. We show brief doc on top and full doc on the bottom. But it is a bit hacky as we parse the doxygen comments ourselves. I tested it with a couple of styles I use and it worked, but it probably just doesn't work with yours. You could extend this functionality if you like to, or just switch to using a different style of doxygen (e.g. all lines start with ///). Thoughts?

LexouDuck commented 3 years ago

Well, I am quite fond of the doc comment style I use - so I think doing a PR is the way to go then. While I am at it, I'll try and make every other comment style that doxygen accepts play nicely along with this plugin (for instance, it seems that the plugin expect only one '*' asterisk at the beginning of each line, so the fact that I have two asterisks at the beginning of each line puts stray asterisks everywhere in the description - whereas doxygen handles this correctly).

Could you point me in the right direction as to which of your source code files I'm gonna have to change/read/understand ?

PS: Another related question, does your plugin understand @def instructions, for documentation comments which are not positioned directly next to the thing they're defining ?

niosus commented 3 years ago

Nope, for now the support for doxygen is very rudimentary. I get the raw comment from clang and then do some really simple cleanup in here: https://github.com/niosus/EasyClangComplete/blob/master/plugin/error_vis/popups.py#L453-L479

Feel free to poke around and submit a PR if you do improve parsing! Thanks a lot!

niosus commented 3 years ago

Also, you should probably wrap your @def etc things in the code quotes as otherwise you ping github users that have nothing to do with this issue. :wink: