parinfer

shaunlebron 2017-08-05T00:07:45.504355Z

added Options UI to atom: https://github.com/oakmac/atom-parinfer/pull/89

shaunlebron 2017-08-05T00:08:39.511783Z

I think Chris is out until Monday, but v3 should be ready to go as soon as he looks at it

rgdelato 2017-08-05T00:09:06.515326Z

I think there was already a PR for that that was delayed for some reason, might be worth taking a look if you haven't already

rgdelato 2017-08-05T00:09:34.518876Z

(it looks really nice though!)

shaunlebron 2017-08-05T00:11:08.532335Z

yeah, i looked at it! it’s a year old, and only defined a config schema. didn’t handle backwards compatibility with existing config files and didn’t sync with the api

rgdelato 2017-08-05T00:11:28.535104Z

ah, I see. okay, cool

shaunlebron 2017-08-05T00:12:25.542902Z

chris plans on removing the smart mode option if enough beta testers like it. this options UI should get us more testers

rgdelato 2017-08-05T00:14:51.562553Z

I dunno, if Indent Mode is going to stay as a part of Parinfer, I don't see any harm in leaving the option there (unless you do plan on removing it eventually?)

rgdelato 2017-08-05T00:15:09.565018Z

but yeah, making the option easier to turn on should help a lot

shaunlebron 2017-08-05T01:10:48.952900Z

I wouldn’t remove it

tianshu 2017-08-05T07:34:47.585419Z

start writing v3 for emacs, but found it difficult to port, since I want to process buffer instead of text

cfleming 2017-08-05T07:37:20.594379Z

@doglooksgood Do you mean that you want to process the whole buffer rather than strings split into lines?

tianshu 2017-08-05T07:38:29.598538Z

It is said that emacs have better perf to modify text in the buffer directly, instead of take the string, calculate the new string, and substitution.

tianshu 2017-08-05T07:39:05.600531Z

Do you have finished the v3 on Cursive?

cfleming 2017-08-05T07:39:09.600740Z

Right. So the version in Cursive actually does this. I process the whole buffer, and create a list of edits that I then apply to the buffer afterwards.

cfleming 2017-08-05T07:39:25.601664Z

I’m planning to try porting that to the JS version for v3.

cfleming 2017-08-05T07:39:34.602201Z

No, I haven’t had time, but I’m hoping to next week.

cfleming 2017-08-05T07:40:31.606193Z

So if you can wait till next week that might be easier. I think it’s a better approach, it’s almost certainly more efficient in any real editor, and you get things like caret movement for free - parinfer doesn’t have to track it.

tianshu 2017-08-05T07:42:06.612634Z

Yes, but I think emacs and IntelliJ is different, I have to work on emacs version.

tianshu 2017-08-05T07:43:00.615628Z

and I have no confidence on performance of emacs-lisp...😂

cfleming 2017-08-05T07:45:48.626004Z

Right, but I think that the same algorithm that works better for me will also work better for you.

cfleming 2017-08-05T07:46:20.627762Z

I discussed it with @shaunlebron, and he seemed to like the idea. If it works well for the JS version it may become the official version, who knows.

cfleming 2017-08-05T07:46:47.629480Z

So I’m planning to try to modify the current v3 to use that approach, and then I’ll port that to Kotlin for the JVM version.

cfleming 2017-08-05T07:47:00.630264Z

And you can also base your port on the modified JS version.

tianshu 2017-08-05T07:48:18.635116Z

we provide our utilities, and parinfer algorithm call these utilities. the utilities can be something like insert text, delete text, etc?

cfleming 2017-08-05T07:49:27.639306Z

Well, what mine does is I call parinfer with the whole string (which in my version is actually a CharSequence, so IntelliJ doesn’t even have to create a string for the whole buffer). Parinfer then returns a list of changes to apply, which are like insert, delete, modify.

cfleming 2017-08-05T07:49:33.639614Z

Then I apply those to the editor.

tianshu 2017-08-05T07:49:58.641445Z

@shaunlebron Is that parinfer use one result everywhere, and I can make it a global context?

shaunlebron 2017-08-06T16:59:06.958410Z

yeah you can do that

tianshu 2017-08-05T07:50:32.643447Z

@cfleming that means, you still have to deal with the whole buffer string?

cfleming 2017-08-05T08:31:34.797769Z

@doglooksgood In my case no, because I can pass a CharSequence which I get from IntellliJ. That’s an interface which lets me ask for the next char, and IntelliJ internally handles the iteration over its data structures.

cfleming 2017-08-05T08:31:47.798575Z

I don’t know how you would achieve the same in Emacs, if it offers something like that.

cfleming 2017-08-05T08:32:06.799751Z

But assuming that it does, the algorithm uses that trivially.

tianshu 2017-08-05T08:33:41.805351Z

Yes, that is possible in emacs too.

cfleming 2017-08-05T08:35:24.811290Z

Ok, then assuming you’re porting the JS to elisp, you can use that and it will work fine. Then you’ll get a list of edits back and you just apply them to the buffer.

tianshu 2017-08-05T08:38:39.822085Z

so, you are write a new version in JS?

cfleming 2017-08-05T08:48:41.857415Z

I’m planning to try that this coming week.