@Override
    public void visitFile(PsiFile file) {
      final VirtualFile virtualFile = file.getVirtualFile();
      if (virtualFile == null) {
        return;
      }

      final Project project = file.getProject();
      Document document = PsiDocumentManager.getInstance(project).getDocument(file);
      if (document == null) return;
      final HighlightInfoFilter[] filters =
          ApplicationManager.getApplication()
              .getExtensions(HighlightInfoFilter.EXTENSION_POINT_NAME);
      GeneralHighlightingPass pass =
          new GeneralHighlightingPass(project, file, document, 0, file.getTextLength(), true) {
            @NotNull
            @Override
            protected HighlightVisitor[] createHighlightVisitors() {
              return new HighlightVisitor[] {
                new DefaultHighlightVisitor(project, highlightErrorElements, runAnnotators, true)
              };
            }

            @Override
            protected HighlightInfoHolder createInfoHolder(final PsiFile file) {
              return new HighlightInfoHolder(file, getColorsScheme(), filters) {
                @Override
                public boolean add(@Nullable HighlightInfo info) {
                  if (info == null) return true;
                  if (info.type == HighlightInfoType.INJECTED_LANGUAGE_FRAGMENT) return true;
                  if (info.getSeverity() == HighlightSeverity.INFORMATION) return true;

                  result.add(Pair.create(file, info));

                  return true;
                }
              };
            }

            @Override
            protected void killAbandonedHighlightsUnder(
                @NotNull TextRange range,
                @Nullable List<HighlightInfo> holder,
                @NotNull ProgressIndicator progress) {
              // do not mess with real editor highlights
            }

            @Override
            protected boolean isFailFastOnAcquireReadAction() {
              return false;
            }
          };
      DaemonProgressIndicator progress = new DaemonProgressIndicator();
      progress.start();
      pass.collectInformation(progress);
    }
 private synchronized DaemonProgressIndicator createUpdateProgress() {
   DaemonProgressIndicator progress =
       new DaemonProgressIndicator() {
         @Override
         public void stopIfRunning() {
           super.stopIfRunning();
           myProject.getMessageBus().syncPublisher(DAEMON_EVENT_TOPIC).daemonFinished();
         }
       };
   progress.start();
   myUpdateProgress = progress;
   return progress;
 }