parinfer

shaunlebron 2017-08-08T00:01:48.637795Z

@cfleming what’s up? 🙂

cfleming 2017-08-08T00:02:09.642887Z

So I’m debugging this case here: (foo}}}}|)

cfleming 2017-08-08T00:02:52.652743Z

Here’s what’s going on: the paren trail is correctly initialised to 4-9, which covers all the closing parens, including mismatched.

shaunlebron 2017-08-08T00:03:07.656029Z

i was looking at that very case

shaunlebron 2017-08-08T00:03:30.661175Z

it was strangely fixed by removing === NEWLINE from isWhitespace

cfleming 2017-08-08T00:04:24.673292Z

But clampParenTrailToCursor seems to be doing the wrong thing. It clamps the paren trail to 8-9, which is right, but then it scans over 4-8 and removes 4 items from parenTrail.openers, even though those are unmatched.

cfleming 2017-08-08T00:05:01.681827Z

There’s only one item in openers, since there’s only one open paren, so what happens is the output is (foo| instead of (foo|)

cfleming 2017-08-08T00:05:33.689198Z

Hmm, I had to add NEWLINE to isWhitespace, but I can’t remember why now.

cfleming 2017-08-08T00:06:50.706751Z

I bet I know what’s happening - I couldn’t figure out how this ever used to work.

cfleming 2017-08-08T00:07:10.711163Z

Previously, onUnmatchedCloseParen would have just deleted the close paren.

cfleming 2017-08-08T00:07:48.719773Z

So clampParenTrailToCursor would have received a paren trail of 4-5, clamped it to 4-5 and not removed anything.

cfleming 2017-08-08T00:07:50.720283Z

Hmm

cfleming 2017-08-08T00:09:58.747923Z

I’m not sure how to handle that - if the unmatched parens aren’t deleted immediately, I’m not sure how to track which are matched and which are not.

cfleming 2017-08-08T00:11:47.772436Z

I don’t think the paren trail start can be moved, since matched and unmatched might be mixed: ((foo)})

cfleming 2017-08-08T00:12:48.785493Z

I think that when cPTTC sees a close paren, it should only remove one from openers if they match.

cfleming 2017-08-08T00:13:50.798850Z

i.e. we should be able to use the openers stack to tell if the closing parens are matched or not.

cfleming 2017-08-08T00:19:37.871756Z

That seems to work:

cfleming 2017-08-08T00:19:40.872471Z

for (i = result.lineStart + startX; i < result.lineStart + newStartX; i++) {
      var ch = text[i];
      if (isCloseParen(ch) && MATCH_PAREN[peek(openers, removeCount).ch] === ch) {
        removeCount++;
      }
    }

cfleming 2017-08-08T00:21:35.895948Z

Unfortunately it broke some other clamping cases:

cfleming 2017-08-08T00:21:41.897164Z

(def b [[c d] |])

cfleming 2017-08-08T00:22:14.903789Z

(let [a 1]|)
  ret)

cfleming 2017-08-08T00:22:37.908615Z

I guess that’s not sufficient to know if the paren is actually unmatched or not.

cfleming 2017-08-08T00:23:51.923928Z

@shaunlebron Any ideas?

shaunlebron 2017-08-08T00:26:39.959380Z

@cfleming: sorry i’m not able to think this far into the weeds on this issue right now

cfleming 2017-08-08T00:26:52.962011Z

Ok np

cfleming 2017-08-08T02:20:24.323583Z

@shaunlebron I’ve pushed some changes, all indent mode tests now work except for that clamping one above.

cfleming 2017-08-08T02:20:42.326621Z

I’m going to start on paren & smart mode now.

chrisoakman 2017-08-08T04:23:08.582238Z

atom-pariner v1.19.0 is available!

🎉 4
chrisoakman 2017-08-08T04:23:33.586171Z

Thanks Shaun for doing most of the hard work 😉

chrisoakman 2017-08-08T04:24:07.591151Z

smartMode is available via Settings. Off by default.

mattly 2017-08-08T04:25:50.608801Z

I just downloaded it, gonna check it out now

mattly 2017-08-08T04:26:58.619932Z

oh, is the file-extensions config setting new?

