Current method signature

73 views
Skip to first unread message

senny

unread,
Oct 14, 2009, 6:07:43 AM10/14/09
to eclim-dev
Hey there

Is there a command implemented in the eclim server to provide the
current method signature. I think it would be handy to display the
return value and the argument list of the method.

Regards,
Senny

Eric Van Dewoestine

unread,
Oct 23, 2009, 10:30:40 AM10/23/09
to ecli...@googlegroups.com

Currently there isn't but this is on my todo list.

--
eric

Boris Month

unread,
Mar 5, 2014, 7:22:33 PM3/5/14
to ecli...@googlegroups.com
Hello Eric Van Dewoestine,
I would like to know if the command to provide the current method signature has already been implemented or for when you plan to implement it.
--
Boris

Eric Van Dewoestine

unread,
Mar 5, 2014, 7:26:27 PM3/5/14
to ecli...@googlegroups.com
On 2014-03-05 16:22:33, Boris Month wrote:
> Hello Eric Van Dewoestine,
> I would like to know if the command to provide the current method signature
> has already been implemented or for when you plan to implement it.
> --
> Boris

Is :JavaDocPreview[1] the command you're looking for?

[1] http://eclim.org/vim/java/javadoc.html#viewing

> Am Freitag, 23. Oktober 2009 16:30:40 UTC+2 schrieb Eric Van Dewoestine:
> >
> > On Wed, Oct 14, 2009 at 03:07:43AM -0700, senny wrote:
> > >
> > > Hey there
> > >
> > > Is there a command implemented in the eclim server to provide the
> > > current method signature. I think it would be handy to display the
> > > return value and the argument list of the method.
> >
> > Currently there isn't but this is on my todo list.
> >
> > --
> > eric
> >
> >

--
eric

Boris Month

unread,
Mar 5, 2014, 9:32:40 PM3/5/14
to ecli...@googlegroups.com
When I use <C-X><C-U> in the following scenario i get a nice list of possible method signatures for charAt if I take the time to search the list of suggestions for charAt.
String b = new String("abcd");
b.

Using set completeopt+=menuone as you suggested here https://groups.google.com/forum/#!topic/eclim-user/w_yrndBUufM allows the same even if I already typed out:
b.chatAt
(By the way, could you explain where one could find out that an option like set compelteopt+=menuone exists and that this is what one i looking for, without searching or asking on the mailing list?)

This also works for methods I implemented myself, so <C-X><C-U> plus the set compelteopt+=menuone setting was what I was looking for I guess.
:JavaDocPreview will display more verbose which is not what I was searching for.

However this doesn't work for calls to the constructor of a Class. The :JavaDocPreview command will not give any Information on the Consturctor parameters either, since it will display the JavaDoc of the Class itself and not the one of the constructor. Is there a way display the method signatures of a Consturctor?
 
The way I use :JavaDocPreview is that I write out the method i am looking for leaving the parameterlist empty. E.g.:
String a = new String("abc");
a.charAt();

Now I would position my cursour on charAt and issue :JavaDocPreviwe. Please correct me if I'm doing something wrong here.

This works fine as long as the method isn't overloaded, cause if it is only the javadoc of one of the methods will be displayed, or am I doing something wrong here?

I hope this is the right place to ask a question, or in this case multiple questions, like this.
--
Boris

Eric Van Dewoestine

unread,
Mar 6, 2014, 12:26:05 AM3/6/14
to ecli...@googlegroups.com
On 2014-03-05 18:32:40, Boris Month wrote:
> When I use <C-X><C-U> in the following scenario i get a nice list of
> possible method signatures for charAt if I take the time to search the list
> of suggestions for charAt.
> String b = new String("abcd");
> b.
>
> Using set completeopt+=menuone as you suggested here
> https://groups.google.com/forum/#!topic/eclim-user/w_yrndBUufM allows the
> same even if I already typed out:
> b.chatAt

If you have 'preview' in your completeopt as well then vim will open a
preview window which shows the full method signature (no docs though
since that kills performance with the way vim's code completion
works). In the case that the method is overloaded, the preview window
will show all the possible method signatures. That window will stay
open after you've chosen a completion so that you can reference those
signatures.

> (By the way, could you explain where one could find out that an option like
> set compelteopt+=menuone exists and that this is what one i looking for,
> without searching or asking on the mailing list?)

In this case the best way is to become familiar with vim's docs. Vim
has some great docs but it takes some time dealing with them to know
how to find what you're looking for. If I don't know exactly the right
help topic to open, I'll usually type out part of a topic name and use
vim's command tab completion to see what topics are available. For
instance to see completion topics:

