I'm not able to reproduce this easily in a demo project, but I do have a contrived example in a project file of mine. Note, the file is 2.5k+ lines long, perhaps useful to know.
Clipboard1 shows the "before" code of some refactor I want to perform, changing switch to if-else. All of the syntax highlighting and whatnot is correct and as expected
Clipboard2 shows the "after" of the refactor. Note the loss of syntax highlighting of code following the refactor. If done at the top of a file, all code below looks like this.
Clipboard3 shows additional errors when collapsing code, this is extremely wierd.
Is there any specific logging I can collect to help diagnose? Is this a known issue with a cache to clear or key-combo to press? My solution so far has been to close the file and re-open it, unfortunately losing edit history on the file. Not a dealbreaker with source control, but annoying to be sure.