EasyClangComplete icon indicating copy to clipboard operation
EasyClangComplete copied to clipboard

Show tooltip with function docs

Open niosus opened this issue 9 years ago • 15 comments

From @jdumas

a "tooltip" showing us the function prototype when the mouse is hovering the function would be nice. It can be achieved with the on_hover API introduced in build 3124.

niosus avatar Dec 16 '16 09:12 niosus

I probably won't have much time in the coming month to implement this. PRs welcome.

niosus avatar Dec 16 '16 09:12 niosus

I've tried doing something similar (displaying variable type on hover). It interferes with sublime "Goto" popup. It might be better option to add shortcut/command to display such an information rather then using on_hover. I plan to spend few days next week to work on some enhancements so maybe I'll look more into this.

simia avatar Dec 16 '16 14:12 simia

Very welcome :) I know that Anaconda does it in two ways:

  • you can enable showing the description of a function upon completion
  • you can call it from a submenu with a mouse

Additionaly, a shortcut seems to be appropriate. I don't know if on_hover is a good idea as it would trigger too often (not sure???).

niosus avatar Dec 16 '16 14:12 niosus

I don't think on_hover would trigger too often. If you show the tooltip with a function prototype only when the mouse hovers the function + when the carret is currently on the function as well. At least consider making the apparition delay a setting, e.g. in CLion function prototypes are popping up all the time and this has annoyed the hell out of me.

jdumas avatar Dec 16 '16 17:12 jdumas

@jdumas I'm sorry, I am missing your point. Are you for on_hover or against? Or is it about the delay? I am confused :)

niosus avatar Dec 16 '16 18:12 niosus

I am for on_hover! As long as we can configure its delay/disable it if we find it annoying =)

jdumas avatar Dec 16 '16 19:12 jdumas

Hi Guys, I've started playing with this today. I've got on_hover displaying declaration of function/member. What do you think about this? This hides popup with sublime default "goto definition" so it's not perfect. I'll work tomorrow on adding command to display this instead but that will probably require some architecture rework.

screenshot from 2016-12-19 16-07-58 screenshot from 2016-12-19 16-08-06 screenshot from 2016-12-19 16-08-11 screenshot from 2016-12-19 16-08-20

simia avatar Dec 19 '16 16:12 simia

Overall nice. At least I like this one. Also, documentation would be also cool to show with some setting enabled.

niosus avatar Dec 19 '16 16:12 niosus

By documentation you mean doxygen etc. comments? That shouldn't be a problem.

simia avatar Dec 19 '16 16:12 simia

Yep, exactly. Actually, I think I would love an option for using your popups instead the sublime ones as I find those quite useless, so please don't completely remove this. It is not a bug, it's a feature :)

niosus avatar Dec 19 '16 16:12 niosus

Yeah. I was also thinking about replacing sublime autocomplete list with custom made popup but that's a different story :)

simia avatar Dec 19 '16 16:12 simia

Would this make it possible to show values of lets say definitions?Right now Sublime Text only shows where defines are located but it would be nice if the value(or possible values) are shown in the tooltip as well.

SpeCter avatar Jan 09 '17 10:01 SpeCter

What do you mean by "value of definition"? I understand it for a variable but for function? Would you expect function body?

simia avatar Jan 09 '17 11:01 simia

Lets say you have #define Foo 1 somewhere in a header file. And now I have another file which has something like #ifdef Foo etc.. Now if I hover over Foo I would like to see Foo = 1 in a Tooltip with every (possible) define. It doesn't have anything to do with functions, but I was hoping that whatever is used here could be used for this as well.

SpeCter avatar Jan 09 '17 19:01 SpeCter

Ah sorry I misunderstood. I had a quick look and I think it's completely possible to have this.

simia avatar Jan 10 '17 10:01 simia