dirac 2017-06-22

also you wouldn’t have to maintain the script

I mean those chromium specific bits

the thing could change anytime without notice

for sure...it is better approach for sure

btw. I suggested it yesterday

👍 1

this means to write a regex against this though:

"body": "# A maintenance release\r\n\r\n## Rolling DevTools\r\n\r\nMerged commits  from [official DevTools]().\r\nShould [work best]() with Chrome ~61.0.3126.2.\r\nLinks to matching [Chromium snapshots](): [Mac]() | [Linux_x64]() | [Win]() | [Win_x64]().\r\n\r\n## Notable commits\r\n\r\n05d1e3c380c773bb251165859a85db0e0309a88f project: bump cljsjs/parinfer to \"2.0.0-0\"\r\n\r\nAll new work: "

yes, shouldn’t be that hard, grab the line with Links to matching [Chromium snapshots].*

it's ok for now

I’m afraid slack somehow cached the snippet, at least it seems to be the old version on my end

Ok I will post the finished job and delete it for now

Tomorrow I will tackle the hard part, how to autoinstall dirac 😀 I am going to make sure to read carefully all your previous messages this time 😅

1

@darwin have you considered / have already inline installation links? https://developer.chrome.com/webstore/inline_installation

I could just redirect to a page that contains one

Although now that I am reading, it looks like you need to comply to some stuff

sorry, don’t have time to read through it right now

wasn’t aware of it

Np not in a rush thanks!

It has been quite a while since the last time I have used dirac 😄

I am testing it with boot-figreload...I have a ws server for reloading stuff but I don't think I have anything connected to the Chrome debugger

however, I get :

