Skip to content

Commit

Permalink
Add a warning when the action is executed from the write action
Browse files Browse the repository at this point in the history
Related: VIM-3376
  • Loading branch information
AlexPl292 committed Aug 6, 2024
1 parent dfebe54 commit 8d5df11
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys
import com.intellij.openapi.actionSystem.ex.ActionUtil
import com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks
import com.intellij.openapi.actionSystem.impl.ProxyShortcutSet
import com.intellij.openapi.application.ex.ApplicationManagerEx
import com.intellij.openapi.command.CommandProcessor
import com.intellij.openapi.command.UndoConfirmationPolicy
import com.intellij.openapi.components.Service
import com.intellij.openapi.diagnostic.thisLogger
import com.intellij.openapi.editor.actionSystem.DocCommandGroupId
import com.intellij.openapi.progress.util.ProgressIndicatorUtils
import com.intellij.openapi.ui.popup.JBPopupFactory
import com.intellij.openapi.util.NlsContexts
import com.maddyhome.idea.vim.RegisterActions
Expand Down Expand Up @@ -65,6 +68,12 @@ internal class IjActionExecutor : VimActionExecutor {
* @param context The context to run it in
*/
override fun executeAction(editor: VimEditor?, action: NativeAction, context: ExecutionContext): Boolean {
val applicationEx = ApplicationManagerEx.getApplicationEx()
if (ProgressIndicatorUtils.isWriteActionRunningOrPending(applicationEx)) {
// This is needed for VIM-3376 and it should turn into error at soeme moment
thisLogger().warn(RuntimeException("Actions cannot be updated when write-action is running or pending", ))
}

val ijAction = (action as IjNativeAction).action

/**
Expand Down

0 comments on commit 8d5df11

Please sign in to comment.