PsiElement (@NotNull ActionContext context) { PsiElement leaf = context.findLeaf(); PsiElement element = findMatchingElement(leaf, context); if (element != null) return element; PsiElement leftLeaf = context.findLeafOnTheLeft(); if (leftLeaf != leaf) return findMatchingElement(leftLeaf, context); return null; }