dirac

Dirac v1.7.2 is out: https://github.com/binaryage/dirac/releases/tag/v1.7.2
2017-06-22T00:00:08.333535Z

also you wouldn’t have to maintain the script

2017-06-22T00:00:18.335374Z

I mean those chromium specific bits

2017-06-22T00:00:35.338450Z

the thing could change anytime without notice

richiardiandrea 2017-06-22T00:02:21.355382Z

for sure...it is better approach for sure

2017-06-22T00:03:12.363133Z

btw. I suggested it yesterday

👍 1
richiardiandrea 2017-06-22T00:03:18.364119Z

this means to write a regex against this though:

"body": "# A maintenance release\r\n\r\n## Rolling DevTools\r\n\r\nMerged commits <https://github.com/binaryage/dirac/compare/48c98ab27...f044be56d> from [official DevTools](<https://developers.google.com/web/tools/chrome-devtools>).\r\nShould [work best](<https://github.com/binaryage/dirac/blob/master/docs/faq.md#why-should-i-use-recent-chrome-canary-with-dirac-devtools>) with Chrome ~61.0.3126.2.\r\nLinks to matching [Chromium snapshots](<https://www.chromium.org/getting-involved/download-chromium>): [Mac](<http://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/478480/chrome-mac.zip>) | [Linux_x64](<http://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/478483/chrome-linux.zip>) | [Win](<http://commondatastorage.googleapis.com/chromium-browser-snapshots/Win/478471/chrome-win32.zip>) | [Win_x64](<http://commondatastorage.googleapis.com/chromium-browser-snapshots/Win_x64/478480/chrome-win32.zip>).\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: <https://github.com/binaryage/dirac/compare/v1.2.9...v1.2.10>"

2017-06-22T00:04:43.377166Z

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

2017-06-22T00:05:08.380986Z

grab == grep

richiardiandrea 2017-06-22T00:10:45.430652Z

it's ok for now

2017-06-22T00:14:09.459092Z

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

richiardiandrea 2017-06-22T00:38:39.654758Z

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

richiardiandrea 2017-06-22T00:40:27.668075Z

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
richiardiandrea 2017-06-22T00:46:43.714975Z

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

richiardiandrea 2017-06-22T00:46:55.716483Z

I could just redirect to a page that contains one

richiardiandrea 2017-06-22T00:47:36.721466Z

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

2017-06-22T00:48:48.730314Z

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

2017-06-22T00:48:55.731087Z

wasn’t aware of it

richiardiandrea 2017-06-22T00:51:08.747432Z

Np not in a rush thanks!

richiardiandrea 2017-06-22T20:32:26.460343Z

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

richiardiandrea 2017-06-22T20:33:09.474458Z

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

richiardiandrea 2017-06-22T20:33:18.477473Z

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 <https://github.com/binaryage/dirac/blob/master/docs/faq.md#getting-error-cannot-attach-dirac-devtools-what-now>.
tab-url=<http://localhost:3000/>, debugger-url=<http://localhost:9222%22)|http://localhost:9222")>

2017-06-22T20:34:12.495564Z

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

richiardiandrea 2017-06-22T20:35:46.526937Z

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

2017-06-22T20:35:55.529891Z

ok, other browser than chrome

richiardiandrea 2017-06-22T20:36:03.532564Z

let me see

richiardiandrea 2017-06-22T20:36:25.539687Z

$ http-prompt <http://localhost:9222/json> 
Version: 0.8.0
<http://localhost:9222/json&gt;> 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": "<https://www.google.ca/favicon.ico>", 
        "id": "b65a440c-9bb1-402a-b790-5e611dfd4df8", 
        "title": "New Tab", 
        "type": "page", 
        "url": "<chrome://newtab/>", 
        "webSocketDebuggerUrl": "<ws://localhost:9222/devtools/page/b65a440c-9bb1-402a-b790-5e611dfd4df8>"
    }, 
    {
        "description": "", 
        "devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:9222/devtools/page/387dcf2c-b817-43ff-9a42-835a6c796b22", 
        "id": "387dcf2c-b817-43ff-9a42-835a6c796b22", 
        "title": "Developer Tools - <http://localhost:3000/>", 
        "type": "other", 
        "url": "<chrome-devtools://devtools/bundled/inspector.html?remoteBase=https://chrome-devtools-frontend.appspot.com/serve_file/@7ab22ee27d6289165c8303b9f7d2dabe45ce3b25/&amp;can_dock=true&amp;dockSide=undocked>", 
        "webSocketDebuggerUrl": "<ws://localhost:9222/devtools/page/387dcf2c-b817-43ff-9a42-835a6c796b22>"
    }, 
    {
        "description": "", 
        "id": "958f5ea2-06ba-4266-92e0-f084afb6d5bf", 
        "title": "localhost:3000", 
        "type": "page", 
        "url": "<http://localhost:3000/>"
    }, 
    {
        "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": "<chrome-extension://kbkdngfljkchidcjpnfcgcokkbhlkogi/background.html>", 
        "webSocketDebuggerUrl": "<ws://localhost:9222/devtools/page/e2ccfd78-536f-4723-8f54-0aa39c1e8a6b>"
    }, 
    {
        "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": "<https://www.google.ca/_/chrome/newtab-serviceworker.js>", 
        "webSocketDebuggerUrl": "<ws://localhost:9222/devtools/page/80263c05-d504-4da9-9a68-dcde40aa6ce0>"
    }
]