:h complet<TAB>

Enabling wildmenu makes this even easier to visualize (add these to
your vimrc):

set wildmenu
set wildmode=longest:full,full

> This also works for methods I implemented myself, so <C-X><C-U> plus the
> set compelteopt+=menuone setting was what I was looking for I guess.
> :JavaDocPreview will display more verbose which is not what I was searching
> for.
>
> However this doesn't work for calls to the constructor of a Class. The
> :JavaDocPreview command will not give any Information on the Consturctor
> parameters either, since it will display the JavaDoc of the Class itself
> and not the one of the constructor. Is there a way display the method
> signatures of a Consturctor?

Hmm, seems to work for me. If I have code like so:

List someList = new ArrayList<String)(capacity);

When I place the cursor somewhere on 'ArrayList' and type
:JavaDocPreview, I get the docs for that constructor.

> The way I use :JavaDocPreview is that I write out the method i am looking
> for leaving the parameterlist empty. E.g.:
> String a = new String("abc");
> a.charAt();
>
> Now I would position my cursour on charAt and issue :JavaDocPreviwe. Please
> correct me if I'm doing something wrong here.
>
> This works fine as long as the method isn't overloaded, cause if it is only
> the javadoc of one of the methods will be displayed, or am I doing
> something wrong here?

:JavaDocPreview is intended to just show you the docs for a single
element, but perhaps it could be updated to link to all overridden
versions of that method? I'm not sure off hand how much work that
would be to add.

There is also :JavaDocSearch that will open up the javadocs in your
browser and from there you can view all constructors, methods, etc.
--
eric

Boris Month

unread,
Mar 14, 2014, 1:22:05 PM3/14/14
to ecli...@googlegroups.com
About the :JavaDocSearch command...
I just can't figure out how to tell eclim where to find the JavaDoc of my Project. When I use :JavaSearchDoc on Classes i wrote myself it tells me that it wasn't able to find anything. When I use it on standart Java classes like JFrame it opens the JavaDoc in Firefox, like it should be.
Following the instructions found here: http://eclim.org/vim/java/javadoc.html#searching
I modified my .classpath to look like this:

<?xml version="1.0" encoding="UTF-8"?>    
<classpath>    
        <classpathentry kind="src" path="src">    
                  <attributes>          
                          <attribute value="doc" name="javadoc_location"/>    
                  </attributes>    
        </classpathentry>        
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>    
        <classpathentry kind="output" path="bin"/>    
</classpath>

But it still doesn't work. Can you tell me what I'm doing wrong?

Eric Van Dewoestine

unread,
Mar 15, 2014, 8:16:35 PM3/15/14
to ecli...@googlegroups.com
On 2014-03-14 10:22:05, Boris Month wrote:
> About the :JavaDocSearch command...
> I just can't figure out how to tell eclim where to find the JavaDoc of my
> Project. When I use :JavaSearchDoc on Classes i wrote myself it tells me
> that it wasn't able to find anything. When I use it on standart Java
> classes like JFrame it opens the JavaDoc in Firefox, like it should be.
> Following the instructions found here:
> http://eclim.org/vim/java/javadoc.html#searching
> I modified my .classpath to look like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <classpath>
> <classpathentry kind="src" path="src">
> <attributes>
> <attribute value="doc"
> name="javadoc_location"/>
> </attributes>
> </classpathentry>
> <classpathentry kind="con"
> path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
> <classpathentry kind="output" path="bin"/>
> </classpath>
>
> But it still doesn't work. Can you tell me what I'm doing wrong?

I had never actually tried this before, but after digging into the
eclipse source code, I found that setting the project's javadoc
location is done outside of the .classpath file. I've updated[1] eclim
to expose the ability to modify the eclipse setting[2] that specifies
your project's javadoc base url.

[1] https://github.com/ervandew/eclim/commit/97ae22b0de61ee8f65b0dcfa748daead8ee47f1e
[2] https://github.com/ervandew/eclim/commit/c74c583d2aa52c89852dc8d8e8798511c5344386
> --
> You received this message because you are subscribed to the Google Groups "eclim-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to eclim-dev+...@googlegroups.com.
> To post to this group, send email to ecli...@googlegroups.com.
> Visit this group at http://groups.google.com/group/eclim-dev.
> For more options, visit https://groups.google.com/d/optout.

--
eric
Reply all
Reply to author
Forward
0 new messages