Force inspection refresh?
Result of my inspection in Java code depends on resource files, and so it would be nice to refresh the inspection once users fixes their resource files. I can't find any API way to achieve this, and Intellij is very unwilling to refresh it even if I type over from scratch a line of code that has an error registered, sometimes I have to type it 5 times over or delete a larger block of code...
Do you mean your inspection is checking resources files, but after user fixes a resource file IntelliJ still shows errors? Or do you mean that after you change the inspection code and reload it, IntelliJ still shows errors from the inspection before the change?
the first option 👍
and referring to the second one, I also found that to be buggy and if I reload the plugin many times inspections will stop refreshing at all, forcing me to do something like Code -> Inspect Code across whole project to refresh. But I am fine with dealing with that during development, as the final users of the inspection won't need to reload it anyway.
I haven't seen the first problem. Maybe the inspection code throws some exceptions (which IIRC can be sometimes not displayed in the UI or logs). If you have an example, I could try debugging it.
The second problem of inspections not refreshing I've experienced myself for quite a while but never bothered looking into it. Probably, this is a good motivation to finally do it 🙃
live-plugin eats the exceptions from inspection code, so that's something to be improved, took me a while to debug that. but that's not the problem here, because I already wrapped my code in a try-catch longer time ago.
but still even if IntelliJ was kind enough to refresh inspection after modyfing one character on the line, which it doesn't, it's still not enough and I am looking really hard for an API function that can be triggered to force refresh the inspection when unrelated file changes...
live-plugin eats the exceptions from inspection code
Hm, are you sure it's live-plugin eating exceptions and not just how IDE works? 🤔
... to force refresh the inspection when unrelated file changes
The bit about unrelated file is what I missed from the explanation. Will let you know if I find a good solution.