Hi!
I would like to be notified when a new history state is generated.
For example, when I type “Hello world!” I would like to be notified just once; whereas, when I type “Hello” (wait a couple of second) “world!”, I would like to be notified two times, one after “Hello” and one at the end.
Is there a proper way to listen for that?
This feature could have multiple use case. For example, such an event it’s a great place to attach your “save a backup” logic, since the event is fired way less than the on-change event.
I need this feature to stay synced with the Visual Studio Code History API. I’m trying to publish a Visual Studio Code extension on a project based on Codemirror6, and it’s way easier to handle the history from Codemirror6 and just notify Visual Studio when a new state is available.
I briefly looked at the @codemirror/commands source code and could not find anything.
If there is not, could you please consider adding some sort of callback?
I would add it myself, but I have no idea on how to design such an API inside Codemirror6.
Since I need this feature asap, I would try to implement it myself by making my clone of the “history.ts” file. I’ll share it here when it’s ready.
Let me know if I missed something.
Best regards,
Luca Fabbian