Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Propose history tracers #12
My use-case for this would be tracking ranges over a document. Presumably I'd store the range information in plugin state, and then update when the plugin is given the transaction. I think there should be enough information available through tracers to do this. Having a
referenced this pull request
May 23, 2019
@marijnh just FYI my particular use case looks similar to what you described.
Comments plugin is implemented using decorations. Once a user deletes a text with a comment decorations and then undo deletion - text is restored while comments are lost.
I see. That case wouldn't be straightforwardly covered by this feature, unfortunately—the steps that delete the commented text are likely created by code that doesn't know about comments, and thus won't be adding the tracers to indicate that a given step deletes a comment (which you could then use to restore it when the step is undone).
That is a common use case though, and we should probably try to incorporate it in the proposal. It seems like it would be necessary for plugins to somehow add tracers to any transaction that comes in, maybe through a hook that's called right after the transaction filter.
That seems a bit random, and I don't have time today to think about it more deeply, but I guess it should be safe (adding trace metadata shouldn't conflict with any other functionality).