boolean (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { if (file instanceof EditorConfigPsiFile) { int currOffset = editor.getCaretModel().getOffset(); if (currOffset == file.getTextLength() && currOffset > 0) currOffset --; PsiElement contextElement = file.findElementAt(currOffset); if (contextElement != null) { if (contextElement instanceof PsiWhiteSpace) { PsiElement prev = contextElement.getPrevSibling(); return prev != null && (prev.getNode().getElementType() == EditorConfigElementTypes.SECTION || prev.getNode().getElementType() == EditorConfigElementTypes.HEADER || prev instanceof EditorConfigOption); } else if (contextElement.getNode().getElementType() == EditorConfigElementTypes.IDENTIFIER) { return contextElement.getTextRange().getStartOffset() == currOffset; } } } return false; }