int (@NotNull PsiElement element, @Nullable PsiElement topLevel) { int depth=0; PsiElement parent = element; while (parent != topLevel && parent != null) { depth++; parent = parent.getContext(); } return depth; }