Fork me on GitHub
#vim
<
2020-12-05
>
Timofey Sitnikov11:12:32

Good Morning Clojurians, When I try to follow: https://book.fulcrologic.com/#_build_it, and and execute:

[I] /home/sporty/clojure/fulcro/app1~> npx shadow-cljs server
shadow-cljs - config: /home/sporty/clojure/fulcro/app1/shadow-cljs.edn
shadow-cljs - starting via "clojure"
shadow-cljs - HTTP server available at 
shadow-cljs - server version: 2.11.8 running at 
shadow-cljs - nREPL server started on port 9000
I am trying to connect to it with https://liquidz.github.io/vim-iced/#clojurescript_shadow_cljs, the vim-iced, requires execution of $ iced repl {YOUR-BUILD-ID} command. What is the {YOUR-BUILD-ID}?

lispyclouds11:12:36

@timofey.sitnikov according to https://book.fulcrologic.com/#_shadow_cljs_build_tool_configuration It should be :main i think. Its the key that you have used in the :builds key in shadow-cljs.edn

Timofey Sitnikov12:12:32

I tried this:

[I] /home/sporty/clojure/fulcro/app1~> iced repl :main
OK: CLJS option is enabled.
OK: Clojure CLI project is detected
Execution error (FileNotFoundException) at java.io.FileInputStream/open0 (FileInputStream.java:-2).
:main (No such file or directory)

Full report at:
/tmp/clojure-12744298337363785468.edn
Content of the /tmp/clojure-12744298337363785468.edn report:
{:clojure.main/message
 "Execution error (FileNotFoundException) at java.io.FileInputStream/open0 (FileInputStream.java:-2).\n:main (No such file or directory)\n",
 :clojure.main/triage
 {:clojure.error/class java.io.FileNotFoundException,
  :clojure.error/line -2,
  :clojure.error/cause ":main (No such file or directory)",
  :clojure.error/symbol java.io.FileInputStream/open0,
  :clojure.error/source "FileInputStream.java",
  :clojure.error/phase :execution},
 :clojure.main/trace
 {:via
  [{:type java.io.FileNotFoundException,
    :message ":main (No such file or directory)",
    :at [java.io.FileInputStream open0 "FileInputStream.java" -2]}],
  :trace
  [[java.io.FileInputStream open0 "FileInputStream.java" -2]
   [java.io.FileInputStream open "FileInputStream.java" 219]
   [java.io.FileInputStream <init> "FileInputStream.java" 157]
   [java.io.FileInputStream <init> "FileInputStream.java" 112]
   [clojure.lang.Compiler loadFile "Compiler.java" 7571]
   [clojure.main$load_script invokeStatic "main.clj" 475]
   [clojure.main$script_opt invokeStatic "main.clj" 535]
   [clojure.main$script_opt invoke "main.clj" 530]
   [clojure.main$main invokeStatic "main.clj" 664]
   [clojure.main$main doInvoke "main.clj" 616]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.main main "main.java" 40]],
  :cause ":main (No such file or directory)"}}
Among others, I also tried:
$ iced repl main

lispyclouds12:12:53

Right so this took a bit of figuring out as Im not very familiar with the cljs ecosystem 😕 - Use iced repl instead of passing the build id to start the repl - Open the browser on localhost:8000 or the port you configured in shadow-cljs.edn - Then inside vim, go to your cljs file and run the vim command: :IcedConnect it should prompt for the repl type, choose shadow-cljs - Then run the vim command :IcedStartCljsRepl shadow-cljs main to start the repl

lispyclouds12:12:32

Im quite sure there's a better way/im missing something 😕

lispyclouds12:12:00

Maybe @UBL24PLE6 knows better?

Timofey Sitnikov12:12:48

Tried it, but it looks like the iced repl does launch a REPL but it does not launch the server on the localhost:8000. I will try to require the source into the namesapce, enter namespace and launch the server manually?

uochan13:12:09

@timofey.sitnikov It should be main as a {YOUR-BUILD-ID} > OK: Clojure CLI project is detected It seems deps.edn is detected (higher priority than shadow-cljs.edn), so you should also use --force-shadow-cljs option.

3
Timofey Sitnikov13:12:25

OK, so I run the command:

[I] /home/sporty/clojure/fulcro/app1~> iced repl --force-shadow-cljs main
OK: CLJS option is enabled.
OK: shadow-cljs project is detected
OK: For shadow-cljs project, start watching instead of starting REPL.
shadow-cljs - config: /home/sporty/clojure/fulcro/app1/shadow-cljs.edn
shadow-cljs - connected to server
shadow-cljs - watching build :main
[:main] Configuring build.
[:main] Compiling ...
[:main] Build completed. (251 files, 1 compiled, 1 warnings, 3.10s)
Everything still works in browsers, but when I am back in vim and i type: :IcedConnect, I get this:
iced-nrepl is not enabled. Please launch repl with `iced repl` command.

Timofey Sitnikov13:12:17

Interesting, when I execute :IcedConnect second time, I get Already Connected. The I can execute: IcedEval (+1 2) and I get 3, but when I execute :IcedEval (js/alret "Hi") I get No such namespace: js

uochan13:12:54

Do you have .nrepl.edn or $HOME/.nrepl/nrepl.edn? iced is created automatically if these are absent, but if they are present, the contents have not been confirmed so far. So could you add middleware setting as follows? https://liquidz.github.io/vim-iced/vim-iced.html#vim-iced-manual-shadow-cljs

3
uochan13:12:07

Maybe you are in CLJ session instead of CLJS session becase of the middleware missing error.

Timofey Sitnikov13:12:10

Wow, I was not even close. I did not have the .nrepl.edn, even worse, I did not have the middleware dependencies that supposed to be in the shadow-cljs.edn. When I do place them in the shadow-cljs.edn , I get :

=============================================================================
WARNING: The configured :dependencies in shadow-cljs.edn were ignored!
         When using :deps they must be configured in deps.edn
==============================================================================
So somehow I have to place it into deps.edn.

Timofey Sitnikov14:12:12

OK, that solved it! deps.edn needs the nrepl dependencieds, like this:

:aliases {:dev {:extra-paths ["src/dev"]
                 :extra-deps  {org.clojure/clojurescript     {:mvn/version "1.10.742"}
                               thheller/shadow-cljs          {:mvn/version "2.11.8"}
                               binaryage/devtools            {:mvn/version "0.9.10"}
                               refactor-nrepl/refactor-nrepl {:mvn/version "2.5.0"}
                               cider/cider-nrepl             {:mvn/version "0.25.5"}
                               iced-nrepl/iced-nrepl         {:mvn/version "1.1.1"}}}}}

Timofey Sitnikov14:12:59

Thank you so much.

Timofey Sitnikov14:12:03

I am just a beginner, cljs supposed to be simple and easy, and it is, if you know all of the details.

Timofey Sitnikov12:12:18

I did bunch of research on this and decided to make notes for myself:

Tim Robinson19:12:37

hi all - a very simple question: when I do an eval with fireplace that prints to standard output, I'm not seeing the output anywhere in vim or in my "lein repl" window. Is there a way to see it?

Jan K19:12:20

For me println output shows directly in vim. My only idea is check if you're using cider-nrepl in your lein profile/plugins + make sure you're using latest everything

Tim Robinson21:12:52

hmm thanks. pretty sure I'm using the latest everything but I'm on Windows so maybe that's the difference.