This is a long standing problem with the code formatter. It goes back to even the original DelForEx plugin and Delphi 5. Something it does when changing the text in the code editor makes the IDE flaky afterwards. It doesn't happen all the time, is not really reproducible but it happens often enough to be annoying. The symptom is that when selecting some text the IDE throws an exception in the code editor dll. The only way to stop it from reappearing is to deselect the text. After that it is a very good idea to exit the IDE because the problem will come back very often. When exiting the IDE after this, there are usually several other exceptions dialogs. Sometimes the only way to really close it is to kill it through the task manger because the exception dialogs never stop popping up.
I really need to remember to make some screenshots the next time this happens. I keep forgetting to write a bug report so I have now started even though the information is rather thin.