简体   繁体   English

如何使用Clojure CLI(tools.deps)和figwheel-main设置nREPL

[英]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. 我想使用nREPL服务器通过Clojure CLI(tools.deps,而非Leiningen)和figwheel-main从Emacs Cider连接。 How do I set up my deps.edn or else? 如何设置我的deps.edn或其他?


I know there're nice examples for setups with Leingen&figwheel-main and tools.deps&figwheel-sidecar. 我知道有一些使用Leingen&figwheel-main和tools.deps&figwheel-sidecar进行安装的好示例。

Leingen&figwheel-main: https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-within-NRepl 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 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. 本文( https://figwheel.org/docs/editor-integration.html )似乎符合我想做的事情,但是我找不到真正设置环境的方法。

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 . 这里安装clj-new。 This will let you create a new figwheel-main project using the figwheel-main template, but as a CLI tools project eg 这将允许您使用figwheel-main模板创建一个新的figwheel-main项目,但作为一个CLI工具项目,例如

    clj -A:new figwheel-main hello-world.core -- --reagent 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. 2.现在,当您启动苹果酒时,您需要告诉苹果酒运行无花果别名。 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. 有几种方法可以做到这一点,但最快,最简单的方法是在存储库的根目录中使用.dir-locals.el文件。 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. 您也可以使用customize-group或在.init.el文件中进行设置,但这样做会为所有苹果酒项目设置此设置。 Using the .dir-locals.el file allows you to have project specific settings. 使用.dir-locals.el文件,您可以进行项目特定的设置。

Now all you need to do is open one of the cljs files in your project and enter 现在您需要做的就是打开项目中的cljs文件之一,然后输入

M-x cider-jack-in-cljs

When prompted for the reply type select figwheel-main and when asked for a build, enter :dev. 当提示您输入答复类型时,选择figwheel-main,并在询问是否进行构建时,输入: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. CIDER从Spacemacs插入Clojure CLI项目的插件 -上面的基础。

figwheel-main + cli + cider - Video from Arne at Lambda Island, who I think does some excellent stuff. figwheel-main + cli +苹果酒 -拉姆达岛Arne的视频,我认为他做的很出色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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