compliment icon indicating copy to clipboard operation
compliment copied to clipboard

Good completion suggestions require extra type hints

Open lassemaatta opened this issue 1 year ago • 2 comments

I was writing some Java-interop code with cider and noticed that I need to add a lot of explicit type-hints to get good quality autocomplete suggestions. It was suggested to me in slack that I ought to open an issue.

My assumption was that code like

(doto (BaseClass.)
  (.| ))

would provide completion for methods of BaseClass. Instead, it looks like I get suggestions for hundreds of methods from some other clases. For example:

Screenshot 2023-11-11 084140

To get better suggestions, I need to say:

(doto ^SomeClass (SomeClass.)
  (.| ))
Screenshot 2023-11-11 084158

Also, I noticed that the completions do not consider the class inheritance hierarchy. Here, the ChildClass inherits from BaseClass:

Screenshot 2023-11-11 084820

An example repository.

Versions:

  • CIDER 1.12.0-snapshot
  • GNU Emacs 30.0.50 (build 2, x86_64-pc-linux-gnu)

lassemaatta avatar Nov 11 '23 07:11 lassemaatta

Thanks!

I'd say that the gist of this issue is similar to https://github.com/alexander-yakushev/compliment/issues/111 , except that for constructors instead of static method calls.

We currently fail to type-infer for the simplest constructor call:

image

...The good news is that the improvement is definitely at hand.

vemv avatar Nov 11 '23 19:11 vemv

Were able to fix the superclass issue.

alexander-yakushev avatar Nov 13 '23 08:11 alexander-yakushev