Trigger event every time indexing finishes
I would like some help with 2 things:
- Triggering an event every time indexing finishes
- How would I add the class that performs that operation in the plugin.xml file?
Some context: I have a function that generates LiveTemplates based on what's in the index. In order to have all the correct LiveTemplates available, I need to trigger regenerating them whenever indexing occurs.
What I have tried: I have a class that is added to the plugin.xml file as a completion.contributor, so when I launch an intellij instance, once the first character is typed, it will create an instance of that class and generate the LiveTemplates. I am using DumbService.runWhenSmart to defer the generation until indexing is completed, however, it still only runs once, when the class is loaded.
Is there something I can use to trigger my code every time indexing occurs?
What kind of entry should I add to plugin.xml to load this class when IntelliJ starts? Or should this load the class every time indexing occurs?
Please sign in to leave a comment.
I figured out the first part of this:
I created a dumbModeListener (for the body of exitDumbMode I launch a new thread to prevent freezing the UI)
val dumbModeListener = new DumbModeListener {override def exitDumbMode(): Unit = ???
}
Then using subscribe on a messageBus from a Project object I subscribed the listener to when dumb mode occurs.
This runs the exitDumbMode code every time that indexing finishes