parinfer

shaunlebron 2018-02-20T00:05:21.000069Z

🔥 probably the most promising idea for Locus was just posted by @ivanreese here https://twitter.com/spiralganglion/status/965731142996451329

shaunlebron 2018-02-20T00:05:55.000104Z

you’ll have to read the discussion that follows for full context

shaunlebron 2018-02-20T00:06:15.000117Z

looking forward to trying it out

shaunlebron 2018-02-20T00:07:03.000136Z

(Locus is what I alluded to in my talk to help reading lisp, to complement how Parinfer helps writing lisp)

spiralganglion 2018-02-20T00:24:35.000178Z

swoon

spiralganglion 2018-02-20T00:26:15.000175Z

@shaunlebron — It didn't occur to me to come by Slack until just now. I'm here if you feel like hashing things out in a more verbose form, hah.

đź‘Ť 1
dominicm 2018-02-20T08:23:33.000212Z

I'm apparently rate limited on Twitter...

shaunlebron 2018-02-20T17:28:08.000609Z

?

dominicm 2018-02-20T17:33:36.000806Z

I couldn't view the tweet until late morning. It was odd.

cfleming 2018-02-20T21:35:18.000011Z

@shaunlebron You mentioned the other day that you saw bad performance with parinfer in the CLJS project in Cursive. I’m looking at it now and I’m not seeing that.

cfleming 2018-02-20T21:35:37.000434Z

Were you doing anything specific? What were the performance issues you saw?

shaunlebron 2018-02-20T22:02:24.000460Z

@cfleming: this is the video of the performance issue: https://www.youtube.com/watch?v=UBf56R1DTpM

cfleming 2018-02-20T22:06:05.000587Z

@shaunlebron Ok, thanks. I think that’s just an artifact of the fact that the highlighting is asychronous.

cfleming 2018-02-20T22:06:20.000525Z

I don’t think I can do much with that, unfortunately.

shaunlebron 2018-02-20T22:06:51.000027Z

not sure if you could see, so let me clarify

shaunlebron 2018-02-20T22:07:04.000016Z

i hit backspace on the red area to correct the indentation

shaunlebron 2018-02-20T22:07:25.000422Z

and there was a ~1 second delay before it took effect

cfleming 2018-02-20T22:09:27.000475Z

Right, but I think that’s because the highlighting tasks are run asynchronously. That highlighting isn’t driven directly by changes in the editor. When the doc changes, IntelliJ then re-highlights the whole file, and the highlighting pass which adds those markers is run again, checks indentation over the whole file and adds markers where needed.

cfleming 2018-02-20T22:09:41.000360Z

For such a big file, that can take a while.

shaunlebron 2018-02-20T22:10:34.000518Z

you have an idea why you’re not seeing the same behavior on yours?

cfleming 2018-02-20T22:10:52.000327Z

It’s unfortunate, but trying to do it incrementally as the user is editing would be really complicated. I might be able to raise the priority of the highlighting task, I’m not sure.

cfleming 2018-02-20T22:11:14.000269Z

Let me check again. It may just be that I’m seeing what I expect, and you’re not seeing what you expect 🙂

cfleming 2018-02-20T22:11:40.000310Z

IntelliJ users are generally used to the highlighting not being immediate.

shaunlebron 2018-02-20T22:11:53.000276Z

but it’s not highlighting that’s slow

shaunlebron 2018-02-20T22:12:01.000319Z

i’m probably still misunderstanding

cfleming 2018-02-20T22:13:12.000318Z

You’re talking about the red markers being taken away when the indentation is corrected, right?

shaunlebron 2018-02-20T22:13:22.000371Z

I hit backspace here:

|(foo)
it takes ~1 second before I see:
|(foo)

cfleming 2018-02-20T22:13:41.000236Z

So you’re talking about a delay for the actual text to be updated?

shaunlebron 2018-02-20T22:14:34.000240Z

yes

shaunlebron 2018-02-20T22:14:43.000318Z

@cfleming: if you watch at 0:51 https://youtu.be/UBf56R1DTpM?t=51s

shaunlebron 2018-02-20T22:14:56.000226Z

i hit backspace, and it took a long time for it to take effect

cfleming 2018-02-20T22:15:06.000411Z

Ok, then I don’t see that. I do see a delay for the marker to be removed, but the text moves immediately.

cfleming 2018-02-20T22:15:09.000074Z

Ok, one sec

cfleming 2018-02-20T22:17:43.000338Z

Yeah, I see that in that case, however it’s not parinfer-related, I also see that when parinfer is disabled.

cfleming 2018-02-20T22:19:05.000458Z

It seems to be specific to the thing you did. So you hit backspace at the start of a line, and what IntelliJ does in that case is tries to be clever, and deletes the whitespace at the start of that line and puts the caret at the end of the previous line. I think that requires it to calculate formatting information, and I just think that’s slow on a file this big.

cfleming 2018-02-20T22:20:06.000164Z

So if I type on that line, or just delete some normal whitespace that doesn’t require any formatting info, it’s fast.

shaunlebron 2018-02-20T22:20:58.000219Z

so you can reproduce?

cfleming 2018-02-20T22:21:02.000156Z

Yes.

shaunlebron 2018-02-20T22:21:15.000463Z

cool, same page now then

cfleming 2018-02-20T22:21:18.000217Z

But I won’t investigate that as part of this change, since it’s not related to parinfer.

cfleming 2018-02-20T22:22:10.000206Z

I suspect my formatting model creation code could be faster (I need to switch to transducers rather than seqs), which would probably help that. Not having 11k line files would probably also help.

cfleming 2018-02-20T22:23:32.000304Z

Re: the other feedback, as we discussed F2 is standard in IntelliJ and does find those markers. One issue with that though is that the markers are set to have warning level. The way that F2 works is it finds things in order of priority - if you have error level markers then it’ll only cycle through those, then all the warnings etc.

cfleming 2018-02-20T22:24:12.000570Z

So in that file, it takes a while to find the indentation issues because they get buried in all the unused symbols etc.

cfleming 2018-02-20T22:24:59.000596Z

Similarly with the gutter markers - the indentation ones do appear there, but not in red since that’s the colour for error level markers. They’re there in yellow, but they get drowned out by all the other crap in that file.

cfleming 2018-02-20T22:25:41.000031Z

Again, because the file is enormous, all the warning markers in the file get compressed into the single gutter space. It’s not ideal in this case, but I can’t change it easily.

cfleming 2018-02-20T22:26:44.000550Z

I don’t want to give those markers higher priority, because they’re not actually errors. If people start reporting this as an issue, I’ll think about a specific “Jump to indentation problem” action.

cfleming 2018-02-20T22:28:49.000298Z

Hopefully finding them also won’t be an issue if I only run over affected top-level forms, since you’ll only have to correct indentation where you’re actually working anyway.