vim

For discussion on all things (neo)vim.
Timofey Sitnikov 2020-12-05T11:42:32.247900Z

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 <http://localhost:8000>
shadow-cljs - server version: 2.11.8 running at <http://localhost:9630>
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}?

lispyclouds 2020-12-05T11:57:36.249100Z

@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 Sitnikov 2020-12-08T12:20:18.256600Z

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

Timofey Sitnikov 2020-12-08T12:20:22.256800Z

https://bubbleuptoppop.com/blog/vim-iced-clojurescript/

Timofey Sitnikov 2020-12-05T12:04:32.249200Z

I tried this:

[I] /home/sporty/clojure/fulcro/app1~&gt; 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 &lt;init&gt; "FileInputStream.java" 157]
   [java.io.FileInputStream &lt;init&gt; "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

lispyclouds 2020-12-05T12:29:53.249400Z

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

lispyclouds 2020-12-05T12:30:32.249600Z

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

lispyclouds 2020-12-05T12:34:00.249800Z

Maybe @liquidz.uo knows better?

Timofey Sitnikov 2020-12-05T12:47:48.250Z

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?

2020-12-05T13:07:09.250200Z

@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.

1
Timofey Sitnikov 2020-12-05T13:19:25.250500Z

OK, so I run the command:

[I] /home/sporty/clojure/fulcro/app1~&gt; 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 Sitnikov 2020-12-05T13:26:17.250700Z

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

2020-12-05T13:26:54.250900Z

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

1
2020-12-05T13:28:07.251100Z

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

Timofey Sitnikov 2020-12-05T13:55:10.251300Z

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 Sitnikov 2020-12-05T14:13:12.251500Z

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 Sitnikov 2020-12-05T14:13:59.251800Z

Thank you so much.

Timofey Sitnikov 2020-12-05T14:15:03.252Z

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

Tim Robinson 2020-12-05T19:11:37.254Z

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 K 2020-12-05T19:27:20.255500Z

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 Robinson 2020-12-05T21:30:52.256400Z

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