api to pause indexing
Hi,
The recent IntelliJ versions have the function to pause and resume indexing. I was wondering if there is any plugin api to pause/resume indexing as well as examples to follow? For example, when we detect resource contention on the system, we will automatically pause the indexing for a bit.
Thanks,
Yi
Please sign in to leave a comment.
We're considering such use cases as well (e.g. VCS update or branch switch), but unfortunately there's no such API yet, partly because it's not clear how to distinguish (e.g. visually) whether indexing is paused by user or by another activity.
Thanks Peter. I can think of a couple of approaches for the visual:
1. Expect plugin developers to be good citizens to send an explicit notification that looks like:
X plugin has temporarily disabled indexing, please click <this button> to manually resume or wait for X to resume the indexing process when certain conditions are met.
The API could look like: IndexingManager.getInstance(project).pauseIndexing(String message)
or
2. Enforce the way to obtain the API so the system can infer which plugin requested it and give notice to user which plugin disabled indexing.
In either case, user should be able to resume indexing manually.
Interesting ideas, thanks! I think I like the first one more. I've filed https://youtrack.jetbrains.com/v2/issue/IDEA-185693, you can watch it to get notified.