I have a persistent problem in one of my language console editors (see: http://devnet.jetbrains.net/message/5458844). I've looked at the things suggested by Jon Ahktar, and as far as I can tell it's all ok. It looks like a concurrency issue to me, since it seems like the contents of the editor gets out of sync with the underlying highlighter segment data structure. This often starts after I perform an action involving my TypedActionHandler, so I thought I would look at other implementations to see what sort of syncronization they use. I found a couple that use FileDocumentManager.requestWriting() and Document.start/stopGuardedBlockChecking(), but it's not clear to me what these do. Can anyone explain these methods? Are they likely to be what I need? My TypedActionHandler modifies the document using EditorModificationUtil/insertStringAtCaret() and Document.deleteString().