java.lang.Throwable: Synchronous execution under ReadAction how to implement solution

Answered

Hi! I've already developed Annotator implementation  for code highlighting which is working in every window using an implementation of ProjectActivity with FileEditorManagerListener inside. And actually it works as expected except I get this “java.lang.Throwable: Synchronous execution under ReadAction how to implement solution” constantly in logs, it happens in git operations. So I tried to fix it and really tested ALL I could find - “ApplicationManager.getApplication().executeOnPooledThread” with “ApplicationManager.getApplication().invokeLater”, I also tried CountDownLatch. But when I implement this threading approach my plugin stops highlighting anything, even though it shows in logs that it highlights. Can you suggest the correct way to implement this multithreading handling or I probably can just ignore this error and release the plugins as it is?
 

0
5 comments

Do I understand correctly that you invoke Git Operations from your Annotator? This will not work and cause unpredictable performance issues. Please try migrating to ExternalAnnotator instead, which is meant for integrating with highlighting data provided by external tools: https://plugins.jetbrains.com/docs/intellij/syntax-highlighting-and-error-highlighting.html#external-annotator

1

Thanks Yann Cebron you have really helped! I've been struggling for a few full days with this before your solution.

0

Hi Yann Cebron again, I'm still regarding this issue. So I'd done your suggestion, and now I've even finished and published my plugin and it's using ExternalAnnotator implementation. But it's really slow, if on a test environment it refreshes  highlighting in case of text changing more or less fast, but in a real big project it takes really minutes to update highlighting (or even doesn't update at all until the file is manually re-opened)
I understand that this is because this annotator is considered as slow one, but I really need such annotation to work faster, with delay max few seconds, not minutes
what can I do in this case?

0

btw for analysis triggering I use such class

0

Please sign in to leave a comment.