A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://plugins.jetbrains.com/docs/intellij/syntax-errors.html below:

Syntax Errors | IntelliJ Platform Plugin SDK

Syntax Errors

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.

Additional highlighting can also be added using Annotators or Inspections, see Controlling Highlighting on how to suppress.

Controlling Syntax Errors Highlighting

In some cases highlighting syntax errors is insufficient or even unnecessary:

The IntelliJ Platform allows plugins to disable highlighting particular syntax errors. These errors can be optionally handled by additional Annotators or Inspections if needed.

To control which PsiErrorElements should be reported and which can be ignored, a plugin has to provide an implementation of HighlightErrorFilter and register it in the com.intellij.highlightErrorFilter extension point. It contains a single abstract method shouldHighlightErrorElement() which should return false if a given PsiErrorElement should not be highlighted in the editor.

Examples:

See also:

19 March 2025


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4