This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-09
Channels
- # beginners (140)
- # boot (163)
- # cider (43)
- # cljs-dev (50)
- # cljsjs (5)
- # cljsrn (38)
- # clojure (152)
- # clojure-austria (10)
- # clojure-berlin (9)
- # clojure-dev (11)
- # clojure-japan (1)
- # clojure-miami (2)
- # clojure-russia (147)
- # clojure-sg (12)
- # clojurescript (244)
- # code-reviews (3)
- # cursive (104)
- # data-science (5)
- # datavis (15)
- # datomic (35)
- # editors (4)
- # hoplon (1)
- # ldnclj (11)
- # lein-figwheel (14)
- # leiningen (22)
- # off-topic (53)
- # om (373)
- # omnext (2)
- # onyx (67)
- # parinfer (193)
- # re-frame (23)
- # reagent (89)
- # yada (7)
look! playing with parinfer in my devtools console 😝 https://dl.dropboxusercontent.com/u/559047/poc-parinfer-prompt-in-devtools-01.png
my god, that’s cool
i was just reading your email
it’s been a while since I’ve seen cljs-devtools, looks like it’s come really far since then
I just want to add few bits into devtools, to improve cljs experience a bit more with chrome
nothing big, just few tweaks here and there, for example using custom formatters for inline values in source code view
yeah, that’s a big deal
the local scope view is especially nice
yeah, speaking about local scope, I will sort local scope view to put nice variables at the top, and macro generated below
yeah, that’s a good idea, I guess they all end with #
right
for this proof-of-concept I want to just talk to figwheel, I don’t want to invest time into making it more general (nREPL compatible)
I’m looking at the first example https://github.com/binaryage/cljs-devtools/wiki/Figwheel-REPL-plugin
does evaluating an expression in figwheel’s repl usually result in it being logged to chrome’s devconsole?
or is this leveraging something new in figwheel
i think I’m missing something here with how the two are interacting
normal scenario: you type someting into REPL, figwheel wraps it into (pr-str (your-code)), figwheel compiles it from cljs into js,, then sends it into chrome, there it gets exectuted as javascript, result is string, which gets delivered back to figwheel repl where it gets printed
this plugin, removes pr-str wrapping and prints the javascript result into devtools console as well
so this is just one way REPL -> devtools, with my devtools fork, I will close the loop: you type something into devtools console, it gets sent to figwheel server, which treats it as it was entered in REPL directly, rest it normal scenario
oh wow
ok, I think I understand now. figwheel is the compiler, and cljs-devtools is adding a normal view over its values
and soon we won’t even have to look at figwheel’s terminal, since you’ll allow normal input straight from the devconsole
so the repl experience will be what JS developers already do in the console
yeah, this is going to be a big UX win for cljs
wow, cljs test results, figwheel hud, and build options straight from chrome devtools
I want it for my own dev workflow, iTerm2 + figwheel repl is not bad, but I’m staring on devtools most of the time
i don’t know much about react and redux devtools, but I think they’re tightly integrated like that
and nice part is that most of this can be implemented in cljs, it is not a big problem to combine devtools javascript code and our custom cljs pieces
yes, react devtools is actually a devtools extension, not a fork, they use extension points provided by devtools guys
so you’re forking
I can package whole thing as a chrome extension (which will include my fork), so people can have easy path for consuming it
but you could also run a local server with the fork, devtools are just a SPA, communicating with chrome using websockets
the only drawback will be keeping the fork up-to-date with upstream changes, and fixing conflictsw
very cool
do you have a fork on github?
kinda wanna see what changes require the fork
cool thanks
I’m kind of in awe that you integrated the codemirror stuff for parinfer straight into the console, with all the highlighting stuff
like wtf
@shaunlebron: it wasn’t hard, devtools use codemirror for source code view already, and codemirror is beautifully designed
you know I thought that about codemirror
idk about parinfer… haha
I’ve never seen beautiful JS before reading codemirror’s source
but I did have to modify codemirror in one spot, with the +indenthack
and some other places to allow visual selections to not disappear when losing focus (just for playback of the demos)
oh cool
it took me some time to realize that bracket matching has some parinfer-related tweaks
anyway, I think all the edits have to do with playback features that you won’t care about
yeah, that too
yeah, not a bad idea, I think I might’ve thought it had to be in that directory
yeah, I never really intended for the codemirror stuff to be used external to this site demo since it was getting hacky in places
hence my surprise
sure, I understand, it was easier than expected, maybe I will bend it to my needs in the future, but it was a good starting point
I should isolate my CodeMirror interactions from devtools guys, we share one js/CodeMirror
oh, nice
maybe later we can extract independent parinfer+codemirror code, for other people to use
I think someone was working on a proper codemirror addon
oh, @hmadelaine said he might look at creating a proper codemirror addon, so you might be able to use that
alright, I gotta head out for the night
but yeah, great stuff, excited to see cljs tooling move into the devtools space
like i said, it’ll be a huge ux win to have a default-feel for cljs in browser dev
you too man, later
@shaunlebron: spent a bunch of time looking at this line https://github.com/shaunlebron/parinfer/blob/master/lib/src/parinfer/reader.cljc#L95
@shaunlebron: when you have time, can you explain why you’d call `(select-keys state [:x-pos :ch])’?
@dongcarl the whole indent mode “state” is passed to push-char
as the first argument
right, so x-pos
is the column number, and ch
is the current character we are on
these are set at process-char
select-keys
just creates a new map from the given keys, a subset
yes, the process functions assoc the given state with new information
and the :x-pos
:ch
:indent-delta
keys were added to the large state in process functions
so the large state has a lot of things, from initial-state
the stack needs to pull information from the current character to track them
so pushing a character involves pushing some info about that character (`x-pos`, ch
and sometimes indent-delta
)
correct
shaunlebron: also I’ll have the repo set up sometime so you can keep your list updated
cool, feel free to call me on goog hangout for questions like this
though here on slack is fine too for public record
i usually find communication on these kinds of things easier through voice though
it can be, that’s kind of confusing
conj means to add an element to a collection
merge merges two collections
in what context
https://github.com/shaunlebron/parinfer/blob/master/lib/src/parinfer/reader.cljc#L95
[ {} {} {} {} ]
so the stack is just a vector of maps
(conj [] {})
=> [{}]
conj
chooses the operation most efficient for the collection type
for vectors it is added to the end
the stack is a vector, so conj adds to the end, and pops from the end
(conj [a] b)
=> [a b]
(pop [a b])
=> [a]
does the example contradict that
(peek [a b])
=> b
yeah, pop
returns the new stack
yeah, I hope the push-char*
makes sense
it’s reacting to different characters in different ways, hence the different defmethod
s
anything returned from the push-char*
is merged back into the state
that’s what push-char
is essentially doing, without the asterisk
thanks again for playing with this
good luck on finals!
Hi @shaunlebron @darwin ! I have read you conversation, it was very interesting. I begun to isolate code-mirror related code from Parinfer-site. There is two roadblocks at the moment : First, the codeMirror patch for +identhack
. @shaunlebron, do you think it could be merged into CodeMirror.js directly ? The second is the question to extract the VCR from the editor. I have to dig a little deeper to better understand Parinfer and CodeMirror.
@hmadelaine the +indenthack
may be an unnecessary workaround
@shaunlebron: OK, it should simplify the dependency on codemirror
sorry, I’m having to look back at it
it’s only necessary for paren-mode
so if you type character, it preserves the indentation of the line below if the typed character shifts an open-paren after it
(foo (bar
baz))
(food (bar
baz))
so inserting the d
will cause the second line to move forward one space to preserve the original relative indentation
but yeah, this is the use-case, but I can look at how codemirror batches changes, it drove me crazy for a little while. there may be another way
re: the vcr
@shaunlebron: thanks for the explanation
the vcr could be completely removed right?
Yes at first look
we only care about the editing, not recording
@shaunlebron: I will do a first try tomorrow morning
I think the only thing in editor.cljs
that needs to be preserved is on-change
and on-cursor-activity
@shaunlebron: you do not edit this code on Parinfer-site ?
sorry I don’t understand the question
@shaunlebron: I will put a first draft on github. What would be a great name ? The hardest part
codemirror-parinfer probably
judging from the existing addon names
thanks!
@shaunlebron: Thanks to you !
got that repl thing working: https://dl.dropboxusercontent.com/u/559047/cljs-devtools-figwheel-repl-connection.png
everything was entered from devtools (with parinfer assitance), commands are simply echoed into figwheel REPL, @shaunlebron ^