In my plugin I would like to get a hold of all detected error / warnings while the user is typing. The way I'm getting them now is by listening to the DaemonCodeAnalyzer events with a DaemonListener. In the daemonFinished method I'm running the CodeSmellDetector on all files in the project to get the list with all CodeSmellInfos.
However when I run the plugin on even a tiny project, I notice that it is interfering with the user experience of the IDE. Keyboard events are missed. So I would like to find a more lightweight means of detecting which errors and warnings there are in the project. Do you have any suggestions?
Collecting errors for all files in the project is going to be slow in any case; that's why IntelliJ IDEA has no support for doing this in the background. Also, CodeSmellDetector doesn't reuse any information collected during background code analysis, and calculates the problems from scratch.
If you just need the problems for the current file, the fastest way is probably to use DaemonCodeAnalyzerEx.processHighlights().
For now I will make use of the list of errors returned by the DaemonCodeAnalyzerImpl.getHightlights() method, which is slightly easier to use in our case.
By the way, would there be a way to run the CodeSmellAnalyzer with a limited set of inspections? We are just interested in the compiler errors (and possible warnings) that are present in the project. Having less inspections might speed up the analysis.