IntelliJ Platform Plugin SDK
 
IntelliJ Platform Explorer

Syntax Errors

Edit pageLast modified: 01 December 2022

The IntelliJ Platform provides a mechanism for analyzing the PSI tree and highlighting syntax errors out of the box.

While the PSI tree for the code is being built, a parser tries to consume tokens according to language grammar. When it encounters a syntax error, like an unexpected token, a PsiErrorElement is created and added to the PSI tree with an appropriate error description. In the code analysis daemon, the IDE visits every PSI element in the tree, and when a PsiErrorElement is encountered, information about it is collected and used while highlighting the code in the editor.