@darwin: I am using some library which catches (assert false)
which is bad; because I like getting exceptions + debugging stack frames in dirac/cljs-devtools. Rethrowing is not getting the stack frames I want.
My question now: instead of (assert false)
, can I do something like (call-dirac-break-point)
where my code, instead of throwing an exception, directly interacts with dirac to cause dirac to have a break point there? [I realize this would only work in dev mode, and that is fine.]
Basically, instead of jumping into dira/cljsdevtools via (assert false) [which other code can catch / screw up], I'd directly like to make a call into dirac-break-here.
can I do something involving https://github.com/binaryage/dirac/search?utf8=%E2%9C%93&q=js-debugger that triggers the debugger ?
@qqq I’m afraid nothing like that is supported
js-debugger is just clojurescript version of “debugger;” statement in javascript
nothing special
I think nothing is stopping you to do that instead of assert, so you get a conditional breakpoint
sorry, I don't understand the alternative you are proposing
can I set dirac breakpoints in my cljs files directly, without using the cljs-devtools-browser-ui ?
if I could do that, it'd suffice
what is cljs-devtools-browser-ui?
I don't know the proper name of the gui window that pops up when I click on the "dirac extension" inside of "chrome canary"
What should I call it ?
that is Dirac DevTools, which is a fork of Chrome DevTools
cljs-devtools is completely independent and technically unrelated project
yes, but "dirac devtools" consists of that ui + parts in nrepl + parts in cljs code + dirac agent
shoudl I call the ui part "dirac devtools" ?
cljs-devtools provides bunch of custom formatters to present cljs data structure in chrome console
it does not require dirac to work
I see, my mistake is confusing cljs-devtools (which provides pretty printing in clj format) with dirac-devtools
yes, the ui part should be callled “dirac devtools"
whole set of tools just “dirac"
so back to your breakpoints
oh wow, changing (assert (...)) to
(if-not (...)
(js-debugger))
appears to ahve workeddebugger; statement is normal javascript feature supported by stock chrome devtools
dirac does nothing special here
yes, you should replace assert with something like the code above
great; thanks for clarifying 🙂
there are other tricks you could do, but I’m not sure if you should go that route, you could schedule an async call and throw assert exception there
this way you would work-around that om-catch which is eating your exceptions
something like this: https://github.com/binaryage/cljs-devtools/blob/master/src/lib/devtools/async.cljs#L13
going off, good luck!
thanks again!
I have a data structure which is a LIST of VECTORS. When I view the local in the "local scope vars" or in (. js/console log), I do NOT want to see
( [:foo 1] [:bar 2] [:cat 3] [:dog 444])
instead, I would prefer to see
([:foo 1]
[:bar 2]
[:cat 3]
[:dog 444])
is there anyway I can specify horiz vs vert rendering via meta -- or if not, add extra junk elements to change the way whether dirac choose horiz vs vertical?is there a way to tell dirac that instead of localhost:8230, it should look for this-ip:8230 ?
@giles @richiardiandrea @darwin : did this ever got resolved? https://clojurians-log.clojureverse.org/dirac/2016-08-23.html I'm basically running into the ezact issue
@qqq you could try to tweak cljs-devtools prefs, for example this one controls how many items you need to render “expanson disclosure triangle button"
https://github.com/binaryage/cljs-devtools/blob/master/src/lib/devtools/defaults.cljs#L42
as of the second issue, you probably need to tweak nrepl config, which controls weasel configuration: https://github.com/binaryage/dirac/blob/master/src/nrepl/dirac/nrepl/config.clj#L19
you want to replace “localhost” with the IP where your Dirac agent is running
here you have some docs how this works: https://github.com/binaryage/dirac/blob/master/docs/configuration.md#dirac-runtime---page-specific-configuration
btw. nrepl-config override can be specified in runtime config, it gets constructed here and sent via bootstrap message: https://github.com/binaryage/dirac/blob/master/src/implant/dirac/implant/intercom.cljs#L328-L334
^ this will work when using preloads
@darwin: thanks for the resources! looking into it now
what I'm curently trhing is: :dirac-opts {:nrepl-tunnel {:host .. ip ..}}} but clearly this is wrong
:dirac-opts
where did you see that?
probaly because I'm doing this wrong; in that "preloads" = stuff injected into cljs land right? :dirac-opts comes from (doc dirac) // in boot which comes from powerlaces.boot-cljs-devtools
aha, that’s a boot thing and means “dirac agent options"
dirac agent is not the place where to configure runtime or nrepl
actually it is pretty tricky to configure nrepl middleware, because there is no mechanism supporting it in nrepl system (AFAIK)
so I configure it at runtime by sending a config during bootstrap phase
actually, I think I have the pices, let met struggle with this for a bit, 30min - 1 hr
I'll gain intuition / familiar with the error msgs, then I'll bug you again 🙂
[my cljs is also broken at the moment, so I need to fiz that before testing this out]
a tip: if you open internal devtools console on "dirac devtools” page, you should see runtime config and messages about weasel connection attempts, you should see there if your setting got reflected there
@darwin: noted: the problem is -- during moving boot to a remote machine, I somehow broke my *.clj scode, which means I can't compile new cljs code / test out what you've already suggested
the moment I get *.cljs compiling gain, I'll test all of this out
may I ask, why you're doing this remote setup?
my mbp is fairly weak, and the fans spins up when I have multipel compilations going on
I also have a beefy 8 core i7 with 24GB of RAM
so mbp is powering emacs; while 8 core i7 24GB RAM is powering boot
it's 100% first world problem
if I may ask -- how are you so responsive? what's your day job?
I would try just emacs to have a remote nrepl connection, but all dirac stuff sitting on single machine and use remote desktop or something to see the browser
so emacs = runniing on local MBP boot + dirac = running on remote beefy machine then VNC into remote machine to show browser + dirac ?
yes
I have no doubt that's the right solution, but I now I think this is a matter of pride where if I can't get it working, I'll bother me for the rest of the week
🙂
you will be probably the second one trying this, so expect sharp edges
and back to your question, I don’t have a day job, that is why I can be so responsive 🙂
wait, is binarage a 1 person llc ?
actually I make money here: https://www.binaryage.com, but that is a dead business already, so I just play with cljs
🙂
actually it is two devs, me (TotalFinder) and Stephen (TotalSpaces)
okay, I have gottten error from: dirac failed to conenct on <ws://locaolhost:8231> to dirac agent is not listening at <ws://192.168.0.113:8231> I think I know what's going on, in my boot config for whatever's litening on 8231, it's doing it on localhost, not on 0.0.0.0
I want to build my next biz idea with cljs+clojure, but before that I had to make some better tools/libs to hopefully get there
we will see
yeah, in boot it says: Agent is accepting connections at <ws://127.0.1.1:8231> whoa, the 1.1 is NOT a typo, this is weird
if/when my startup becomes profitable, I'll be happy to pay subscription fee your way if you build tools
thanks, but this is not going to make enough to support this development, cljs community is tiny, at least not in short term
I can sponsor it from binaryage’s earnings for now
what is your startup thing, btw?
err, I think this channel is publicly logged; I'll send a beta invite you way when it's ready
ok 🙂
it's actually not the idea that's private; it's that I don't want competitors to know I'm debugging my cljs with dirac 🙂
dirac has doubled y cljs productivity
it's too bad that you can build somethign that 2xs productivity of 100 ppl, yet not be able to make a living off of it
I didn’t want to claim it is not possible, I haven’t tried, actually Colin made a living from Cursive, Clojure + ClojureScript ecosystem is much bigger that and code editor is something everyone needs. With dirac the target audience is much smaller and it is not that essential.
anyways, Dirac is now in mainenance mode, I have all features I wanted in place, now I will “just" keep maintaining it, there won’t be much my effort going into new development there
let me know if/when you get your remote setup working, I’m curious, but be aware that there might be some blocker, never tried it myself
would help you fix it if that would be the case, of course
okay, so I got it working, but not via dirac connecting remote (on second thought, the idea of opening up nrepls on 0.0.0.0 did not sit well with me) whatI did do ... was just port forward (over ssh) 7000 [http port], and 8230-8242
great!
@darwin: one nice thing about being a founder/unemployed is large blocks of time to learn whatever I want I'm not asking you to do this for me -- I'm asking you to point me to the right direction so I can do this myself -- I think it's high tie I learn how to deal with either (1) chrome extensions or (2) chrome devtools extensions alright, so right now, in dirac devtools, when I get an exception printed in teh console, and it shows me something like: (window.cljs:50) when I click on that, it jumps me to window.cljs ,line 50
instead, I want to modify it so that when I click on it, it sends a REST request to some webserver somewhere (i.e. run by emacs) -- what is the minimal amount of tech I need to learn in order to do this?
given how basic the op is, I'm willing to do this in pure-js, it doesn't have to be a cljs setup
I wanted to implement it myself I will teach nrepl middleware to be configured to execute a shell command on such clicks
I want to do this right, I think this could be used by many people
or more specifically it will execute a user-specified function, the default implementation will be a shell script execution (if the script exists)
it already got enough thumbs up: https://github.com/binaryage/dirac/issues/56
so your emacs does not run on the same machine as your nrepl server, right?
emacs / nrepl-server not on same machine, but not a problem; if I can setup clj callbacks for each "dirac devtools ui event", hooking up eamcs <-> remote nrepl is not going to be ahrd
I will introduce a new nrepl op, something like :dirac-devtools-request
, dirac nREPL middleware will handle it and launch a pre-defined function (in the context of nREPL server)
documented it in the same manner as https://github.com/binaryage/dirac/blob/master/docs/about-repls.md 🙂
you will be either able to specify that function via config, or write a shell script to do whatever you want, for example do http post somewhere
[unrelated to solving this for dirac] as an aisde, it's kinda of annoying how shitty modern dev cycles are; I should be able to right click an element, and say "for each element of this, type overwrite the :onClick handler to execute THIS CODE INSTEAD" instead, we have to jump through all these hoops to do otherwise such a conceptually simple task
maybe if chrome was written in smalltalk, this'd be easier
did you program for web before firebug was introduced back in 2006 or so? that is what I would call a shitty dev cycle
😉
no, I refused to learn web dev technologies for the longest time because javascript fucking hcanges all the time
then I wathced a bunch of college friends become millionaires over dumbass facebook apps
and I realized -- hmm, maybe I should learn web tech
I think javascript started changing with ES6, but before that it was pretty stable
and you can still use "the good parts”, you are not forced to learn new stuff
IMO
anyways cljs is much superior and it is guaranteed to remove you from js spec churn
hmm, what I meant to say (but not what I wrote is): if you learn an algorithm, like binary search or heap sort, that knowoedge will stay the same and likely not change for the rest of your life if you learn some javascript trick that works in Netscape 3.0, no one knows how useful that knowledge will be 5 years from now; in that sense, js knowledge "changes all the time" and is not that worth learning so instead of "js", I should have said "latest tricks to do cool things by exploiting new browser quirks"
ok, fair enough