I think there're two condition for pasting,
(defn foo []
* (f1 bar) ;;; <---
baz)* ;;; <--- I want to copy this two to the below of f3
(f3))
and
(defn foo []
(f1)
(f2))
| <-- paste there
*(f3 bar
baz)* ;;; <-- I want to copy this to the below of f2
*content will be cut*
@shaunlebron oh, so selection indentation moves the whole form, not only the selected area?
@dominicm interesting! maybe it shouldn’t
it would be up to the plugins to just call indent mode instead of smart mode when indenting selections, since parinfer does not know anything about selections (except which line they start on to make tab stops work)
There's a nice UX around just dropping you into indent mode with a quick pair of shortcuts for >
and <
until you hit escape or something there I guess.
@doglooksgood smart mode currently works for both of those cases
not sure what the *content will be cut*
line is
should I just remove this behavior?
(foo [1 2 3]| ; <-- move cursor away and structure preserved below
4 5 6)
(foo [1 2 3]
4 5 6)
this would prevent pasted code from modifying indentation below it
removing this and running indent mode when text is selected would make smart mode more usable for pasting, I’ll go with that and try for a v3 atom release today to get feedback
@dominicm thanks for that insight on selected lines being indented in isolation, seems to work well
Glad to have contributed. :)
available to try in demo editor now: http://shaunlebron.github.io/parinfer/demo
in summary: 1. the first operation allows users to paste superfluous parens without it affecting structure below 2. the second operation shows the difference between indenting at cursor vs selection (i.e. structure below preserved vs modified, respectively)
item 2 will help arm the user with different ways to correct indentation without switching modes
hello, had anyone used Parinfer + CodeMirror + CLJS?
I'm trying to figure the easiest way to bring https://github.com/shaunlebron/parinfer-codemirror on my CLJS code
@wilkerlucio yeah, i use it on the website’s demo editor
how can I help?
@shaunlebron glad to hear I'm not the first one 🙂 how are you importing the parinfer-codemirror code? building from js and require as a <script>
?
I noticed that parinfer
itself is available on cljsjs, but parinfer-codemirror
is not
yeah, just include both parinfer and parinfer-codemirror as scripts, in that order
and use their global objects
I saw you also include Raphael.js, do I need that?
if you want the new indent guides to show up with the guides: true
option. still working on that though
it works
what are you using it for?
I want to write more interactive blog posts on my blog, so I want a Clojure editor so the viewers can interact with some ideas
very cool
i think you’re probably the first user. sorry if there are any issues, let me know if I can help
the older version of the parinfer+codemirror plugin has been used in several places, but this standalone one is the one I’ll be maintaining
thanks 🙂
is there a release build version of parinfer?
or do I need to build it myself?
uglified? I haven’t published one
it’s a single uncompiled js file
humm, where can I find that?
ah, gotcha
https://github.com/shaunlebron/parinfer/blob/master/lib/parinfer.js
i’ve been forgetting to push github releases, but npm install parinfer
will dump the latest build into node_modules/parinfer/parinfer.js
don’t grab from master, but I think the master build is just the latest 3.10.0 right now
lol at me including a 90kb raphael file for indent guides, but it is also for an experimental feature that’s not currently documented
nice, I just got it to work on my current setup 😄
great, share a link here when you want feedback 🙂
@shaunlebron sure, I'll let you know when the first post gets ready, but might take a while, still bootstrapping the new blog (moving out from Medium)