Clojurians
#parinfer
<
2016-02-09
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

chrisoakman00:02:15

although that can probably be safely lowered

chrisoakman00:02:48

Vimscript port is complete

chrisoakman00:02:54

it's pretty rough around the edges right now, but all the tests pass

chrisoakman00:02:57

which is the important thing

chrisoakman00:02:46

@cfleming: debouncing essentially means "only execute parinfer every N milliseconds, even if the user is typing faster than N"

chrisoakman00:02:18

it's a common pattern you see in UIs that have event loops

cfleming01:02:44

@chrisoakman: right, I was just wondering what a good value for N was

cfleming01:02:45

Has anyone using sublime complained about responsiveness at 50ms?

chrisoakman01:02:33

not to my knowledge

chrisoakman01:02:45

there aren't too many Sublime parinfer users though

chrisoakman01:02:53

many more atom-parinfer users

chrisoakman01:02:07

with the JVM speed I would try 10ms first and see how it works

snoe02:02:19

@chrisoakman that's cool, what kind of speeds do you see in viml?

chrisoakman02:02:34

I have no idea :simple_smile:

chrisoakman02:02:37

hopefully that is useful though

chrisoakman02:02:06

think I might be done with Parinfer ports for a while now; I can't think of another major language that needs it

cfleming02:02:43

@chrisoakman: Ok, thanks, I’ll start with 10ms

cfleming02:02:52

Basically, due to the way that IntelliJ works, when I see a change I’ll start a timer, and I’ll coalesce all updates until the timer runs out. On each new change I’ll reset it, so the delay will basically be 10ms since the last change.

chrisoakman02:02:44

in JS it's pretty easy to do debounce; not sure in Java

cfleming02:02:50

There’s some additional complication around things like bulk changes (formatting etc) but that’s the gist of it

chrisoakman02:02:52

you might want to look at how it's done in the sublime-plugin

chrisoakman02:02:54

it just increments and decrements a counter

chrisoakman02:02:32

is the IntelliJ API that you're working with public?

cfleming02:02:27

Ok, I’ll check it out, thanks

cfleming02:02:35

Yeah, the API is all public, but it’s complex

shaunlebron03:02:11

debouncing was something that was necessary when parinfer was slow

shaunlebron03:02:36

but it looks like parinfer-kotlin is sufficiently fast

shaunlebron03:02:32

I just didn’t want parinfer to block the editor’s input thread

shaunlebron03:02:13

Parinfer on JS and JVM can process ~3000 lines about 60-100 times/second

shaunlebron03:02:02

and if a person types 120 wpm, that’s about 8 characters/second

shaunlebron03:02:51

so, parinfer can run 8-10 times between every keystroke without blocking the input thread

shaunlebron04:02:35

so @cfleming, you may want to try it without the debounce first since the JVM version is fast

shaunlebron04:02:55

@chrisoakman: thoughts on removing debounce?

cfleming04:02:06

@shaunlebron: Note that the issue isn’t just replacing the text, since in IntelliJ it also provokes a full parse of the file etc. I still think I’m going to debounce.

cfleming04:02:38

Updating the text will trigger a bunch of background activity of different types.

cfleming04:02:24

Anyone interested in a (huge, but very interesting) discussion on editor latency should see: https://pavelfatin.com/typing-with-pleasure/. Quite amazing results, too.

shaunlebron04:02:55

thanks for the reminder, @denik sent that to me a while back since it seems especially relevant to this

chrisoakman06:02:10

Probably a good idea to keep debounce in, even if it's only set for something like 10ms

chrisoakman06:02:08

in atom-parinfer, sometimes the editor will kick off several events even though the user would assume it is only 1

chrisoakman06:02:15

debounces handles those cases very cleanly

chrisoakman06:02:46

it's almost like a defense against aggressive editor events :wink:

cfleming23:02:03

When using Indent mode in existing integrations, I believe indent and dedent pretty much just use 2 chars, right?

cfleming23:02:31

I know there’s been some discussion about smarter indenting, i.e. trying to choose the right indents to jump to.

cfleming23:02:36

Wow, I should have read the issues ages ago, lots of good stuff there.