Search code examples
intellij-ideaemacsclojureclojurescriptspacemacs

Code completion for external libraries for Spacemacs


In IntelliJ with Cursive plugin we have code completion, which

helps you complete the names of classes, methods, fields, and keywords within the visibility scope. When you invoke code completion, IntelliJ IDEA analyses the context and suggests the choices that are reachable from the current position of the caret.

When a project is indexed this also finds methods in imported libraries:

Working

Here we pop up all methods available in reagent.core after I type reagent/.

I want to have the same behaviour in Spacemacs with Clojure mode. What I get is only the already defined names in the same file:

Spacemacs does not show all possibilities

What I tried is generating a TAGS file with ctags by pressing <SPC> p G. But this seems not equivalent of IntelliJ's indexing since it shows other completions, like so:

enter image description here

Is it possible to display the completions from imported libraries in Spacemacs Clojure in the same way as IntelliJ Cursive can? And if so, how?


Solution

  • Clojure support in Spacemacs is configured by adding the clojure layer.

    Edit ./spacemacs and add clojure to the list of layers defined in `dotspacemacs-configuration-layers function

    Restarting Emacs will download by the related packages for Clojure.