Open senny opened 15 years ago
Here's a prototype/implementation of the function you've bound to "C-c C-e s"
(defun eclim-java-method-signature-at-point ()
"Find and display the method signature at point."
(interactive)
(let ((i (eclim--java-identifier-at-point t)))
;note: for some reason the "-t 'method'" portion of command doesn't function as expected for non-methods.
(eclim/with-results hits ("java_search" "-n" "-f" ("-o" (car i)) ("-l" (length (cdr i))) ("-t" "method") ("-x" "declarations"))
(echo-signature hits))))
(defun eclim-java-echo-signature (results)
(if (= 1 (length results))
(let ((result (elt results 0)))
(message (assoc-default 'message result)))
(error "found more than 1 result")))
I think there is a bug in the eclim code that handles the type request. In theory, running this function on a member variable should throw an error, but eclim still returns a result.
@ervandew do you have an insight on the problem @lespaul found?
Is the question: Why is eclim returning a result when -t method
was
supplied with the offset of an non-method element?
If so then the answer is that -t ...
argument is ignored for element
based searches since the type of the element is known. It's only used
for pattern searches where the type is not known.
If that's not the question, then I guess I need some clarification.
Thanks for answering the question! You're answering what I was confused about.
Sounds very promising this feature. It does seem that it's only half way there in the source, though. The shortcut is registered in emacs-eclim.el
, but the function cannot be found anymore (I see it was there once upon a time):
command-execute: Symbol's function definition is void: eclim-java-method-signature-at-point
My idea is to use info we have when completing symbol. There's info about method arguments so if I'll send smart arguments to complete (the right method name + maybe method arity) then I believe required eldoc info will be in place.
The problem I have right now is how to know that I'm in method call somewhere and how exactly is that method named. expand-region have special extension to eventually mark the method call... so I might look into this and maybe hack it somehow with it, but maybe (most probably) there's better way.
Is it reasonable approach?
Any progress on this?
It would be great, if we could make something like eldoc-mode for java. This would ease the development extremely, because can always check what types you need to pass to a given method.