Question

Good tab completions means dynamically generated using reflection or whatever (that does not require pre-defined list of completions somewhere) and that knows what can and what can't follow in particular place.

Like in (.<TAB> x) I'll get list of methods of x, in (println <TAB>) I get list of local and global definitions, in (Math/<TAB> I get the list of math functions...

For example I like how Tab works in ghci (Haskell) or ipython.

Was it helpful?

Solution 5

Looks like IClojure does the thing more or less nicely. It is inspired and looks like IPython and offers tab completion (not full, 2 of 3 cases mentioned) and helps developing Clojure in console. Not very stable although.

OTHER TIPS

Have a look at reply for a better REPL than the default one. It covers two out of three use cases you mention, leaving the Java instance method completion out.

If you use leiningen v2+ it's the default REPL invoked by the lein repl command.

It is certainly possible and several of the tools are evolving in that direction. The newest version of clojure includes a "development mode" option that makes building this sort of tool easier; for instance it turns off local clearing to aid in debugging and the intention is for it to be able to eventually export a lot more information about the compilation process for use by IDEs and related tools. This is widely recognized as an area to improve the Clojure ecosystem and from my observations several very smart people are working on it.

The current beta version of the Eclipse CounterClockwise REPL has greatly improved code completion, and covers all your cases, including Java completion. Except of course not being a standalone commandline REPL. Clojure being a dynamic language however has it's limitations on completions on type, something that's a lot easier in strongly typed languages like Haskell.

I'm using Emacs as an editor with Slime and Emacs auto-complete, and got all of those features working for the Repl within Emacs: auto-completion for Java classes and fields, auto-completion plus documentation for Clojure functions. Unfortunately that won't work if you are not using Emacs as an editor/IDE.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top