parinfer

shaunlebron 2017-08-02T00:51:53.157830Z

error markers aren’t working for some reason, maybe someone else will see the problem? https://github.com/oakmac/atom-parinfer/pull/84

henrik 2017-08-02T04:40:52.729800Z

I like VSCode, it’s very snappy, but stuff like protorepl and parinfer is keeping me in Atom for now.

mattly 2017-08-02T16:02:58.601983Z

I gave VSCode a shot but couldn't get the repl connecting to my boot project, so gave up

mattly 2017-08-02T16:03:05.606805Z

I really want to like it

dominicm 2017-08-02T16:38:53.908778Z

Form a coalition and build your own!

shaunlebron 2017-08-02T05:19:44.119454Z

error markers are working now

shaunlebron 2017-08-02T05:24:59.171948Z

will move on to migrating atom-parinfer config to the settings UI so people can enable smart mode more easily

shaunlebron 2017-08-02T05:56:44.502444Z

smart mode isn’t very smart about pasting

shaunlebron 2017-08-02T05:57:07.506379Z

i’m tempted to make it run indent mode on paste

shaunlebron 2017-08-02T05:58:28.521266Z

copying lines at the end of a function and pasting it in the middle of the function causes subsequent lines to get dedented

shaunlebron 2017-08-02T05:58:31.521769Z

indent mode would prevent that

shaunlebron 2017-08-02T06:03:13.577908Z

when I’m correcting indentation, I am sometimes annoyed that I can’t disconnect a line from its children

shaunlebron 2017-08-02T06:03:39.582776Z

so I think Indent Mode still has its place

dominicm 2017-08-02T06:32:05.936287Z

Fight the good fight. Make sure your editor stays in the ring!

👍 1
dominicm 2017-08-02T06:33:22.953666Z

I haven't followed much of the smart mode discussion or anything. Could there be some "pasting" flag to smart mode that internally uses indent mode?

cfleming 2017-08-02T08:37:11.215895Z

Cutting and pasting is very problematic with parinfer in general.

cfleming 2017-08-02T08:37:42.227651Z

Indent mode only works if the editor is smart about adjusting indentation, and paren mode only works if the pasted text is balanced.

cfleming 2017-08-02T08:38:15.240054Z

(assuming you’re pasting multi-line text)

shaunlebron 2017-08-02T12:38:59.202415Z

how can an editor be smart about adjusting indentation when pasting?

shaunlebron 2017-08-02T12:52:19.533240Z

yeah, I don’t think running indent mode on paste makes sense, since the user would still have to manually go back to indent mode if the editor doesn’t paste the text at the right indentation they wanted

shaunlebron 2017-08-02T12:53:05.553324Z

I’m fine with recommending switching to indent mode to paste for now

shaunlebron 2017-08-02T12:55:21.614452Z

I’ll think about whether the modes should be renamed to reflect when users should be in them

shaunlebron 2017-08-02T13:02:08.807527Z

smart mode -> write mode indent mode -> paste mode paren mode -> (not named, only used when opening unbalanced files)

dominicm 2017-08-02T16:40:43.971289Z

@shaunlebron my brain can never remember the different modes. So if I paste (and something magically does indent). Why can't I go back into smart mode immediately?

shaunlebron 2017-08-02T16:42:01.016960Z

it can throw you back into smart mode if you pasted it at the correct indentation

shaunlebron 2017-08-02T16:42:41.040769Z

but as a vim user, I paste whole lines and adjust indentation after

shaunlebron 2017-08-02T16:43:09.057097Z

the “adjust indentation after” has to happen in indent mode

shaunlebron 2017-08-02T16:44:10.092639Z

I’m not convinced there is enough data in a paste operation to find the correct indentation level

shaunlebron 2017-08-02T16:44:24.101357Z

modes suck, but I don’t see a better solution here

mattly 2017-08-02T16:45:23.137414Z

the way that I've come to think of it when working in emacs is, "I'm splicing the clipboard at this point"

shaunlebron 2017-08-02T16:57:20.558514Z

can you elaborate? I don’t understand what that means

mattly 2017-08-02T16:59:04.621142Z

so I've typically copied one or more expressions

mattly 2017-08-02T16:59:20.630820Z

let's say it's x (a b) y

mattly 2017-08-02T16:59:58.653527Z

and I want to splice that into (foo i j |k)

mattly 2017-08-02T17:00:19.667052Z

where | is the cursor

mattly 2017-08-02T17:00:51.687209Z

maybe the individual symbols are on different lines

mattly 2017-08-02T17:01:25.707757Z

but my expectation is always the same, I'm going to end up with (foo i j x (a b) y k)

shaunlebron 2017-08-02T17:01:41.717995Z

thanks for that example

mattly 2017-08-02T17:02:03.732046Z

the combo of parinfer & smartparens I use in emacs does this like 95% of the time

shaunlebron 2017-08-02T17:02:13.738721Z

the structure has to be preserved since you’ve consciously pasted some valid structure into another

shaunlebron 2017-08-02T17:09:16.980982Z

(let [a 1
      b 2
      c 3] ; <-- cut/paste this line to move it up
  ...)
(let [a 1
      c 3]
      b 2
  ...)
(let [a 1
      c 3]
     b 2  ; <-- smart mode dedents once cursor leaves line above
          ;     (paren mode would same, but immediately)
  ...)
(let [a 1
      c 3
      b 2] ; <-- indent mode would correct the paren
  ...)

shaunlebron 2017-08-02T17:10:21.017494Z

maybe pasting should apply paren mode only if the form is balanced

shaunlebron 2017-08-02T17:11:10.045158Z

and indent mode otherwise

mattly 2017-08-02T17:12:54.104077Z

one of the problems I've had with this combo of evil + parinfer + smartparens is that I have a situation like:

mattly 2017-08-02T17:14:37.163065Z

and out of habit I leave insert-mode to paste, and it cleans up the "trailing" whitespace on that line

mattly 2017-08-02T17:14:46.168422Z

so then I end up with:

mattly 2017-08-02T17:15:39.198887Z

and I then I have to fix it with either indenting or slurping

mattly 2017-08-02T17:16:17.220087Z

though I think this is more a problem of using evil-mode than anything with parinfer

shaunlebron 2017-08-02T17:32:53.803195Z

I almost want to do something crazy like: 1. highlight the pasted text in yellow and drop into indent mode 2. ask the user to correct the indentation (maybe give them a draggable handle bar for it) 3. have a ‘done’ button below and above the pasted text line to drop back into smart mode

dominicm 2017-08-02T17:49:33.384557Z

And you think you can implement that on vim? 😆

😂 1
shaunlebron 2017-08-02T17:50:07.404470Z

ha, I meant atom with vim bindings

shaunlebron 2017-08-02T17:51:14.443554Z

maybe not by overriding native paste, but as a custom “safe paste” operation that can be bound

shaunlebron 2017-08-02T17:59:14.735468Z

anxious to hear other ideas here

mattly 2017-08-02T18:02:15.847976Z

it's a tough problem

mattly 2017-08-02T18:02:41.863831Z

I think there are a handful of different use cases and it's hard to divine intentions