Language (@NotNull Editor editor, @NotNull PsiFile file, int line) { Document document = editor.getDocument(); int lineStartOffset = document.getLineStartOffset(line); lineStartOffset = Math.max(0, CharArrayUtil.shiftForward(document.getCharsSequence(), lineStartOffset, " \t")); return PsiUtilCore.getLanguageAtOffset(file, lineStartOffset); }