EditorAction `doExecute` not being invoked when other plugins are reading same document

Hello!

I have the following class that implements EditorAction: continue/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AcceptAutocompleteAction.kt at main · continuedev/continue · GitHub

My issue is that there is another plugin (SonarQube) that users of my plugin frequently install which is reading the document on every keystroke. This appears to be preventing my doExecute overridden function from executing. I’ve tried a variety of other methods to acquire a write intent/write lock that are outlined in these docs, and also WriteAction.run, but without success.

My hunch is that I’m unable to acquire the write intent/write lock because of the frequent reads from this other plugin, but I’ve also confirmed with debugger breakpoints that my doExecute is not being invoked at all. This seems to be the root of the problem since my runWriteAction is inside doExecute.

One other interesting note is that this seems to primarily be an issue for Community Edition users but not Ultimate.

Is there a recommended way that I’m missing to await the write intent/write lock that my action needs?

Hi Patrick, welcome to the community :slightly_smiling_face:

I don’t understand how SonarQube’s plugin would block your doExecute(). Could you please point to some code parts of the SonarQube’s plugin that you suspect causes this?

In general, read actions shouldn’t block other actions infinitely, as write actions are prioritized over reads, so it is unlikely that many read actions will block platform code or other plugins’ actions.

Regarding not executing EditorActionHandler.doExecute() I suggest setting breakpoints around its usages in the platform code. I would start with checking what happens in EditorActionHandler.execute(). There are a few ifs there, so maybe your doExecute() is skipped for other reasons than read actions?