Fork me on GitHub
#parinfer
<
2017-08-04
>
doglooksgood02:08:13

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*

dominicm06:08:00

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

shaunlebron12:08:45

@dominicm interesting! maybe it shouldn’t

shaunlebron12:08:37

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)

dominicm12:08:09

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.

shaunlebron12:08:53

@doglooksgood smart mode currently works for both of those cases

shaunlebron12:08:04

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

shaunlebron14:08:25

should I just remove this behavior?

shaunlebron14:08:37

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

shaunlebron14:08:26

this would prevent pasted code from modifying indentation below it

shaunlebron14:08:13

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

shaunlebron16:08:01

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

dominicm16:08:12

Glad to have contributed. :)

shaunlebron16:08:47

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)

shaunlebron16:08:54

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

wilkerlucio21:08:27

hello, had anyone used Parinfer + CodeMirror + CLJS?

wilkerlucio21:08:38

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

shaunlebron21:08:17

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

shaunlebron21:08:29

how can I help?

wilkerlucio21:08:29

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

wilkerlucio21:08:54

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

shaunlebron21:08:15

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

shaunlebron21:08:28

and use their global objects

wilkerlucio21:08:31

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

shaunlebron21:08:24

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

shaunlebron21:08:16

what are you using it for?

wilkerlucio21:08:43

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

shaunlebron22:08:29

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

shaunlebron22:08:29

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

wilkerlucio22:08:16

is there a release build version of parinfer?

wilkerlucio22:08:54

or do I need to build it myself?

shaunlebron22:08:59

uglified? I haven’t published one

shaunlebron22:08:11

it’s a single uncompiled js file

wilkerlucio22:08:33

humm, where can I find that?

shaunlebron22:08:13

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

shaunlebron22:08:58

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

shaunlebron22:08:36

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

wilkerlucio22:08:42

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

shaunlebron22:08:35

great, share a link here when you want feedback 🙂

wilkerlucio22:08:37

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