clojure-emacs / orchard

A fertile ground for Clojure tooling
Eclipse Public License 1.0
326 stars 54 forks source link

Java source info: return `:annotated-arglists` when possible #192

Closed vemv closed 1 year ago

vemv commented 1 year ago

Fixes https://github.com/clojure-emacs/orchard/issues/190

Performs some necessary preliminary fixes and then implements #190.

A few examples of :formatted-arglists:

^void [this, ^function.BiConsumer action]
^void [^int begin, ^int end, ^int length]
^Map$Entry [^Object k, ^Object v]
^StackTraceElement[][] [^Thread threads]

Showing ^StackTraceElement[][] [^Thread threads] is far more useful to display to end users than merely [threads].

A larger corpus of samples: https://gist.github.com/vemv/45c04bf8cd794c0902077f7db9cd5f3a

Cheers - V

bbatsov commented 1 year ago

Remove constructor info for now, given it's was incorrect and incomplete (and unused from cider.el) for both Reflector and Sources

What exactly is this constructor info you're referring to? I recall constructors had normal arglists (just with multiple signatures).

Implement and return :formatted-arglists for CIDER usage

Why "formatted"? Something like "annotated" or typed arglists will probably be a more fitting name.

bbatsov commented 1 year ago

e.g. for a given constructor with 4 different signatures, maybe just 1 was being shown, so it wasn't reliable enough.

I thought we showed all possible signature together in such instances.

vemv commented 1 year ago

What exactly is this constructor info you're referring to? I recall constructors had normal arglists (just with multiple signatures).

Yes, that's we want is that and it mostly works, but it has enough inconsistencies to prevent a good solution from being built today.

I'd propose, let's keep it disabled for the extent of this PR, and the immediate next PR will re-enable them with all the changes needed for them to be correct and complete.

Otherwise I'd further bloat this PR.

At no point Orchard will be released in this transient state.

Why "formatted"? Something like "annotated" or typed arglists will probably be a more fitting name.

I initially went for "Formatted" because in the end ^void [this, ^function.BiConsumer action] is just one particular formatting - using Clojure-style syntax to describe Java arglists is a style/format that while is effective communication, it's rarely used in any context (that I know of).

However annotated seems reasonable to me if you're not convinced 👍

bbatsov commented 1 year ago

Let's go with annotated.

vemv commented 1 year ago

Finally green after many little annoyances...

I'll check this once again tomorrow with a fresher mind, then merge