How to register LocalQuickFix with ExternalAnnotator?

I'm trying to convert my inspection to use an ExternalAnnotator because I understood it fits better an external tool, how exactly I don't know.
I'm having trouble converting my local quick fixes. the registerFix has one signature that accept LocalQuickFix, but requires also a ProblemDescriptor, which sadly I don't have.

  public void registerFix(@NotNull LocalQuickFix fix, @Nullable TextRange range, @Nullable HighlightDisplayKey key,
                          @NotNull ProblemDescriptor problemDescriptor)


Any clues on how to solve it will be appreciated.
Thanks.

3 comments
Comment actions Permalink

Why not use

 
public void registerFix(@NotNull IntentionAction fix);


Just implement your fix as an IntentionAction.

Perhaps you can get some inspiration on how to use an external annotator for inspections.

https://github.com/JetBrains/intellij-community/blob/master/platform/analysis-impl/src/com/intellij/codeInspection/ExternalAnnotatorInspectionVisitor.java

https://github.com/JetBrains/intellij-community/blob/master/python/src/com/jetbrains/python/inspections/PyPep8Inspection.java

0
Comment actions Permalink

Thanks for the reply.
I have, but it doesn't show in the anaylize code panel, only in the editor.

0
Comment actions Permalink

They will show if you use inspection approach (see PyPep8Inspection example linked above)


0

Please sign in to leave a comment.