mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-30 18:27:49 +08:00
code_inspections_and_intentions.md: cleanup
This commit is contained in:
parent
f2babd4a7b
commit
dab9642d72
@ -2,6 +2,8 @@
|
||||
title: Code Inspections and Intentions
|
||||
---
|
||||
|
||||
### Inspections
|
||||
|
||||
The code inspections for custom languages use the same API as all other code inspections, based on the
|
||||
[LocalInspectionTool](upsource:///platform/analysis-api/src/com/intellij/codeInspection/LocalInspectionTool.java)
|
||||
class.
|
||||
@ -9,12 +11,15 @@ class.
|
||||
The functionality of
|
||||
[LocalInspectionTool](upsource:///platform/analysis-api/src/com/intellij/codeInspection/LocalInspectionTool.java)
|
||||
partially duplicates that of
|
||||
[Annotator](upsource:///platform/analysis-api/src/com/intellij/lang/annotation/Annotator.java).
|
||||
The main differences are that
|
||||
[LocalInspectionTool](upsource:///platform/analysis-api/src/com/intellij/codeInspection/LocalInspectionTool.java)
|
||||
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.
|
||||
[Annotator](./syntax_highlighting_and_error_highlighting.md#annotator).
|
||||
|
||||
The main differences are:
|
||||
- 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)
|
||||
- ability to configure the inspection options.
|
||||
|
||||
If none of that is required and the analysis only needs to run in the active editor,
|
||||
[Annotator](upsource:///platform/analysis-api/src/com/intellij/lang/annotation/Annotator.java)
|
||||
[Annotator](./syntax_highlighting_and_error_highlighting.md#annotator)
|
||||
provides better performance (because of its support for incremental analysis) and more flexibility for highlighting errors.
|
||||
|
||||
**Example**:
|
||||
@ -24,10 +29,12 @@ for
|
||||
[Properties language plugin](upsource:///plugins/properties/)
|
||||
|
||||
|
||||
### Intentions
|
||||
|
||||
The code intentions for custom languages also use the regular API for intentions.
|
||||
The intention classes need to implement the
|
||||
[IntentionAction](upsource:///platform/analysis-api/src/com/intellij/codeInsight/intention/IntentionAction.java)
|
||||
interface and to be registered using the `<intentionAction>` bean in your *plugin.xml*.
|
||||
interface and to be registered using the `com.intellij.intentionAction` extension point in your *plugin.xml*.
|
||||
|
||||
**Example:**
|
||||
A
|
||||
|
Loading…
x
Reference in New Issue
Block a user