@NotNull
@Override
public SyntaxHighlighter getSyntaxHighlighter(@Nullable final Project project, @Nullable VirtualFile virtualFile) {
final Language language = virtualFile instanceof LightVirtualFile ? ((LightVirtualFile)virtualFile).getLanguage() : null;
if (!(language instanceof LivePreviewLanguage)) return new PlainSyntaxHighlighter();
return new SyntaxHighlighterBase() {
@NotNull
@Override
public Lexer getHighlightingLexer() {
return new LivePreviewLexer(project, (LivePreviewLanguage)language) {
@Nullable