chrisoakman 2017-08-08T04:28:45.637140Z

It used to be in a file in your home directory. Moved to Atom Settings in this version.

👍 1
cfleming 2017-08-08T04:46:57.812387Z

@shaunlebron Ok, pushed some more fixes. There’s now the one failing case in indent mode, and 3 in paren mode. I haven’t looked at smart mode yet.

cfleming 2017-08-08T04:48:48.830463Z

Feels like it’s getting close though.

shaunlebron 2017-08-08T05:04:13.984824Z

@cfleming: thanks! sorry I couldn’t look today, will try again tomorrow

cfleming 2017-08-08T05:54:37.494076Z

@shaunlebron No problem, if not I’m hopeful I can finish it up.

tianshu 2017-08-08T06:04:53.617117Z

It's likely there's a bug if I insert a pair of parens, then delete the open paren.

rgdelato 2017-08-08T17:08:55.866125Z

Upgraded my Parinfer Atom plugin on another machine, the switch from "Parinfer" to "parinfer" went completely smoothly, great job! 😄

👍 1
mattly 2017-08-08T17:59:04.613010Z

btw, atom 1.19 gives a deprecation error on parinfer 1.19

mattly 2017-08-08T17:59:23.624976Z

I'll report the issue

shaunlebron 2017-08-08T20:05:13.943687Z

damn, atom gets an upgrade the day after we finally release this beta http://blog.atom.io/2017/08/08/atom-1-19.html

shaunlebron 2017-08-08T20:05:23.948994Z

i’ll try to look over it today

shaunlebron 2017-08-08T20:16:33.304445Z

anyone know how to restore a package’s default hotkeys in atom?

shaunlebron 2017-08-08T20:17:30.334654Z

I lost all my parinfer hotkeys when I clicked on a weird hotkey checkbox menu in parinfer settings

mattly 2017-08-08T20:17:54.347317Z

you should be able to click it again to bring it back

shaunlebron 2017-08-08T20:17:55.347613Z

i have only seen it appear there once, and I haven’t seen it since

mattly 2017-08-08T20:18:19.360602Z

there's a listing in settings.cson, 1m

mattly 2017-08-08T20:18:59.381653Z

in settings.cson find packagesWithKeymapsDisabled

shaunlebron 2017-08-08T20:19:33.400051Z

where is the settings.cson file?

mattly 2017-08-08T20:19:52.410294Z

er, sorry , config.cson

mattly 2017-08-08T20:19:53.411062Z

in .atom

mattly 2017-08-08T20:20:02.415949Z

you can choose "Open Config" from the Atom menu

mattly 2017-08-08T20:20:58.446601Z

or bring up the command palette (Cmd-Shift-P on mac) and look for "Application: Open Your Config"

shaunlebron 2017-08-08T20:20:58.446690Z

interesting, thanks!

shaunlebron 2017-08-08T20:21:30.463534Z

i still don’t see the hotkey section in parinfer settings, but my hotkeys are back

shaunlebron 2017-08-08T20:22:33.497364Z

nope, there it is again

shaunlebron 2017-08-08T20:22:51.507863Z

it comes and goes when it wants apparently

shaunlebron 2017-08-08T20:23:18.522137Z

actually, i think it reappeared after I updated to 1.19.2

mattly 2017-08-08T20:23:24.525521Z

I really like working with the new parinfer btw, thanks!

mattly 2017-08-08T20:23:47.537449Z

I haven't been using Atom for long, but I've noticed some oddities with it around updating stuff

mattly 2017-08-08T20:23:57.542764Z

it's not reloadable the way Emacs is

mattly 2017-08-08T20:25:46.601985Z

typically if I make major changes to my init file or change which packages are installed I'll just restart Atom, it seems to be more stable that way

shaunlebron 2017-08-08T20:54:28.526040Z

thanks for feedback/reporting/config advice @mattly! atom does seem to need restarting from time to time

shaunlebron 2017-08-08T20:56:19.585290Z

i’m working on a smaller page to demonstrate new features, so we can get feedback on smart mode stuff

👍 1
shaunlebron 2017-08-08T20:56:58.606488Z

that should get folks to try the new stuff, and we can wait to see if the implementation is stable enough before porting