Fork me on GitHub
#shadow-cljs
<
2020-04-13
>
Saikyun06:04:31

is it possible to always have functions available in the cljs-repl? e.g. if I'd want (:require [cljs.repl :refer [doc]]) regardless of which ns I'm in

🎉 4
thheller08:04:34

you can just call (cljs.repl/doc foo) from anywhere. having (doc foo) available does not work without you requiring it

Saikyun14:04:58

okay, thanks. 🙂

grav11:04:59

Will fully qualified ns'es always work without requiering them in Cljs? This is not the case in Clj, right?

thheller11:04:34

no. I was assuming that at some point in time (require 'cljs.repl) was done somewhere so that the ns is loaded

thheller11:04:01

it won't work if it was not

Jakub HolĂ˝ (HolyJak)06:04:43

Hello! Why does this code from https://clojurescript.org/reference/google-closure-library#import-a-class fail in shadow REPL?

(shadow/repl :main)
;=> [:selected :main]
(import 'goog.Uri)
;------ REPL Error while processing ---------------------------------------------
;(import 'goog.Uri)
;...
;ExceptionInfo: ns* not supported (require, require-macros, import, import-macros, ... must be part of your ns form)
;	shadow.build.compiler/post-analyze (compiler.clj:95)
? OK, the error says I cannot use import, but why not / why does the page above (which, of course, is not about Shadow) talks about REPL? Is that a limitation of shadow REPL compared to vanilla cljs? (I can use the classes, just not import them)

David Pham07:04:23

Anyone managed to have pprint activated automatically in the repl as well?

Saikyun07:04:03

for just pprint, in shadow-cljs.edn:

{:devtools {:repl-pprint true}}
doc: https://shadow-cljs.github.io/docs/UsersGuide.html#_repl_3

David Pham20:04:51

Yeah... I tried but it doesn’t work with Cider.

thheller08:04:08

@holyjak I just haven't implemented import since (require 'goog.Uri) does the same

đź‘Ť 4
Jakub HolĂ˝ (HolyJak)09:04:09

Thanks! I have misunderstood > :import for Closure classes (which are also namespaces, like goog.Uri) and enums as "use import for classes". Now I understand.

thheller09:04:15

you can open a ticket so I don't forget it again. I personally just never use import so I keep forgetting to implement it properly

đź‘Ť 4
Jakub HolĂ˝ (HolyJak)13:04:02

BTW thanks for all your hard work and the amazing tool you have created!