Fork me on GitHub
#parinfer
<
2017-08-05
>
shaunlebron00:08:39

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

rgdelato00:08:06

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

rgdelato00:08:34

(it looks really nice though!)

shaunlebron00:08:08

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

rgdelato00:08:28

ah, I see. okay, cool

shaunlebron00:08:25

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

rgdelato00:08:51

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?)

rgdelato00:08:09

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

shaunlebron01:08:48

I wouldn’t remove it

tianshu07:08:47

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

cfleming07:08:20

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

tianshu07:08:29

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.

tianshu07:08:05

Do you have finished the v3 on Cursive?

cfleming07:08:09

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.

cfleming07:08:25

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

cfleming07:08:34

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

cfleming07:08:31

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.

tianshu07:08:06

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

tianshu07:08:00

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

cfleming07:08:48

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

cfleming07:08:20

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.

cfleming07:08:47

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.

cfleming07:08:00

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

tianshu07:08:18

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

cfleming07:08:27

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.

cfleming07:08:33

Then I apply those to the editor.

tianshu07:08:58

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

shaunlebron16:08:06

yeah you can do that

tianshu07:08:32

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

cfleming08:08:34

@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.

cfleming08:08:47

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

cfleming08:08:06

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

tianshu08:08:41

Yes, that is possible in emacs too.

cfleming08:08:24

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.

tianshu08:08:39

so, you are write a new version in JS?

cfleming08:08:41

I’m planning to try that this coming week.