@NotNull @Override public EditorHighlighter createEditorHighlighter( @NotNull VirtualFile vFile, @NotNull EditorColorsScheme settings, @Nullable Project project) { FileType fileType = vFile.getFileType(); if (fileType instanceof LanguageFileType) { LanguageFileType substFileType = substituteFileType(((LanguageFileType) fileType).getLanguage(), vFile, project); if (substFileType != null) { EditorHighlighterProvider provider = FileTypeEditorHighlighterProviders.INSTANCE.forFileType(substFileType); EditorHighlighter editorHighlighter = provider.getEditorHighlighter(project, fileType, vFile, settings); boolean isPlain = editorHighlighter.getClass() == LexerEditorHighlighter.class && ((LexerEditorHighlighter) editorHighlighter).isPlain(); if (!isPlain) { return editorHighlighter; } } try { return FileTypeEditorHighlighterProviders.INSTANCE .forFileType(fileType) .getEditorHighlighter(project, fileType, vFile, settings); } catch (ProcessCanceledException e) { throw e; } catch (Exception e) { LOG.error(e); } } SyntaxHighlighter highlighter = null; for (ContentBasedFileSubstitutor processor : Extensions.getExtensions(ContentBasedFileSubstitutor.EP_NAME)) { boolean applicable; try { applicable = processor.isApplicable(project, vFile); } catch (Exception e) { LOG.error(e); continue; } if (applicable && processor instanceof ContentBasedClassFileProcessor) { highlighter = ((ContentBasedClassFileProcessor) processor).createHighlighter(project, vFile); } } if (highlighter == null) { highlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, project, vFile); } return createEditorHighlighter(highlighter, settings); }
@NotNull @Override public EditorHighlighter createEditorHighlighter( @NotNull final FileType fileType, @NotNull final EditorColorsScheme settings, final Project project) { if (fileType instanceof LanguageFileType) { return FileTypeEditorHighlighterProviders.INSTANCE .forFileType(fileType) .getEditorHighlighter(project, fileType, null, settings); } SyntaxHighlighter highlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, project, null); return createEditorHighlighter(highlighter, settings); }