parinfer

shaunlebron 2018-01-30T02:27:45.000067Z

@doglooksgood whoa, nice!

tianshu 2018-01-30T02:38:32.000208Z

Still can't understand the how things work in parinfer.js, so I wrote with my own understanding of what it should be. Now trying to find the solution for best performance, hope to be available soon.

cfleming 2018-01-30T02:39:32.000163Z

@doglooksgood That’s a whole rewrite of smart mode?

tianshu 2018-01-30T02:58:49.000242Z

yes, whole rewrite.

tianshu 2018-01-30T03:04:16.000066Z

I decide to have only smart mode. no custom options. @cfleming

cfleming 2018-01-30T03:05:07.000092Z

Sounds good - I’ll be doing that in Cursive too. Make sure you check out the test cases though, there are lots of corner cases and Shaun put a lot of work into dealing with them.

cfleming 2018-01-30T03:05:37.000023Z

I mean, I’ll only be having Smart Mode, not that I’ll be rewriting parinfer too.

tianshu 2018-01-30T06:10:08.000129Z

@cfleming I'm stuck with the perf issue, emacs has some built-in support for query syntax of code. I use them to get some information like "whether the cursor is on comment or not?", instead of parse the code in string. but I found it is likely slower. Is cursive try to keep logic as the same as parinfer.js or write its own?

tianshu 2018-01-30T06:14:08.000116Z

and I hope there's a post on how parinfer works, like in its homepage. 1 we remove the unstable close paren, 2 we insert the close paren according to the openers and indentation. obviously, this is a brief and the real is not simple like this. but I want a article for the rule of smart mode and the flow of how it works.

cfleming 2018-01-30T07:04:44.000007Z

@doglooksgood Yes, Cursive uses a port of parinfer.js to Kotlin (based on parinfer-jvm, but my version is quite different from that now).

cfleming 2018-01-30T07:05:04.000207Z

So when Shaun makes a fix I just port it over.

tianshu 2018-01-30T07:06:23.000096Z

I think it's pretty hard to make a perf good. 😢

tianshu 2018-01-30T07:06:42.000099Z

maybe my implementation is too naive.