Language (@NotNull PsiFile file, @NotNull Editor editor, int line) { Document document = editor.getDocument(); int lineEndOffset = document.getLineEndOffset(line) - 1; lineEndOffset = Math.max(0, CharArrayUtil.shiftBackward(document.getCharsSequence(), Math.max(lineEndOffset, 0), " \t")); return PsiUtilCore.getLanguageAtOffset(file, lineEndOffset); }