[Lang] When to use Annotator and LocalInspectionTool

Are there some usecases when to use them?
Eq.: for semantic checks like "unknown reference" use the Annotator.
When are they executed, what are the limitations.

5 comments
Comment actions Permalink

Hello Sven,

SS> Are there some usecases when to use them?
SS> Eq.: for semantic checks like "unknown reference" use the Annotator.
SS> When are they executed, what are the limitations.

If you need the ability to perform the analysis for multiple files in batch
mode (Analyze | Inspect Code), use LocalInspectionTool. Otherwise, use Annotator.

Annotator gives you more flexibility in reporting the problems (with highlight,
custom tooltips and so on), and better locality (for custom languages, LocalInspectionTool
is always called to reinspect the entire file, while Annotator is called
only for changed fragments of the PSI tree).

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0
Comment actions Permalink

Hello Dmitry,

so I am on the right side :)
Maybe you could add those sentences to your Custom Language Docu? It
simply helps to get the overall picture.

Dmitry Jemerov (JetBrains) schrieb:

Hello Sven,

SS> Are there some usecases when to use them?
SS> Eq.: for semantic checks like "unknown reference" use the Annotator.
SS> When are they executed, what are the limitations.

If you need the ability to perform the analysis for multiple files in
batch mode (Analyze | Inspect Code), use LocalInspectionTool. Otherwise,
use Annotator.

Annotator gives you more flexibility in reporting the problems (with
highlight, custom tooltips and so on), and better locality (for custom
languages, LocalInspectionTool is always called to reinspect the entire
file, while Annotator is called only for changed fragments of the PSI
tree).

0
Comment actions Permalink

Hello Sven,

Added.

SS> so I am on the right side :)
SS> Maybe you could add those sentences to your Custom Language Docu? It
SS> simply helps to get the overall picture.
SS> Dmitry Jemerov (JetBrains) schrieb:
SS>
>> Hello Sven,
>>
>> SS> Are there some usecases when to use them?
>> SS> Eq.: for semantic checks like "unknown reference" use the
>> Annotator.
>> SS> When are they executed, what are the limitations.
>> If you need the ability to perform the analysis for multiple files in
>> batch mode (Analyze | Inspect Code), use LocalInspectionTool.
>> Otherwise, use Annotator.
>>
>> Annotator gives you more flexibility in reporting the problems (with
>> highlight, custom tooltips and so on), and better locality (for
>> custom languages, LocalInspectionTool is always called to reinspect
>> the entire file, while Annotator is called only for changed fragments
>> of the PSI tree).
>>
--
Dmitry Jemerov
Omea Project Leader
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0
Comment actions Permalink

Additionally, LocalInspectionTool gives you the ability to turn the check off independently, which I don't believe Annotator does, and also allows you to configure the inspections via a panel. Thus any analysis about which there might be any disagreement or choices to be made should probably be a LocalInspectionTool, with Annotator used for actual parse errors.

--Dave Griffith

0
Comment actions Permalink

I think a good rule is, if it's an error or semantic highlighting, use
annotator; if it's a warning, use inspection.

Sven Steiniger wrote:

Are there some usecases when to use them?
Eq.: for semantic checks like "unknown reference" use the Annotator.
When are they executed, what are the limitations.

0

Please sign in to leave a comment.