The code inspections for custom languages use the same API as all other code inspections, based on the LocalInspectionTool class.
The functionality of LocalInspectionTool partially duplicates that of Annotator. The main differences are that LocalInspectionTool supports batch analysis of code (through the Analyze | Inspect Code... action), the possibility to turn off the inspection (globally or by suppressing them on various levels) and to configure the inspection options. If none of that is required and the analysis only needs to run in the active editor, Annotator provides better performance (because of its support for incremental analysis) and more flexibility for highlighting errors.
Example: A simple inspection for Properties language plugin
The code intentions for custom languages also use the regular API for intentions.
The intention classes need to implement the
IntentionAction
interface and to be registered using the <intentionAction>
bean in your plugin.xml.
Example: A simple intention action for Groovy