8280 - AssertionError with my Plugin
I'm attempting to get my IdeaVIM plugin working with Diana build 8280. This code all works as-is in IDEA 7.0.3. I am getting the following stack trace/assertion when attempting to call the code completion action from within a write action:
No message
java.lang.AssertionError
at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.invoke(CodeCompletionHandlerBase.java:184)
at com.intellij.codeInsight.actions.CodeInsightAction$1$1.run(CodeInsightAction.java:57)
at com.intellij.codeInsight.actions.CodeInsightAction$1.run(CodeInsightAction.java:64)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:26)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:85)
at com.intellij.codeInsight.actions.CodeInsightAction.actionPerformedImpl(CodeInsightAction.java:51)
at com.intellij.codeInsight.completion.actions.CodeCompletionAction.actionPerformedImpl(CodeCompletionAction.java:4)
at com.intellij.codeInsight.actions.CodeInsightAction.actionPerformed(CodeInsightAction.java:38)
at com.maddyhome.idea.vim.action.OriginalDelegateAction.actionPerformed(OriginalDelegateAction.java:28)
at com.maddyhome.idea.vim.KeyHandler.executeAction(KeyHandler.java:549)
at com.maddyhome.idea.vim.KeyHandler$ActionRunner.run(KeyHandler.java:619)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:120)
at com.maddyhome.idea.vim.helper.RunnableHelper$WriteAction.run(RunnableHelper.java:69)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:104)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:85)
at com.maddyhome.idea.vim.helper.RunnableHelper.runWriteCommand(RunnableHelper.java:42)
at com.maddyhome.idea.vim.KeyHandler.handleKey(KeyHandler.java:479)
at com.maddyhome.idea.vim.action.PassThruDelegateAction.actionPerformed(PassThruDelegateAction.java:58)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.a(IdeKeyEventDispatcher.java:114)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.b(IdeKeyEventDispatcher.java:54)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:77)
at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:128)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:130)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Any ideas on why I'm getting the assertion?
Please sign in to leave a comment.
Hello Rick,
You've answered your own question: the assertion happens because you're calling
code completion from a write action. :) Due to new support for background
filling of completion lists, this is now forbidden.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
So is the fix as simple as calling code completion from a read action then? Thanks.
Yes it was. I just tried it and that solved the issue. I don't understand why an action that changes the contents of a document can't be in a write action but changing my code to use a read action for the code completion actions solved the problem.
Rick