2017-06-22T20:37:37.563155Z

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

richiardiandrea 2017-06-22T20:37:45.565542Z

uhm

2017-06-22T20:38:20.576802Z

only one devtools instance can talk to chrome via debugger protocol

richiardiandrea 2017-06-22T20:38:42.583930Z

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

Internal Dirac Error Could not load content for <http://localhost:3000/main.out/figwheel/client/main.out/figwheel/client/socket.cljs> : HTTP status code: 404

richiardiandrea 2017-06-22T20:39:00.589687Z

where is that path calculated from?

2017-06-22T20:39:10.592730Z

messed up source maps

2017-06-22T20:39:19.595612Z

that should be just cometic problem

2017-06-22T20:39:23.597136Z

cosmetic

richiardiandrea 2017-06-22T20:39:31.599696Z

uhm ok, let me see then

richiardiandrea 2017-06-22T20:40:32.619546Z

nope, .cljs files in the sources are empty unfortunately

richiardiandrea 2017-06-22T20:40:52.626179Z

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

2017-06-22T20:41:27.637378Z

this url must work in your “other browser” http://localhost:3000/main.out/figwheel/client/main.out/figwheel/client/socket.cljs

2017-06-22T20:41:50.644891Z

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

richiardiandrea 2017-06-22T20:42:23.655396Z

ok yeah it looks off

2017-06-22T20:42:36.659422Z

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

richiardiandrea 2017-06-22T20:43:30.677541Z

<http://localhost:3000/main.out/figwheel/client/socket.cljs> is served correctly

richiardiandrea 2017-06-22T20:43:53.684752Z

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

2017-06-22T20:46:28.735224Z

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

👍 1
2017-06-22T20:46:36.737660Z

and then associated .map file

2017-06-22T20:47:08.747793Z

something went wrong tehre

richiardiandrea 2017-06-22T21:22:56.415320Z

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

richiardiandrea 2017-06-22T21:23:57.433125Z

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

2017-06-22T21:24:32.443370Z

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

2017-06-22T21:24:41.445758Z

and then interprets that file

richiardiandrea 2017-06-22T21:25:06.452856Z

ok so the content of the file is what fails here

2017-06-22T21:25:11.454376Z

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

richiardiandrea 2017-06-22T21:25:15.455317Z

lemme check...

richiardiandrea 2017-06-22T21:28:12.505282Z

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

2017-06-22T21:28:59.518586Z

why do you use :source-map-path ?

richiardiandrea 2017-06-22T21:29:11.521784Z

I think it is added by boot-cljs

2017-06-22T21:29:34.528367Z

there must be some reason why they did that

2017-06-22T21:29:38.529467Z

git blame

2017-06-22T21:30:22.542455Z

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

2017-06-22T21:30:32.545722Z

or absolute path beginning with slash

2017-06-22T21:30:51.550947Z

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

richiardiandrea 2017-06-22T21:31:35.563751Z

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

richiardiandrea 2017-06-22T21:32:55.586189Z

trying 2.1.0-SNAPSHOT

richiardiandrea 2017-06-22T21:34:01.604223Z

yes! got it working!

richiardiandrea 2017-06-22T21:34:21.609623Z

Dirac + boot-figreload 😉

2017-06-22T21:34:30.612117Z

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

richiardiandrea 2017-06-22T21:34:53.618224Z

well they fixed it, I am ok with it 😄

richiardiandrea 2017-06-22T21:38:53.680271Z

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

2017-06-22T21:39:19.686990Z

go for it 🙂

richiardiandrea 2017-06-22T21:43:10.746162Z

this is maybe figwheel client sending things

richiardiandrea 2017-06-22T21:43:27.750369Z

not maybe...

2017-06-22T21:45:10.775729Z

interesting, this looks like a bug

richiardiandrea 2017-06-22T21:49:08.834703Z

will try to setup a repo for you

2017-06-22T21:49:51.845563Z

maybe first try to run REPL again with verbose logging

richiardiandrea 2017-06-22T21:53:04.894410Z

ok, is this correct btw?

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

2017-06-22T21:53:31.901155Z

not sure what that is

2017-06-22T21:53:58.907792Z

