Is it possible to end _good_ tabs in Clojure REPL?

Completing good tabs means dynamically generating using reflection or something else (which does not require a predetermined list of refinements somewhere), and that knows what it can and cannot follow in a certain place.

Like in (.<TAB> x) I get a list of x methods, in (println <TAB>) I get a list of local and global definitions, in (Math/<TAB> I get a list of mathematical functions ...

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

+6
source share
5 answers

IClojure seems to be doing the thing more or less beautifully. It is inspired and looks like IPython and offers tab completion (not complete, 2 of 3 mentioned cases) and helps in developing Clojure in the console. Not very stable though.

0
source

See reply for a better REPL than the default. It covers two of the three use cases you mention, leaving the Java instance method.

If you are using leiningen v2 +, this is the default REPL called by the lein repl command.

+7
source

Of course, this is possible, and several tools are developing in this direction. The latest version of clojure includes a "development mode" parameter that makes it easy to create these kinds of tools ; for example, it disables local cleanup to help with debugging, and the intention is that it can eventually export much more information about the compilation process for use with the IDE and related tools. This is widely recognized as an area for improving the clojure ecosystem, and from my observations several very smart people are working on it.

+4
source

The current beta version of the Eclipse CounterClockwise REPL has significantly improved code completion and covers all of your cases, including Java termination. Except, of course, not a standalone REPL command line. Clojure is a dynamic language, but has restrictions on completion by type, which is much simpler in strongly typed languages ​​such as Haskell.

+1
source

I use Emacs as an editor with Slime and Emacs auto-complete and got all the functions that work for Repl in Emacs: autocomplete Java classes and fields, autocomplete plus documentation for Clojure functions. Unfortunately, this will not work if you are not using Emacs as an editor / IDE.

+1
source

Source: https://habr.com/ru/post/922426/


All Articles