Fork me on GitHub
#parinfer
<
2019-11-07
>
pez08:11:55

Hello. Can someone, in the know, make a brief description on what it is that makes smartmode so hard to implement in vscode? I have been using Calva’s Clojure parser/editor/document mirror a bit the last days, and I think it might be possible for Calva to expose an API to it, which might help. But since I don’t know what the problem is, I might just be wrong about Calva being able to help.

pez09:11:55

Podcasts are my thing. Especially that podcast!

pez09:11:33

However, I have listened to the episode, and I still would need the actual problem in VS Code spelled out.

henrik19:11:22

My memory is very hazy. I remember vaguely something to do about needing to grab control of the global buffer state and not being able to, and something about the nature of events firing and the context available in those events.

henrik19:11:49

It was some time since anyone took a crack at it I think, VSCode might have changed since.

mattly20:11:10

IIRC there’s also a longstanding issue with VSCode Vim that’s reliant on the same issue

pez21:11:07

@henrik: VSCode hasn’t change in this aspect, I am pretty sure.

cfleming21:11:16

My understanding is also hazy, but I believe it was because document update events are asynchronous, and smart mode assumes synchronous updates.

cfleming21:11:25

@chrisoakman may remember more details, IIRC he was the one who worked on it.

pez21:11:43

That’s similar to what I recall. But also that the events lacked information about what had happened… but that could have been me just misunderstanding.

cfleming21:11:43

FWIW integrating smart mode was one of the hardest things I’ve ever had to do in Cursive. I wrote up a brain dump about it here:

cfleming21:11:15

I don’t know how much of that applies to VS Code but some of it might, in particular since it supports project-wide refactorings via the LSP

cfleming21:11:25

In general, once an editor moves away from the “a user edits a single file, the changes to that file come from the user typing” model, smart mode gets very hard to integrate.

cfleming21:11:57

I also had to modify parinfer to correctly handle multiple carets

pez22:11:57

Thanks @cfleming! It seems pretty hairy, actually. 😃

cfleming23:11:03

It is extremely hairy 🙂

cfleming23:11:16

I’m just hoping that I never have to touch that code again 😉