but obviously your dirac prompt talks to your nrepl server

2017-06-22T21:54:10.910726Z

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

2017-06-22T21:54:30.915597Z

or when this happened?

richiardiandrea 2017-06-22T21:54:34.916498Z

oh I wanted to customize the port

richiardiandrea 2017-06-22T21:56:04.938498Z

oh scratch that

richiardiandrea 2017-06-22T21:56:07.939164Z

🙂

richiardiandrea 2017-06-22T21:57:00.951798Z

it is from https://github.com/boot-clj/boot-cljs-devtools

richiardiandrea 2017-06-22T22:04:34.063617Z

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

richiardiandrea 2017-06-22T22:07:48.107558Z

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

richiardiandrea 2017-06-22T22:08:22.115344Z

think I need to enable the logs as above

2017-06-22T22:08:35.118260Z

this is client-side related

2017-06-22T22:08:46.120614Z

simply open internal devtools on Dirac DevTools window

2017-06-22T22:09:12.126303Z

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

2017-06-22T22:09:22.128655Z

no nREPL connection needed

richiardiandrea 2017-06-22T22:17:19.231750Z

trying now

richiardiandrea 2017-06-22T22:30:26.392178Z

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

2017-06-22T22:34:38.442205Z

hmm, I’m afraid I cannot help with this

2017-06-22T22:36:24.462678Z

just tested it in dirac-sample repo

2017-06-22T22:36:32.464079Z

js/ alone does not trigger it

2017-06-22T22:36:43.466085Z

but js/w gives you some completions

richiardiandrea 2017-06-22T22:38:11.482849Z

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

2017-06-22T22:38:34.487003Z

have you read this? https://github.com/binaryage/dirac-sample#hello-world

richiardiandrea 2017-06-22T22:38:56.491243Z

uhm maybe not 😄

richiardiandrea 2017-06-22T22:39:20.495714Z

ok got it

richiardiandrea 2017-06-22T22:39:26.496961Z

so I have to change namespace

richiardiandrea 2017-06-22T22:40:01.503109Z

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

2017-06-22T22:40:58.513552Z

I believe I do

2017-06-22T22:41:38.521211Z

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

richiardiandrea 2017-06-22T22:42:25.530023Z

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

richiardiandrea 2017-06-22T22:42:39.532673Z

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

richiardiandrea 2017-06-22T22:43:15.539042Z

the fully qualified namespace completion works smoothly

2017-06-22T22:44:06.548625Z

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

2017-06-22T22:44:38.554443Z

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

2017-06-22T22:44:48.556020Z

and with source-maps

2017-06-22T22:45:50.567998Z

more context: https://github.com/binaryage/dirac/releases/tag/v0.6.0

2017-06-22T22:46:25.574495Z

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

2017-06-22T22:47:11.582901Z

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

2017-06-22T22:48:05.592899Z

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

richiardiandrea 2017-06-22T22:48:10.593749Z

yep got that, I opened an issue as reminder

2017-06-22T22:48:16.594843Z

because there are so many moving parts

richiardiandrea 2017-06-22T22:48:24.596420Z

I like that you don't depend on nRepl

richiardiandrea 2017-06-22T22:49:02.603485Z

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

richiardiandrea 2017-06-22T22:49:11.604923Z

if you have the compiler env/state

richiardiandrea 2017-06-22T22:49:30.608558Z

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

cljs.user=&gt; (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

2017-06-22T22:50:22.618296Z

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

2017-06-22T22:51:52.634611Z

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

2017-06-22T22:52:10.637767Z

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

richiardiandrea 2017-06-22T22:53:04.647607Z

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

richiardiandrea 2017-06-22T22:53:25.651356Z

you parse the source maps for that...

richiardiandrea 2017-06-22T22:53:40.653919Z

uhm right

2017-06-22T22:53:43.654554Z

here we would merge additional map collected by observing REPL session

richiardiandrea 2017-06-22T22:53:57.656905Z

yep gotcha

richiardiandrea 2017-06-22T23:09:49.826220Z

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

2017-06-22T23:13:41.864708Z

hmm, the issue you opened already covers it

2017-06-22T23:14:06.868764Z

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

richiardiandrea 2017-06-22T23:14:32.873066Z

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

2017-06-22T23:15:25.882068Z

ok, but I cannot promise to look into that

richiardiandrea 2017-06-22T23:16:11.889685Z

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

richiardiandrea 2017-06-22T23:16:32.893064Z

probably figwheel sends that from the browser client

richiardiandrea 2017-06-22T23:17:00.897745Z

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

2017-06-22T23:17:43.905160Z

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

richiardiandrea 2017-06-22T23:18:41.914781Z

ok

2017-06-22T23:18:54.916872Z

thanks

richiardiandrea 2017-06-22T23:22:20.950633Z

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

1