This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-21
Channels
- # admin-announcements (3)
- # beginners (15)
- # boot (96)
- # cider (5)
- # cljsjs (2)
- # cljsrn (3)
- # clojure (22)
- # clojure-austin (2)
- # clojure-russia (16)
- # clojured (2)
- # clojurescript (65)
- # css (4)
- # cursive (89)
- # datomic (7)
- # emacs (89)
- # events (1)
- # hoplon (126)
- # leiningen (2)
- # off-topic (2)
- # om (268)
- # onyx (19)
- # parinfer (42)
- # re-frame (5)
- # reagent (30)
- # yada (8)
(sorry about the actual tweet there, I tried to just link the image but Slack is too clever)
@shaunlebron: There’s another interesting case related to maintaining the caret position - maintaining the selection.
And I select the final two lines and indent them, then the selection gets messed up after running parinfer.
It looks like Atom actually handles this correctly even though the file changes, but I’m not sure how.
@chrisoakman: Do you know how that works? Do you have to do anything explicit to maintain the selection?
I capture the selection before parinfer runs, then I re-apply that selection after it's finished
in Atom, a selection is just an array of points
I don't modify the selection at all, essentially
I'm not 100% sure if that is "correct", but it always seems to feel natural when I'm using it
if that makes sense
the relevant Atom integration code is all in this function: https://github.com/oakmac/atom-parinfer/blob/master/src-cljs/atom_parinfer/core.cljs#L244-L279
that function is the heart and soul of atom-parinfer
everything else is essentially plugin state management or interop / event glue code
I suppose?
I guess it might just move it whatever characters have been added to the end of a line
I'm not 100% sure
when I was first setting up atom-parinfer it would lose the selection completely, then I just tried copying the old selection into the result text
and it seemed to work ok
I think most of the time when you're modifying the file and have a selection, you have multiple lines selected and are probably indenting / dedenting
that's my normal use case for it anyway
yeah - give it try and see how it feels / performs
no one has complained about atom-parinfer selection
and I don't notice any problems with it
BTW I think it would be a good idea to have some perf tests where changes are actually made to the document.
Currently the really big file test, just runs parinfer but (presumably) doesn’t actually modify it.
yeah - I agree with that
That might actually change the perf a bit since it’ll have to copy more strings around.
real-world will be modifications
real-world will be lots of changes happening from parenMode()
Right. I’m going to modify the JVM version at least to create a set of diffs rather than return a new file, that should eliminate a lot of string copying, and I suspect that for most editors it will be more efficient to apply.
I’ll make that modification in my fork first, and then we can see if that’s something we might want in the official version or not.
sounds good; I haven't caught up with the last few days of Parinfer news
have been working on a different project