使用Clojure CLI时无法使用firewall.vim评估ClojureScript

问题描述 投票:0回答:1

我本来希望尝试使用the new release of ClojureScript,但是在尝试评估代码时遇到了问题。

我正在运行一个nREPL服务器,并且(似乎?)可以使用:Fireplaceconnect localhost:$PORT连接到它。但是,当我尝试评估代码时(使用:Eval:CljsEval),我看到一条错误消息,内容为“壁炉:无默认ClojureScript REPL”。

[firewall.vim存储库中有an issue,它提到了此问题,但已用RTFM关闭-我有,但仍然找不到解决方案。

〜/ .clojure / deps.edn

{
  :aliases {:nREPL
             {:extra-deps
               {nrepl/nrepl {:mvn/version "0.7.0"}
                cider/piggieback {:mvn/version "0.4.2"}}}}
}

开始nrepl

> clj -R:nREPL -m nrepl.cmdline --middleware "[cider.piggieback/wrap-cljs-repl]"
vim clojurescript vim-plugin
1个回答
0
投票

我找到了可行的解决方案,并记录了整个工作流程here

deps.edn:

{
 :aliases {:rebel {:main-opts ["-m" "rebel-readline.main"]}}
 :paths ["src" "resources" "target"]
 :deps {cider/cider-nrepl {:mvn/version "0.25.0-alpha1"}
        cider/piggieback {:mvn/version "0.5.0"}
        com.bhauman/figwheel-main {:mvn/version "0.2.6"}
        com.bhauman/rebel-readline {:mvn/version "0.1.4"}
        com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}
        nrepl/nrepl {:mvn/version "0.7.0"}
        org.clojure/clojure {:mvn/version "1.10.1"}
        org.clojure/clojurescript {:mvn/version "1.10.773"}
        reagent {:mvn/version "0.10.0"
                 :exclusions [cljsjs/react cljsjs/react-dom]}}}

在Clojure REPL内部,运行以下命令来启动nREPL服务器,ClojureScript REPL和Figwheel构建:

(require '[fullstack.helpers :refer :all])  ;; import nREPL helpers
(start-nrepl-server!)                       ;; start nREPL server on 7888

;; Some people run the following commands using Vim-Fireplace's `:CljEval`
;; command but I found that to be a little clunky.
;; If I do end up using this workflow regularly, I'll consider packaging these
;; steps up in a VimScript helper function.
;; Out of habit, I send them from this document inside vim to a parallel tmux
;; pane using vim-slime.

(require 'figwheel.main.api)    ;; require Figwheel's scripting API
(figwheel.main.api/start "dev") ;; start Figwheel build (using dev.cljs.edn) and REPL

在Vim中,在CLI提示符下运行以下命令(在命令模式下单击:,以连接到正在运行的ClojureScript REPL:

:Piggieback (figwheel.main.api/repl-env "dev") " connect to the CLJS REPL

主要区别在于将依赖关系移至本地deps.edn(这不是必需的,但我认为这是一种更好,更灵活的方法),升级了Piggieback并依靠更高级别的Figwheel脚本API,而不是CLI标志。

© www.soinside.com 2019 - 2024. All rights reserved.