Fork me on GitHub
#parinfer
<
2018-02-14
>
shaunlebron08:02:32

i wonder if the production Cursive build is still using v1 behavior

cfleming08:02:11

@shaunlebron I actually can’t remember.

cfleming08:02:55

In the parinfer demo editor, with forceBalance on I get this: [[{| []}]]

cfleming08:02:06

Which is definitely not what you want.

shaunlebron08:02:43

@cfleming: that is what v1 did

cfleming08:02:17

I’m actually considering just always inserting balanced parens in parinfer mode.

shaunlebron08:02:54

(|foo => ()|foo?

cfleming08:02:55

You’d lose the slurp/barf-like functionality, but it seems a little unpredictable.

cfleming08:02:24

I mean when the user types an opening paren, always inserting the balancing closing paren.

cfleming08:02:51

So if the user types (, I’d add () and leave the caret between them.

cfleming08:02:13

Parinfer is the only editing mode which doesn’t act like that, unless the user totally turns paren balancing off.

shaunlebron09:02:35

So, typing ( at |foo => (|)foo

shaunlebron09:02:10

that would turn off wrapping behavior of (|foo => (|foo)

cfleming09:02:44

So if the user wanted to wrap they’d have to use the wrapping commands from paredit.

cfleming09:02:59

Those and Raise are almost the only ones I use still.

cfleming09:02:57

The wrapping commands are easy to remember in Cursive, they’re just Ctrl/Cmd + the normal key.

shaunlebron09:02:35

@cfleming: I think that’s a reasonable compromise to just auto-insert )

cfleming09:02:53

At least as an option, I think so.

cfleming09:02:14

The in-line inference doesn’t look like it has an easy solution.

shaunlebron09:02:54

i spent a long time last year thinking about that

cfleming09:02:03

Hehe, yeah, I know - I can’t remember all the details, but it just seems really messy

shaunlebron09:02:36

basically, it hit the boundary of what was possible by not looking at the content of the change

shaunlebron09:02:34

anyway, will explore what to do when pasting (( or deleting a ), since those are the cases not solved by auto-insertion of ) when typing (

shaunlebron09:02:40

that will be v4

cfleming09:02:19

Yes, better inference will still be very useful, no doubt.

taylor14:02:13

from my perspective as a user I think you’ve done a great job “hiding” all this intricate behavior/logic, because I had no idea this was so hard a problem until I started looking into the implementation. I guess I assumed because it was pretty intuitive to use, it was probably ~easy to pull off 😄

tianshu17:02:30

process 2800 lines in 20ms

justinbarclay17:02:04

I use parinfer everyday at work, and I am super excited for this new version to come out. Thanks for all the work you’re putting in.

tianshu18:02:17

new version will come soon:grinning:

shaunlebron17:02:52

@taylor thanks for saying that, it should probably easier to pull off than it was, but i’m still trying to figure it all out

shaunlebron17:02:09

@doglooksgood whoa 🎉, what was the change?

tianshu17:02:02

some functions in emacs are really slow, I just rewrite for avoid these functions. but it's not a completed implementation yet. I use lisp-indent-line to do indent instead of calculate delta x. but it's looks almost finished.

tianshu17:02:37

but I can still feel lag if on a file large than 1k lines. just don't know why. file with 1k lines only take 9ms to process(do all work, not parsing). so it's still need avoid process whole buffer. but it's much faster than the current parinfer-mode.

shaunlebron17:02:03

but you’re still only processing top-level expressions right?

shaunlebron17:02:17

and it’s still lagging on 1kloc files?

tianshu17:02:18

no, whole buffer, 2800lines, 20ms

shaunlebron17:02:42

ah, cool! so you can avoid the lag with the top-level form hack atom uses

tianshu17:02:13

yes, that's pretty easy to achieve

shaunlebron17:02:24

man that gif is fun to watch 🙂

shaunlebron17:02:17

you even implemented the status message errors from parinfer?

tianshu17:02:17

yes, error will display.

tianshu17:02:44

It's better to show error position with overlay, but I haven't implement

tianshu17:02:23

some behavior is different with parinfer demo, for I let emacs do indent instead of preserve. lot of work need to be done for this.

tianshu17:02:29

I just want to update this as a new mode called parinfer-smart in current parinfer-mode when it's stable.

dominicm17:02:36

I need to port neovim's parinfer implementation if emacs is getting smart mode. Can't have that kind of imbalance (pun intended)

tianshu17:02:12

it's very nice that neovim can use javascript extension.

dominicm17:02:19

Very convenient, yes.

dominicm17:02:41

I think @eraserhd was working on this actually.

tianshu18:02:41

....I made mistake, is 160ms on 2800lines... no 16ms:sob:

tianshu18:02:08

faster than the old version. but not so fast

tianshu18:02:08

but after byte compile, it's fast again:sunglasses: