Fork me on GitHub
#dirac
<
2017-06-22
>
darwin00:06:08

also you wouldn’t have to maintain the script

darwin00:06:18

I mean those chromium specific bits

darwin00:06:35

the thing could change anytime without notice

richiardiandrea00:06:21

for sure...it is better approach for sure

darwin00:06:12

btw. I suggested it yesterday

richiardiandrea00:06:18

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: "

darwin00:06:43

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

darwin00:06:08

grab == grep

darwin00:06:09

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

richiardiandrea00:06:39

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

richiardiandrea00:06:27

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 😅

richiardiandrea00:06:43

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

richiardiandrea00:06:55

I could just redirect to a page that contains one

richiardiandrea00:06:36

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

darwin00:06:48

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

darwin00:06:55

wasn’t aware of it

richiardiandrea00:06:08

Np not in a rush thanks!

richiardiandrea20:06:26

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

richiardiandrea20:06:09

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

richiardiandrea20:06:18

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=

darwin20:06:12

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

richiardiandrea20:06:46

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

darwin20:06:55

ok, other browser than chrome

richiardiandrea20:06:25

$ 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": ""
    }
]

darwin20:06:37

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

darwin20:06:20

only one devtools instance can talk to chrome via debugger protocol

richiardiandrea20:06:42

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

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

richiardiandrea20:06:00

where is that path calculated from?

darwin20:06:10

messed up source maps

darwin20:06:19

that should be just cometic problem

richiardiandrea20:06:31

uhm ok, let me see then

richiardiandrea20:06:32

nope, .cljs files in the sources are empty unfortunately

richiardiandrea20:06:52

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

darwin20:06:50

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

richiardiandrea20:06:23

ok yeah it looks off

darwin20:06:36

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

richiardiandrea20:06:30

is served correctly

richiardiandrea20:06:53

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

darwin20:06:28

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

darwin20:06:36

and then associated .map file

darwin20:06:08

something went wrong tehre

richiardiandrea21:06:56

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

richiardiandrea21:06:57

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

darwin21:06:32

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

darwin21:06:41

and then interprets that file

richiardiandrea21:06:06

ok so the content of the file is what fails here

darwin21:06:11

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

richiardiandrea21:06:12

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

darwin21:06:59

why do you use :source-map-path ?

richiardiandrea21:06:11

I think it is added by boot-cljs

darwin21:06:34

there must be some reason why they did that

darwin21:06:22

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

darwin21:06:32

or absolute path beginning with slash

darwin21:06:51

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

richiardiandrea21:06:35

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

richiardiandrea21:06:55

trying 2.1.0-SNAPSHOT

richiardiandrea21:06:01

yes! got it working!

richiardiandrea21:06:21

Dirac + boot-figreload 😉

darwin21:06:30

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

richiardiandrea21:06:53

well they fixed it, I am ok with it 😄

richiardiandrea21:06:53

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

darwin21:06:19

go for it 🙂

richiardiandrea21:06:10

this is maybe figwheel client sending things

darwin21:06:10

interesting, this looks like a bug

richiardiandrea21:06:08

will try to setup a repo for you

darwin21:06:51

maybe first try to run REPL again with verbose logging

richiardiandrea21:06:04

ok, is this correct btw?

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

darwin21:06:31

not sure what that is

darwin21:06:58

but obviously your dirac prompt talks to your nrepl server

darwin21:06:10

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

darwin21:06:30

or when this happened?

richiardiandrea21:06:34

oh I wanted to customize the port

richiardiandrea22:06:34

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

richiardiandrea22:06:48

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

richiardiandrea22:06:22

think I need to enable the logs as above

darwin22:06:35

this is client-side related

darwin22:06:46

simply open internal devtools on Dirac DevTools window

darwin22:06:12

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

darwin22:06:22

no nREPL connection needed

richiardiandrea22:06:26

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

darwin22:06:38

hmm, I’m afraid I cannot help with this

darwin22:06:24

just tested it in dirac-sample repo

darwin22:06:32

js/ alone does not trigger it

darwin22:06:43

but js/w gives you some completions

richiardiandrea22:06:11

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

richiardiandrea22:06:56

uhm maybe not 😄

richiardiandrea22:06:26

so I have to change namespace

richiardiandrea22:06:01

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

darwin22:06:58

I believe I do

darwin22:06:38

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

richiardiandrea22:06:25

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

richiardiandrea22:06:39

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

richiardiandrea22:06:15

the fully qualified namespace completion works smoothly

darwin22:06:06

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

darwin22:06:38

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

darwin22:06:48

and with source-maps

darwin22:06:25

“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).”

darwin22:06:11

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

darwin22:06:05

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

richiardiandrea22:06:10

yep got that, I opened an issue as reminder

darwin22:06:16

because there are so many moving parts

richiardiandrea22:06:24

I like that you don't depend on nRepl

richiardiandrea22:06:02

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

richiardiandrea22:06:11

if you have the compiler env/state

richiardiandrea22:06:30

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

darwin22:06:22

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

darwin22:06:52

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

darwin22:06:10

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

richiardiandrea22:06:04

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

richiardiandrea22:06:25

you parse the source maps for that...

darwin22:06:43

here we would merge additional map collected by observing REPL session

richiardiandrea23:06:49

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

darwin23:06:41

hmm, the issue you opened already covers it

darwin23:06:06

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

richiardiandrea23:06:32

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

darwin23:06:25

ok, but I cannot promise to look into that

richiardiandrea23:06:11

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

richiardiandrea23:06:32

probably figwheel sends that from the browser client

richiardiandrea23:06:00

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

darwin23:06:43

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

richiardiandrea23:06:20

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