Plug-in hook for note (specifically tags) changing

I am making a plugin and would like to keep something in sync with the set of tags that exist. I found the editor_did_update_tags hook, but this doesn’t trigger in a lot of situations that a tag gets changed.

The most recent information I found was this thread: forums .ankiweb.net/t/propagating-tag-changes-to-the-sidebar-and-to-add-ons/3075* from a few years ago that claims it wasn’t possible at the time but was being worked on. Has that changed? I still don’t see a way to do this.

In the absence of an officially sanctioned way of doing this, I was considering overriding update_note from qt/aqt/operations/note.py. Is there a reason there isn’t already a plugin hook called from that function?

UPDATE: I tested overriding update_note() and that doesn’t see all the changes to tags either. Is there any way to do this with modern Anki?

*space included because apparently I haven’t earned the privilege of including links in my posts yet?

1 Like

The operation_did_execute hook can be used to observe when a tag was added or removed from the tag list, on when a note was modified. It is not possible to inspect what has changed; it is simply a notification that the UI needs updating, so if you need to handle specific changes, you’ll need to keep state and compare.

1 Like

This suits my needs, thank you!