console.warn("Cannot attach Dirac DevTools. Likely cause: another instance of DevTools is already attached.
Don't you have internal DevTools open in the tab?
See .
tab-url=, debugger-url=

what do you see when you visit http://localhost:9222/json in Safari?

@darwin don't have safari, I am on linux 😄 Do you need safari?

ok, other browser than chrome

let me see

$ http-prompt  
Version: 0.8.0
 get
HTTP/1.1 200 OK
Content-Length:2035
Content-Type:application/json; charset=UTF-8

[
    {
        "description": "", 
        "devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:9222/devtools/page/b65a440c-9bb1-402a-b790-5e611dfd4df8", 
        "faviconUrl": "", 
        "id": "b65a440c-9bb1-402a-b790-5e611dfd4df8", 
        "title": "New Tab", 
        "type": "page", 
        "url": "", 
        "webSocketDebuggerUrl": ""
    }, 
    {
        "description": "", 
        "devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:9222/devtools/page/387dcf2c-b817-43ff-9a42-835a6c796b22", 
        "id": "387dcf2c-b817-43ff-9a42-835a6c796b22", 
        "title": "Developer Tools - ", 
        "type": "other", 
        "url": "", 
        "webSocketDebuggerUrl": ""
    }, 
    {
        "description": "", 
        "id": "958f5ea2-06ba-4266-92e0-f084afb6d5bf", 
        "title": "localhost:3000", 
        "type": "page", 
        "url": ""
    }, 
    {
        "description": "", 
        "devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:9222/devtools/page/e2ccfd78-536f-4723-8f54-0aa39c1e8a6b", 
        "id": "e2ccfd78-536f-4723-8f54-0aa39c1e8a6b", 
        "title": "Dirac DevTools", 
        "type": "background_page", 
        "url": "", 
        "webSocketDebuggerUrl": ""
    }, 
    {
        "description": "", 
        "devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:9222/devtools/page/80263c05-d504-4da9-9a68-dcde40aa6ce0", 
        "id": "80263c05-d504-4da9-9a68-dcde40aa6ce0", 
        "title": "Worker pid:4961", 
        "type": "service_worker", 
        "url": "", 
        "webSocketDebuggerUrl": ""
    }
]

what is that 387dcf2c-b817-43ff-9a42-835a6c796b22 record? it looks to me like internal devtools opened with your app

only one devtools instance can talk to chrome via debugger protocol

oh right lol...so that now is working, but I get:

Internal Dirac Error Could not load content for  : HTTP status code: 404

where is that path calculated from?

messed up source maps

that should be just cometic problem

uhm ok, let me see then

nope, .cljs files in the sources are empty unfortunately

this is with boot-figreload so maybe I am messing up myself with the source maps

or you have to fix configuration of your stack for this url to be correct

ok yeah it looks off

the repeated main.out/figwheel/client is definitely suspicious

is served correctly

so it means that the computed link is off ... somewhere, I will debug

if you want to debug it, open generated socket.js and investigate sourceMappingURL comment at the end of the file

👍 1

and then associated .map file

something went wrong tehre

@darwin it looks like the comment is ok... //# sourceMappingURL=socket.js.map

do you have one lil' minute to expand a bit on how/where Chrome reads those urls?

given a js file, it looks for sourceMappingURL comment, then loads associated .map file

and then interprets that file

ok so the content of the file is what fails here

look into socket.js.map, it has source-map json inside, some fields point to cljs source files

lemme check...

yeah so I have ,"sources":["main.out\/figwheel\/client\/socket.cljs"] and :source-map-path "main.out" probably that gets added to

why do you use :source-map-path ?

I think it is added by boot-cljs

there must be some reason why they did that

in your case sources should be simply "sources":["socket.cljs"]

or absolute path beginning with slash

then :source-map-path “/main.out” would probably work

looks like some refactor has been done in an unreleased version of boot-cljs after 2.0.0

trying 2.1.0-SNAPSHOT

yes! got it working!

Dirac + boot-figreload 😉

good! to me it sounds like someone was setting :source-map-path without knowing what they are doing 😉

well they fixed it, I am ok with it 😄

need to write a blog post or better...docs for dirac

this is maybe figwheel client sending things

not maybe...

interesting, this looks like a bug

will try to setup a repo for you

maybe first try to run REPL again with verbose logging

ok, is this correct btw?

{:nrepl-server {:host "localhost"
                :port nrepl-port}}

not sure what that is

but obviously your dirac prompt talks to your nrepl server

so there won’t be an issue in host/port configs

or when this happened?

oh I wanted to customize the port

oh scratch that

🙂

should (require '[rest-resources-viz.util :as util]) then (util/) autocomplete?

yeah and js/ does not work either for some reason...

think I need to enable the logs as above

this is client-side related

simply open internal devtools on Dirac DevTools window

all code completion in dirac is dependent on client-side information only

no nREPL connection needed

trying now

yes I see the logs and it seems that on js/ nothing happens

hmm, I’m afraid I cannot help with this

just tested it in dirac-sample repo

js/ alone does not trigger it

but js/w gives you some completions

yes true and thanks for that! an arbitrarily required namespace is not complete (do you get cljs.compiler/env for completions?)

uhm maybe not 😄

ok got it

so I have to change namespace

however, I think you'd have the info for completing a generic ns/ alias if you have access to the compiler state

you can see it on code-completion screenshots here: https://github.com/binaryage/dirac

no promises, but I will try to have a look, cider uses: https://github.com/clojure-emacs/cljs-tooling

basically only the completion with alias is missing from what I see

the fully qualified namespace completion works smoothly

as I wrote, I don’t want dirac to rely on REPL connection to do code completions

the information should be available on client-side in dev mode

and with source-maps

“By design we don’t want Dirac to talk to nREPL and rely on some “connection” to provide some kind of server-side code completions. Dirac code completions should work without Dirac Agent (with no REPL enabled).”

this is for future, if I ever implement self-hosted mode, you could type simple cljs code without having nREPL connection at all

also requiring people to config another nREPL middleware sounds like a usability problem, even now Dirac is really for advanced cljs hackers

yep got that, I opened an issue as reminder

because there are so many moving parts

I like that you don't depend on nRepl

but lumo can do it so you probably can do it too client side only

if you have the compiler env/state

cljs.user=> (require '[clojure.string :as str])
nil

cljs.user=> (str/
(str/blank?         (str/capitalize     (str/ends-with?     (str/escape         (str/includes?
(str/index-of       (str/join           (str/last-index-of  (str/lower-case     (str/replace

aha, now I understand, yes, I could do this with a bit of work

right now, dirac uses source map for given ns, to fetch cljs file and read its ns form to understand aliases

I would have to update this for ad-hoc requires entered via REPL prompt

oh ok, now I understand why it would be some work

you parse the source maps for that...

uhm right

here we would merge additional map collected by observing REPL session

yep gotcha

@darwin do you want me to open an issue with that snippet above?

hmm, the issue you opened already covers it

or do you mean some other issue than the :as str thing?

Yeah this one: java.lang.AssertionError: Assert failed: (instance? WebSocketServer server)

ok, but I cannot promise to look into that

it is weird because it is sending :cljs/quit back

probably figwheel sends that from the browser client

I don't know...maybe I am misinterpreting, in any case it is good to report it

I will probably wait for more people to hit that issue, or if you prepare a repro repo I would try to investigate

no thank you! we have boot + figwheel support as well now, it is super great!

1