Tracking unresolved references in editor window?

已回答

When opening a project in IntelliJ CE, some of our developers sometimes experiences unresolved symbols (for java class, or android resources, for instance). These are most likely legit (i.e not a bug in IJ), and we would like to try track these with a custom plugin (to ultimately monitor how often the issue occurs).

What is the most elegant way to have our plugin notified when such an unresolved symbol occurs? Is there an extension point we can use, or a Topic we can subscribe to?

1

Maybe something like this:

MarkupModelEx modelEx = (MarkupModelEx)DocumentMarkupModel.forDocument(getDocument(getFile()), getProject(), true);
modelEx.addMarkupModelListener(getTestRootDisposable(), new MarkupModelListener() {
@Override
public void afterAdded(@NotNull RangeHighlighterEx highlighter) {
if (highlighter.getTextAttributesKey() == CodeInsightColors.WRONG_REFERENCES_ATTRIBUTES) {
unresolvedSymbolOccured();
}
}
});
0

请先登录再写评论。