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.
@pez if podcasts are your thing, Shaun talked about it in https://soundcloud.com/user-959992602/s2-e1-lisp-editing-with-shaun-lebron IIRC
Podcasts are my thing. Especially that podcast!
However, I have listened to the episode, and I still would need the actual problem in VS Code spelled out.
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.
It was some time since anyone took a crack at it I think, VSCode might have changed since.
IIRC there’s also a longstanding issue with VSCode Vim that’s reliant on the same issue
@henrik: VSCode hasn’t change in this aspect, I am pretty sure.
My understanding is also hazy, but I believe it was because document update events are asynchronous, and smart mode assumes synchronous updates.
@chrisoakman may remember more details, IIRC he was the one who worked on it.
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.
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:
https://github.com/shaunlebron/parinfer/wiki/Problems-integrating-parinfer-into-Cursive
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
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.
@pez ^^
I also had to modify parinfer to correctly handle multiple carets
Thanks @cfleming! It seems pretty hairy, actually. 😃
It is extremely hairy 🙂
I’m just hoping that I never have to touch that code again 😉