Detecting a change in Settings (enabling/disabling a tool)




I am trying to detect a change in the IDE settings, inside an own plugin. Specifically: I need to detect the enabling/disabling of a code quality tool, from the Webstorm IDE settings. I need this so that I can update a (tool) window.

I have read many posts and have tried to use, among many things, the MessageBus (but could not find anything to subscribe to), but in the end I have found no result, no solution for this problem.

Is there any way to detect/listen for such changes in the IDE settings?

If this is not possible with the openapi, is there a hint on how the non-openapi handles this?


Thank you in advance!


Comment actions Permalink

Andrei, Hi!

I'm assuming you're talking about tools like ESLint / TSLint / JSLint and others that are shown in WebStorm settings under Code Quality Tools.

If you want to listen just for the fact that a tool was enabled or disabled, you could try listening for the corresponding inspection being enabled/disabled by implementing com.intellij.profile.ProfileChangeAdapter#profileChanged and add the listener with com.intellij.profile.codeInspection.ProjectInspectionProfileManager#addProfileChangeListener.

So for example for ESLint you could do:

public static void subscribeToESLintChanges(Project project) {
ProjectInspectionProfileManager.getInstance(project).addProfileChangeListener(new ProfileChangeAdapter() {
public void profileChanged(@Nullable InspectionProfile profile) {
boolean isEnabled = EslintConfiguration.getInstance(project).isEnabled();
System.out.println("ESLint was " + (isEnabled? "enabled": "disabled"));
}, project);

However, if you want to distinguish cases when an individual setting was updated (like the path to configuration file or NodeJS interpreter), then there is currently no way to watch for changes.

It's possible to add an API for that, but that will be available only starting with the upcoming 2019.1 version. Please let me know if we can do anything else to help in your use case.


Comment actions Permalink

Hi Maxim,

You are correct, in my specific use case I am targeting the ESLint inspection.

The code you provided is of great help; it is exactly what I needed, so my current problem is solved.

Nevertheless, it would be useful to also have something general, in the future, as you indicated. 

Many thanks again,



Please sign in to leave a comment.