Sarcasm / company-irony

company-mode completion back-end for irony-mode
119 stars 11 forks source link

Default arguments & brief documentation #4

Open lecopivo opened 10 years ago

lecopivo commented 10 years ago

1.

When I complete function, than I do not get attributes which have default values.

Example:

 void jump( int h = 1 ){}  
 void walk( int s ){}

they expant to

jump()
walk(int s)

I would like to have option to expand jump to jump(int h) or at least have some tooltip info that there is optional arguments. This leads me to next question

2.

I would like to somehow display documentation(Doxygen) on completion candidates, for example as tooltip and as well to display documentation on function arguments.

Thank you, Tom

Sarcasm commented 10 years ago

Woops, I didn't notice this issue.

So to answer your questions:

1.

This is currently not implemented but I'm aware of this problem. Optional arguments are ignored for now https://github.com/Sarcasm/irony-mode/blob/4554b91a4f80b758f16e9b6e25af651fbfc45624/server/src/Irony.cpp#L253-L255

2.

For the documentation, libclang only provides the brief documentation and so does irony.

For the function arguments, I'm not sure what you mean, do you want the prototype like what is displayed in company's annotation?

lecopivo commented 10 years ago

I might be dumb but how do I display that brief documentation?

2.

I'll give an example of what I mean. Let's have a function

/**
* @brieff Take squareroot of number
* @param x Number to take squareroot of.
* @return Squareroot of x
*/
float squareroot( float x ){ ...}

Now when I write square and complete I get squareroot( float x ) with cursor at the beginning of float x. I would like to display Number to take squareroot of. somewhere, propably as tooltip.

I hope it is clear what I mean.

Sarcasm commented 10 years ago

I might be dumb but how do I display that brief documentation?

Not dumb, the brief documentation is only supported on recent version of libclang (see the version check here: server/src/Irony.cpp#L23-L28), if your version is recent enough it should be displayed in the echo area like this:

2.

It's perfectly clear now. So right now this is not possible and it is not planned in the short-term either but I agree that it would be nice to have someday.

nickbroon commented 9 years ago

The company-clang backend has company-clang-insert-arguments option that defaults to on. A similar option for the irony backend would be great.

Sarcasm commented 9 years ago

@nickbroon how is this related to this issue? Pease open an issue for this.

nickbroon commented 9 years ago

I think I might have misread section 1 above, and thought it related. But I know see it's about default values. I'll open a new issue.