If I create an Editor specifying
as the document and
as fileType, I get an editor with correct JSON syntax highlighting.
But, since I want to create an Editor that will not store its data in a physical file, but rather in file attributes, I use only
new DocumentImpl("initial text data");
when creating the editor. After that, syntax highlighting becomes limited (see picture):
The 2nd editor is created without using a VirtualFile.
I guess the reason highlighting works in the 1st case is because of specifying the ".json" extension.
How can I get syntax highlighting with using only Document, without VirtualFile? When saving editor data, I use document.getText().