parinfer

tianshu 2017-08-04T02:27:13.932039Z

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*

dominicm 2017-08-04T06:32:00.788216Z

@shaunlebron oh, so selection indentation moves the whole form, not only the selected area?

shaunlebron 2017-08-04T12:38:45.516529Z

@dominicm interesting! maybe it shouldn’t

shaunlebron 2017-08-04T12:39:37.534714Z

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)

dominicm 2017-08-04T12:41:09.567129Z

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.

shaunlebron 2017-08-04T12:43:53.626611Z

@doglooksgood smart mode currently works for both of those cases

shaunlebron 2017-08-04T12:44:04.630682Z

not sure what the *content will be cut* line is

shaunlebron 2017-08-04T14:44:25.295129Z

should I just remove this behavior?

shaunlebron 2017-08-04T14:45:37.336810Z

(foo [1 2 3]|  ; <-- move cursor away and structure preserved below
      4 5 6)
(foo [1 2 3]
     4 5 6)

shaunlebron 2017-08-04T14:46:26.365572Z

this would prevent pasted code from modifying indentation below it

shaunlebron 2017-08-04T14:50:13.498340Z

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

shaunlebron 2017-08-04T16:30:01.925725Z

@dominicm thanks for that insight on selected lines being indented in isolation, seems to work well

dominicm 2017-08-04T16:33:12.026336Z

Glad to have contributed. :)

shaunlebron 2017-08-04T16:34:51.077527Z

available to try in demo editor now: http://shaunlebron.github.io/parinfer/demo

shaunlebron 2017-08-04T16:39:47.229996Z

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)

shaunlebron 2017-08-04T16:40:54.263797Z

item 2 will help arm the user with different ways to correct indentation without switching modes

wilkerlucio 2017-08-04T21:47:27.698678Z

hello, had anyone used Parinfer + CodeMirror + CLJS?

wilkerlucio 2017-08-04T21:47:38.702218Z

I'm trying to figure the easiest way to bring https://github.com/shaunlebron/parinfer-codemirror on my CLJS code

shaunlebron 2017-08-04T21:51:17.768960Z

@wilkerlucio yeah, i use it on the website’s demo editor

shaunlebron 2017-08-04T21:51:29.772534Z

how can I help?

wilkerlucio 2017-08-04T21:52:29.790711Z

@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>?

wilkerlucio 2017-08-04T21:52:54.797926Z

I noticed that parinfer itself is available on cljsjs, but parinfer-codemirror is not

shaunlebron 2017-08-04T21:56:15.858794Z

yeah, just include both parinfer and parinfer-codemirror as scripts, in that order

shaunlebron 2017-08-04T21:56:28.862641Z

and use their global objects

wilkerlucio 2017-08-04T21:57:31.881580Z

I saw you also include Raphael.js, do I need that?

shaunlebron 2017-08-04T21:58:24.898023Z

if you want the new indent guides to show up with the guides: true option. still working on that though

shaunlebron 2017-08-04T21:58:30.899802Z

it works

shaunlebron 2017-08-04T21:59:16.913807Z

what are you using it for?

wilkerlucio 2017-08-04T21:59:43.921886Z

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

shaunlebron 2017-08-04T22:00:04.928134Z

very cool

shaunlebron 2017-08-04T22:00:29.936519Z

i think you’re probably the first user. sorry if there are any issues, let me know if I can help

shaunlebron 2017-08-04T22:01:29.955543Z

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

wilkerlucio 2017-08-04T22:02:06.966480Z

thanks 🙂

wilkerlucio 2017-08-04T22:02:16.969532Z

is there a release build version of parinfer?

wilkerlucio 2017-08-04T22:02:54.980261Z

or do I need to build it myself?

shaunlebron 2017-08-04T22:02:59.981618Z

uglified? I haven’t published one

shaunlebron 2017-08-04T22:03:11.985079Z

it’s a single uncompiled js file

wilkerlucio 2017-08-04T22:03:33.991570Z

humm, where can I find that?

wilkerlucio 2017-08-04T22:03:44.994544Z

ah, gotcha

shaunlebron 2017-08-04T22:04:13.002970Z

i’ve been forgetting to push github releases, but npm install parinfer will dump the latest build into node_modules/parinfer/parinfer.js

shaunlebron 2017-08-04T22:04:58.015993Z

don’t grab from master, but I think the master build is just the latest 3.10.0 right now

shaunlebron 2017-08-04T22:07:36.060015Z

lol at me including a 90kb raphael file for indent guides, but it is also for an experimental feature that’s not currently documented

wilkerlucio 2017-08-04T22:09:42.094336Z

nice, I just got it to work on my current setup 😄

shaunlebron 2017-08-04T22:13:35.155886Z

great, share a link here when you want feedback 🙂

wilkerlucio 2017-08-04T22:20:37.261439Z

@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)