"I don’t know how to make vscode defer rendering until the whole operation is done" --> this is the exact same problem I ran into here: https://github.com/shaunlebron/vscode-parinfer/pull/39
I think we need to reach out to the VSCode team for help with their API. They made an exception for the vim extension; I suspect we could get a similar arrangement.
I’m not where I have that problem yet. 😃 First I need to figure out how to use the parenMode
and smartMode
functions.
Found my error. :canges
is plural.
The docs says: Process the text after a change OR a cursor movement. Might be because I have quite high fever today, but I don’t really understand why the text should be processed on cursor movement if it is processed on changes. Let me know, please, someone. Speak to me like I am five yo. 🙂
https://github.com/shaunlebron/parinfer/blob/master/lib/doc/code.md#part-2---parinfer-while-typing
parinfer relaxes rules around the cursor, so it needs to know when its position changes
Hmmm. But we give it the previous and current position when we use it. And the functions are pure, right? I found that it will be a bit too much work for me right now to process text on changes, because vscode has limted API:s there, So I am rather considering to process text mainly on cursor movement, but I want to better understand what is going on, so that’s why I ask about it.
in that case it’s fine to skip the cursor event
same thing should happen after the next change event since you pass it the cursor everytime anyway, like you said 👍
So, in implementing parinfer-rust for Kakoune, one issue is that Kakoune natively relies on having multiple cursors (you can't search and replace without multiple cursors, for example). I'll need to add this to parinfer-rust, and I hope to also add it to parinfer just to keep them in sync as much as possible. Have any other editors needed or wanted this? Any pitfalls I should worry about?
One problem is that cursors don't have unique identifiers, so matching previous cursor position to current cursor positions seems difficult. I know how to solve matching problems 😄 But I'll have to figure out what happens when a cursor disappears or appears.