Just discovered Dirac, wow, am blown away. But I have an issue where I can see all the refers and aliases of the current namespace in the autocomplete menu, but when I try to access or use them, I get back undefined. Using the fully qualified symbols works just fine. Any guidance on how I can resolve this?
hi, this will be tricky diagnose over slack, it would be great if you could isolate it to minimal case and share your project
I would look into it
btw. do you use figwheel or some hot-reloading? autocompletion goes out-of-sync for hot-reloaded code
Yeah, I have boot-figreload as well
just make sure that you are seeing the problem after first full load without any hot-reloading
Yeah, that's the case
Will create a minimal repro :thumbsup:
FYI, this is the function which is used to “understand” aliases: https://github.com/binaryage/dirac/blob/master/src/implant/dirac/implant/analyzer.cljs#L32
it uses clojure.tools.namespace.parse
@adamrenklint wait, maybe you are not in proper namespace? did you use in-ns
to switch? please follow https://github.com/binaryage/dirac-sample#hello-world
Yeah, definitely did that. A minimal repro comes in ~10 minutes, just finishing up the instructions.
@darwin here it is: https://github.com/adamrenklint/dirac-repro
thanks, going look into that right now
@adamrenklint having some problem running boot dev
on my machine, clojure.lang.ExceptionInfo: Call to clojure.core/defn- did not conform to spec:
what is your boot version?
@darwin uploaded a file: https://clojurians.slack.com/files/U08E3BBST/F8ZNGQDM0/-.clj
Same as you 😕
it looks like something is wrong with generate-lein-project-file!
in boot
I noticed my clojure updated recently (via homebrew), maybe they have some more strict specs included
Ok, let me install Clojure via Brew and see if I get the same error
ok, mine is at 1.9.0.315
brew info clojure
hm, I switched brew to 1.9.0.297 and still the same issue, so that is probably not the case
Yeah, I have 1.9.0.315 via brew now, and boot dev
is still working
Need to lookup what this generate-lein-project-file!
is, never heard of it before
here is the full error: https://gist.github.com/darwin/338e5eec68cf1ed0e7c516a45830fd7c
@darwin shared a file: https://clojurians.slack.com/files/U08E3BBST/F8ZN1RTNG/gistfile1.txt
I will try to disable spec checks for now
I should be able to disable it via clojure.spec.skip-macros, but setting it as env variable does not work for me
btw. no boot commands work, all throwing
I’m going to install it differently
not via brew
Hmm, weird
hm, no, even their one-liner installer script is broken for me
:poop:
this is definitely something about my machine, investigating
The only reference to the issue I find is here: https://clojurians-log.clojureverse.org/boot/2017-03-03.html
But yeah, sounds like your machine has other issues
the problem is how to force that fancy boot trace to show full paths
maybe I have some obsolete boot version lingering somewhere and it is using it
looking for a way how to disable it or at least change it to full paths
the problem is that generate-lein-project-file! does not conform to fn or macro specs, so it looks like old code or I have too recent specs or my specs are somehow confused
maybe by installing some dev version of clojure or something like that
It's weird, because the project I sent you has a boot.properties
file, so the Clojure and Boot version used should come from there
Of course, the Boot loaded (a Go app, I think) is the one installed with Brew or by other means
Try deleting ~/.boot 😸
That's what I do when things get messy
Oh BTW, I have JDK9. Not sure how that would make a difference in any way, but mentioning it anyway
ok, removing ~/.boot
fixed it
there was something fishy there I guess
:thumbsup:
I’m not familiar with boot, didn’t start using it, but I agree it is a better way than lein
ok, I confirm that your steps are reproducible here with my dev build of dirac
so I will be able to investigate
Ok cool, so I'm not crazy 😛
@adamrenklint I think the issue is in your REPL, normally you should do (require 'dirac-repro.core)
before you in-ns into it
this way REPL would be generating code aware of all definitions in the namespace
but for some reason it does not work with your repl
I’m not sure what boot is doing there, but we should be able to run stanalone clojurescript repl driven by boot and test it there
btw. the code generated by the REPL can be seen in devtools unders Sources/left tree/dirac-repl
it looks like require in your REPL is broken and it does not read the file
on repl side
(require 'dirac-repro.core)
followed by (in-ns 'dirac-repro.core)
and then as-aliased
generates dirac_repro.core.as_aliased
javascript
it should generate dirac_repro.as_aliased
javascript
When you say your repl, which piece are you referring to?
org.clojure/tools.nrepl?
Sorry, a complete noob when it comes to REPLs, so not much experience to draw from
A child of save->reload trying to evolve 🙂
I’m not sure here, because whole REPL situation is pretty huge mess, right now I have unloaded whole context out of my head
I wrote this piece, when I had it in my head 😉 https://github.com/binaryage/dirac/blob/master/docs/about-repls.md
I’m now goint to try the same thing in dirac-sample project, which is driven by lein’s repl machinery, and compare the behaviour
@adamrenklint ok, now I understand
the system works as expected, your only mistake was not using require
using namespace alias alone does not refer to the namespace javascript object, e.g. reagent
or as-aliased
alone is not treated as something meaningful
as-aliased/some-func
will work
Ah ok
Thanks for digging into it, much appreciated!
I got confused by that namespace-only thing, I would also expect it to work
I'll boot up my large project and try it there
btw. figwheel’s repl is able to do those requires automagically for you, because figwheel knows about your cljs project (for hotloading) and is loading them anyways
but it is not easy to force dirac to use figwheel’s repl, that is very advanced setup
I described it here: https://github.com/binaryage/dirac/blob/master/docs/about-repls.md#dirac--figwheel
Ok, will read through that and play a bit 🙂
Is there a reference implementation of that setup somewhere?
https://github.com/binaryage/dirac-sample/blob/master/project.clj#L170-L196
it starts vanilla clojure REPL, inside it starts figwheel’s sidecar and Dirac Agent
Dirac should be able to detect this situation and talk to figwheel’s repl
Ok interesting, I'll give that a try tomorrow
Thanks a bunch for taking the time to help me!
I just tested it and it works here, running lein repl-figwheel
instead of lein repl
then in dirac prompt dirac :fig
shows fighweel status
dirac :ls
shows all compiler sessions on server side
dirac :switch 2
switches to figwheel session in my case
from that point repl is aware of hot-reloaded code and requires are no longer needed
unfortunately dirac
command in dirac prompt has broken formatting, some CSS went wrong, will fix this eventually