Fix wrong active document on syntax classifier

It's really an annoying bug.

The bug can be easily reproduced by opening two files from two projects (Logic and Core for example) and compile the solution.

I added a few more assertions to detect this kind of bugs easier.