Is it possible to add inspection classes dynamically?

Hello,

assuming registering inspections like:

public class MynspectionToolProvider implements InspectionToolProvider {

    @Override
    public Class[] getInspectionClasses() {
        Collection<Class> classes = fetchInspectionTools();
        return classes.toArray(new Class[classes.size()]);

    }
}

where fetchInspectionTools generates some classes dynamically at runtime based on external data.

This works fine, but only on IDE startup. If adding new inspection classes (my external data was updated) it needs a IDE restart, so that getInspectionClasses is reexecuted, the inspections are registered and so on.

My question is, if it is possible to register a new inspection class at runtime without IDE restart?
Is there something like InspectionsManager.register(getInspectionClasses()) ?

Thank you!
0
2 comments

No, there is no such API. Every inspection profile contains a list of instances of all inspections registered at system startup, and persists the settings for those inspections. Because of that, it wouldn't be enough to add the inspections to the inspection manager; you would also need to update all the inspection profiles in the system, and that is not currently supported.

0
Avatar
Permanently deleted user

ok, thx for very fast answer.

0

Please sign in to leave a comment.