IntelliJ Plugin - Needs to hook into existing actions [closed]
-
21-06-2021 - |
Question
I'm writing a plugin to IntelliJ, and need to hook into some of the existing actions that already exist, like when a file is saved, the code is compiled, or a refactoring happens. I wasn't able to find any info on the plugin site about existing actions, only new actions.
These posts are similar: Save actions in IntelliJ IDEA Intellij reformat on file save
but since they don't include actually writing a plugin, I'm hoping there may be some internal hook for doing so.
Solution
Here's the code example of how to intercept 'on save' event by a custom plugin.
OTHER TIPS
You can hook into 'flush changes to file system' processing via FileDocumentManagerListener registered at the FILE_DOCUMENT_SYNC topic.
You can get more information about IJ messaging here.