简体   繁体   中英

How to set nREPL with Clojure CLI (tools.deps) & figwheel-main

I want to use an nREPL server to connect from Emacs Cider with Clojure CLI (tools.deps, not Leiningen) & figwheel-main. How do I set up my deps.edn or else?


I know there're nice examples for setups with Leingen&figwheel-main and tools.deps&figwheel-sidecar.

Leingen&figwheel-main: https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-within-NRepl

tools.deps&figwheel-sidecar: https://functionalbytes.nl/clojure/nodejs/figwheel/repl/clojurescript/cli/2017/12/20/tools-deps-figwheel.html


This article ( https://figwheel.org/docs/editor-integration.html ) seems to for what I want to do, but I don't find how to set environment up in real.

I have now done this and it is actually very easy. Both figwheel and cider have progressed a lot and figwheel-main is now a lot easier to setup. You can pretty much ignore most of the information in those links you have. To get going, do the following

  1. Install clj-new from here . This will let you create a new figwheel-main project using the figwheel-main template, but as a CLI tools project eg

    clj -A:new figwheel-main hello-world.core -- --reagent

2.You now need to tell cider to run the fig alias when you start cider. There are a few ways to do this, but the quickest and easiest is to use a .dir-locals.el file in the root of your repository. Put the following in the file

((clojure-mode . ((cider-clojure-cli-global-options . "-A:fig"))))

You can also set this using customize-group or in your .init.el file, but doing so will set this for all your cider projects. Using the .dir-locals.el file allows you to have project specific settings.

Now all you need to do is open one of the cljs files in your project and enter

M-x cider-jack-in-cljs

When prompted for the reply type select figwheel-main and when asked for a build, enter :dev.

That is the basics. There are lots of other things you can do to automate and enhance things, but I'll leave that for you to discover. You might also fine the following useful

CIDER Jack-in to Clojure CLI Projects From Spacemacs - what the above is based on.

figwheel-main + cli + cider - Video from Arne at Lambda Island, who I think does some excellent stuff.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM