Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaces file with errors when using shadow-cljs nRepl #46

Open
tuh8888 opened this issue Nov 18, 2019 · 1 comment
Open

Replaces file with errors when using shadow-cljs nRepl #46

tuh8888 opened this issue Nov 18, 2019 · 1 comment

Comments

@tuh8888
Copy link

tuh8888 commented Nov 18, 2019

When running :Cljfmt in a .cljs file and connected to a shadow-cljs created nRepl (via vim-fireplace), my entire file gets replaced with what appears to be the output of an error message. This is especially annoying when the autosave feature is turned on. Even perfectly formatted files are replaced with errors.

Running lein cljfmt fix file.cljs works properly.

the original file

(ns tuh8888-git-hub-io.events
  (:require
   [re-frame.core :as re-frame]
   [tuh8888-git-hub-io.db :as db]))

(re-frame/reg-event-db
 ::initialize-db
 (fn [_ _]
   db/default-db)
)

the file after :Cljfmt

cljs$core$ExceptionInfo@/js/compiled/cljs-runtime/cljs.core.js:37203:10
cljs.core.ex_info.cljs$core$IFn$_invoke$arity$3@/js/compiled/cljs-runtime/cljs.core.js:37264:9
cljs.core.ex_info.cljs$core$IFn$_invoke$arity$2@/js/compiled/cljs-runtime/cljs.core.js:37260:26
cljs.tools.reader.impl.errors.throw_ex.cljs$core$IFn$_invoke$arity$variadic@/js/compiled/cljs-runtime/cljs.tools.reader.impl.errors.js:52:25
cljs.tools.reader.impl.errors.eof_error.cljs$core$IFn$_invoke$arity$variadic@/js/compiled/cljs-runtime/cljs.tools.reader.impl.errors.js:168:47
cljs$tools$reader$impl$errors$throw_eof_at_start@/js/compiled/cljs-runtime/cljs.tools.reader.impl.errors.js:224:48
cljs$tools$reader$read_token@/js/compiled/cljs-runtime/cljs.tools.reader.js:46:38
rewrite_clj$reader$read_keyword@rewrite_clj/reader.cljs:253:29
rewrite_clj$parser$keyword$parse_keyword@rewrite_clj/parser/keyword.cljs:21:35
rewrite_clj$reader$read_with_meta@rewrite_clj/reader.cljs:186:110
rewrite_clj$parser$core$parse_next@rewrite_clj/parser/core.cljs:249:27
rewrite_clj$parser$core$parse_delim/<@rewrite_clj/parser/core.cljs:19:200
rewrite_clj$reader$read_repeatedly/<@rewrite_clj/reader.cljs:206:105
cljs.core.repeatedly.cljs$core$IFn$_invoke$arity$1/<@/js/compiled/cljs-runtime/cljs.core.js:18732:96
cljs.core.LazySeq.prototype.sval@/js/compiled/cljs-runtime/cljs.core.js:11576:109
cljs.core.LazySeq.prototype.cljs$core$ISeqable$_seq$arity$1@/js/compiled/cljs-runtime/cljs.core.js:11727:10
cljs$core$_seq@/js/compiled/cljs-runtime/cljs.core.js:2452:10
cljs$core$seq@/js/compiled/cljs-runtime/cljs.core.js:4497:18
cljs.core.take_while.cljs$core$IFn$_invoke$arity$2/<@/js/compiled/cljs-runtime/cljs.core.js:31631:36
cljs.core.LazySeq.prototype.sval@/js/compiled/cljs-runtime/cljs.core.js:11576:109
cljs.core.LazySeq.prototype.cljs$core$ISeqable$_seq$arity$1@/js/compiled/cljs-runtime/cljs.core.js:11727:10
cljs$core$_seq@/js/compiled/cljs-runtime/cljs.core.js:2452:10
cljs$core$seq@/js/compiled/cljs-runtime/cljs.core.js:4497:18
cljs.core.dorun.cljs$core$IFn$_invoke$arity$1@/js/compiled/cljs-runtime/cljs.core.js:32971:36
cljs.core.doall.cljs$core$IFn$_invoke$arity$1@/js/compiled/cljs-runtime/cljs.core.js:33027:17
rewrite_clj$reader$read_repeatedly@rewrite_clj/reader.cljs:205:24
rewrite_clj$parser$core$parse_delim@rewrite_clj/parser/core.cljs:14:27
rewrite_clj$parser$core$parse_list@rewrite_clj/parser/core.cljs:82:40
rewrite_clj$reader$read_with_meta@rewrite_clj/reader.cljs:186:110
rewrite_clj$parser$core$parse_next@rewrite_clj/parser/core.cljs:249:27
rewrite_clj$parser$core$parse_delim/<@rewrite_clj/parser/core.cljs:19:200
rewrite_clj$reader$read_repeatedly/<@rewrite_clj/reader.cljs:206:105
cljs.core.repeatedly.cljs$core$IFn$_invoke$arity$1/<@/js/compiled/cljs-runtime/cljs.core.js:18732:96
cljs.core.LazySeq.prototype.sval@/js/compiled/cljs-runtime/cljs.core.js:11576:109
cljs.core.LazySeq.prototype.cljs$core$ISeqable$_seq$arity$1@/js/compiled/cljs-runtime/cljs.core.js:11727:10
cljs$core$_seq@/js/compiled/cljs-runtime/cljs.core.js:2452:10
cljs$core$seq@/js/compiled/cljs-runtime/cljs.core.js:4497:18
cljs.core.take_while.cljs$core$IFn$_invoke$arity$2/<@/js/compiled/cljs-runtime/cljs.core.js:31631:36
cljs.core.LazySeq.prototype.sval@/js/compiled/cljs-runtime/cljs.core.js:11576:109
cljs.core.LazySeq.prototype.cljs$core$ISeqable$_seq$arity$1@/js/compiled/cljs-runtime/cljs.core.js:11727:10
cljs$core$_seq@/js/compiled/cljs-runtime/cljs.core.js:2452:10
cljs$core$seq@/js/compiled/cljs-runtime/cljs.core.js:4497:18
cljs.core.Cons.prototype.cljs$core$INext$_next$arity$1@/js/compiled/cljs-runtime/cljs.core.js:11062:18
cljs$core$_next@/js/compiled/cljs-runtime/cljs.core.js:1809:13
cljs$core$next@/js/compiled/cljs-runtime/cljs.core.js:4573:18
cljs.core.dorun.cljs$core$IFn$_invoke$arity$1@/js/compiled/cljs-runtime/cljs.core.js:32974:26
cljs.core.doall.cljs$core$IFn$_invoke$arity$1@/js/compiled/cljs-runtime/cljs.core.js:33027:17
rewrite_clj$reader$read_repeatedly@rewrite_clj/reader.cljs:205:24
rewrite_clj$parser$core$parse_delim@rewrite_clj/parser/core.cljs:14:27
rewrite_clj$parser$core$parse_list@rewrite_clj/parser/core.cljs:82:40
rewrite_clj$reader$read_with_meta@rewrite_clj/reader.cljs:186:110
rewrite_clj$parser$core$parse_next@rewrite_clj/parser/core.cljs:249:27
rewrite_clj$parser$parse@rewrite_clj/parser.cljs:10:32
rewrite_clj$parser$parse_all/nodes<@rewrite_clj/parser.cljs:17:27
cljs.core.repeatedly.cljs$core$IFn$_invoke$arity$1/<@/js/compiled/cljs-runtime/cljs.core.js:18732:96
cljs.core.LazySeq.prototype.sval@/js/compiled/cljs-runtime/cljs.core.js:11576:109
cljs.core.LazySeq.prototype.cljs$core$ISeqable$_seq$arity$1@/js/compiled/cljs-runtime/cljs.core.js:11727:10
cljs$core$_seq@/js/compiled/cljs-runtime/cljs.core.js:2452:10
cljs$core$seq@/js/compiled/cljs-runtime/cljs.core.js:4497:18
cljs.core.take_while.cljs$core$IFn$_invoke$arity$2/<@/js/compiled/cljs-runtime/cljs.core.js:31631:36
cljs.core.LazySeq.prototype.sval@/js/compiled/cljs-runtime/cljs.core.js:11576:109
cljs.core.LazySeq.prototype.cljs$core$ISeqable$_seq$arity$1@/js/compiled/cljs-runtime/cljs.core.js:11727:10
cljs$core$_seq@/js/compiled/cljs-runtime/cljs.core.js:2452:10
cljs$core$seq@/js/compiled/cljs-runtime/cljs.core.js:4497:18
cljs.core.dorun.cljs$core$IFn$_invoke$arity$1@/js/compiled/cljs-runtime/cljs.core.js:32971:36
cljs.core.doall.cljs$core$IFn$_invoke$arity$1@/js/compiled/cljs-runtime/cljs.core.js:33027:17
rewrite_clj$parser$parse_all@rewrite_clj/parser.cljs:16:29
rewrite_clj$parser$parse_string_all@rewrite_clj/parser.cljs:31:27
cljfmt.core.reformat_string.cljs$core$IFn$_invoke$arity$variadic@cljfmt/core.cljc:673:98
cljfmt$core$reformat_string@cljfmt/core.cljc:667:36
@http://localhost:8280/js/compiled/app.js line 836 > eval line 832 > eval:1:55
shadow$cljs$devtools$client$browser$global_eval@/js/compiled/cljs-runtime/shadow.cljs.devtools.client.browser.js:832:16
shadow$cljs$devtools$client$browser$repl_invoke/result<@/js/compiled/cljs-runtime/shadow.cljs.devtools.client.browser.js:842:44
shadow$cljs$devtools$client$env$repl_call@/js/compiled/cljs-runtime/shadow.cljs.devtools.client.env.js:159:108
shadow$cljs$devtools$client$browser$repl_invoke@/js/compiled/cljs-runtime/shadow.cljs.devtools.client.browser.js:840:46
shadow$cljs$devtools$client$browser$handle_message@/js/compiled/cljs-runtime/shadow.cljs.devtools.client.browser.js:925:37
shadow$cljs$devtools$client$env$process_ws_msg/<@/js/compiled/cljs-runtime/shadow.cljs.devtools.client.env.js:308:151
shadow$cljs$devtools$client$env$process_next_BANG_@/js/compiled/cljs-runtime/shadow.cljs.devtools.client.env.js:287:90
shadow$cljs$devtools$client$env$process_ws_msg@/js/compiled/cljs-runtime/shadow.cljs.devtools.client.env.js:312:40
shadow$cljs$devtools$client$browser$ws_connect/socket.onmessage@/js/compiled/cljs-runtime/shadow.cljs.devtools.client.browser.js:1021:40

my .lein/profiles.clj

{:user {:plugins [[jonase/eastwood "0.3.5"]
                  [lein-cljfmt "0.6.5"]]
        :dependencies [[cljfmt "0.5.1"]]}}

my project.clj

(defproject tuh8888-git-hub-io "0.1.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.10.1"]
                 [org.clojure/clojurescript "1.10.520"
                  :exclusions [com.google.javascript/closure-compiler-unshaded
                               org.clojure/google-closure-library]]
                 [thheller/shadow-cljs "2.8.69"]
                 [reagent "0.8.1"]
                 [re-frame "0.10.9"]
                 [garden "1.3.9"]
                 [ns-tracker "0.4.0"]
                 [compojure "1.6.1"]
                 [yogthos/config "1.1.6"]
                 [ring "1.7.1"]

                 [metosin/reitit "0.3.9"]]

  :plugins [[lein-garden "0.3.0"]
            [lein-shell "0.5.0"]]

  :min-lein-version "2.5.3"

  :source-paths ["src/clj" "src/cljs"]

  :clean-targets ^{:protect false} ["resources/public/js/compiled" "target"
                                    "resources/public/css"]


  :garden {:builds [{:id           "screen"
                     :source-paths ["src/clj"]
                     :stylesheet   tuh8888-git-hub-io.css/screen
                     :compiler     {:output-to     "resources/public/css/screen.css"
                                    :pretty-print? true}}]}

  :shell {:commands {"open" {:windows ["cmd" "/c" "start"]
                             :macosx  "open"
                             :linux   "xdg-open"}}}

  :aliases {"dev"          ["with-profile" "dev" "do"
                            ["clean"]
                            ["run" "-m" "shadow.cljs.devtools.cli" "watch" "app"]]
            "prod"         ["with-profile" "prod" "do"
                            ["clean"]
                            ["run" "-m" "shadow.cljs.devtools.cli" "release" "app"]]
            "build-report" ["with-profile" "prod" "do"
                            ["clean"]
                            ["run" "-m" "shadow.cljs.devtools.cli" "run" "shadow.cljs.build-report" "app" "target/build-report.html"]
                            ["shell" "open" "target/build-report.html"]]
            "karma"        ["with-profile" "prod" "do"
                            ["clean"]
                            ["run" "-m" "shadow.cljs.devtools.cli" "compile" "karma-test"]
                            ["shell" "karma" "start" "--single-run" "--reporters" "junit,dots"]]}

  :profiles
  {:dev
   {:dependencies [[binaryage/devtools "0.9.10"]]}

   :prod { }

   :uberjar {:source-paths ["env/prod/clj"]
             :omit-source  true
             :main         tuh8888-git-hub-io.server
             :aot          [tuh8888-git-hub-io.server]
             :uberjar-name "tuh8888-git-hub-io.jar"
             :prep-tasks   ["compile" ["prod"]["garden" "once"]]}
   })

my shadow-cljs.edn

{:lein   true

 :nrepl {:port 8777}

 :builds {:app {:target          :browser
                :output-dir      "resources/public/js/compiled"
                :asset-path      "/js/compiled"
                :modules         {:app {:init-fn tuh8888-git-hub-io.core/init
                                        :preloads [devtools.preload]}}
                :devtools        {:http-root    "resources/public"
                                  :http-port    8280
                                  :http-handler tuh8888-git-hub-io.handler/dev-handler
                                  }}}}
@germank
Copy link

germank commented Jun 16, 2020

Same here, using leiningen repl. To temporarily fix this, I'm now using vim-fireplace v2.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants