Add source code formatting validation

Fix #362.

I add simple validation which looks for erroneous nodes in ASTs to guard against wrong formatting results. Later we should probably extend validation to handle cases where parsing succeeds but type checking has errors.

All error messages are moved to status bar to be less intrusive.

Fix #340.
Fix #319.