void (@NotNull PsiElement scope, @NotNull PsiFile file, @NotNull FileViewProvider viewProvider, @NotNull CharSequence buffer, TextRange range) { String msg = "Range for element: '" + scope + "' = " + range + " is out of file '" + file + "' range: " + file.getTextRange(); msg += "; file contents length: " + buffer.length(); msg += "\n file provider: " + viewProvider; Document document = viewProvider.getDocument(); if (document != null) { msg += "\n committed=" + PsiDocumentManager.getInstance(file.getProject()).isCommitted(document); } for (Language language : viewProvider.getLanguages()) { final PsiFile root = viewProvider.getPsi(language); //noinspection StringConcatenationInLoop msg += "\n root " + language + " length=" + root.getTextLength() + (root instanceof PsiFileImpl ? "; contentsLoaded=" + ((PsiFileImpl)root).isContentsLoaded() : ""); } LOG.error(msg); }