Write code using Object.method, and have it converted to .method Object. It should also preferably only show the methods of the object for auto-completion. Cursive supports this feature as well.
I don't quite follow - you can't really write object.method in Clojure.
the idea is you could write thing.method().function() and cider could rewrite as (.function (.method thing)) or equivalent.
the benefit is that you can get good autocompletion on the function call and then let it be reversed-ish into the correct interop call
I see. The transformation itself is not hard to do, and doesn't even require CIDER. Maybe there's already something like this in clj-refactor? //cc @benedekfazekas
the benefit is that you can get good autocompletion on the function call and then let it be reversed-ish into the correct interop call
How would you get better completion candidates this way? Without static analysis they'd be the same in both cases.
There is nothing like this in cljr and i would be reluctant to add it. Writing a bit of straight java in clojure source does not feel right to me and i dont see much benefits.
I'm closing this ticket due to no recent activity. Feel free to re-open it if you ever come back to it.
I found there is a email thread on clojure mailing list, the email thread subject is "Prototype code for enhanced CIDER code completion for Java methods".
I'm not familar Java static methods, so use this Java interop (.method Obj) is really diffcult for me.
Most helpful comment
the idea is you could write
thing.method().function()and cider could rewrite as(.function (.method thing))or equivalent.the benefit is that you can get good autocompletion on the function call and then let it be reversed-ish into the correct interop call