Fix: Document without a filePath cannot use codechat either.
Fix: Empty documents are not handled properly because _canPreview structure is not properly written.
Add: 3 test cases (might be redundant) for empty document case.