Fork me on GitHub
#cider
<
2024-04-25
>
andrea.crotti10:04:16

is there a way to have some sort of autocompletion for java methods on non core objects? also cider-javadoc is not working unless it's a standard library class atm, even though cider-enrich-classpath is t , I think I saw it working before for non standard library classes

vemv10:04:14

What's an example of something that's not completing?

andrea.crotti10:04:34

(:import (org.apache.kafka.clients.consumer ConsumerRecord)
           (org.apache.kafka.clients.consumer MockConsumer)
           (org.apache.kafka.clients.consumer OffsetResetStrategy)
           (org.apache.kafka.common TopicPartition)
           ))

(def topic(def mock-cons (MockConsumer. OffsetResetStrategy/EARLIEST))

andrea.crotti10:04:47

if I create a MockConsumer object from the kafka library for example

andrea.crotti10:04:02

both javadoc and auto completion are not working

andrea.crotti10:04:27

auto completion is still tricky I guess since I have to use the (.method object) syntax

vemv10:04:18

(.method object) completion should work, even in the absence of enrich-classpath The trick is, type hints should be in place

vemv10:04:32

cider-javadoc in particular doesn't work, simply because nobody tried https://github.com/clojure-emacs/cider/issues/3619 But java docs are available in completion and in the Inspector. The result is much better than what javadocs could be - let me share a demo

oyakushev11:04:00

For object member completions to work, you either need to import that class into the current namespace, or type-hint the symbol you're completing members for and use (.method object) syntax.

andrea.crotti11:04:09

Yeah I do have the classes available in the namespace

andrea.crotti11:04:51

And I use corfu , I wonder if last time I saw it working correctly I was using company

oyakushev11:04:57

But it does complete methods from Java core?

andrea.crotti11:04:53

Actually I think it doesn't anymore

andrea.crotti11:04:08

Mm yeah what can it be then?

andrea.crotti11:04:01

I wonder if it's because I'm only getting auto completion from lsp and not cider

vemv12:04:53

I wonder if it's because I'm only getting auto completion from lsp and not ciderwell, if your setup is configured that way, then it's no wonder 😄 Corfu integration is a touch more complex than Company. It depends more on the "completion style"

vemv12:04:08

See https://github.com/clojure-emacs/cider/pull/3504 or take a look around the issue history IIRC last summer we finally fixed and documented this area, but if you find that's not the case please raise an issue.

andrea.crotti12:04:42

oh interesting I changed a few things and I do get proper completion in the repl

andrea.crotti12:04:49

but not in a clojure file

andrea.crotti12:04:31

anyway going back to company, I have other annoying things with corfu

✅ 1
andrea.crotti12:04:35

not sure why I switched anyway 😄