Just to be clear here my suggestion is you consider dropping the code mirror auto completion features so it is “not yours or code mirrors responcibility” and acting to make it possible to use the feature rich autocomplete plugin instead
- bracket closure may be an exception
- in this way you excise this complexity from code mirror and let users make use of a more generic tool that also works inside and outside code mirror.
Of course this is totaly your call because you know more about the issue than I. But perhaps we can help.