PlaceChecker () { if (myParameters.getCompletionType() != CompletionType.BASIC) { badPlace = true; return this; } PsiElement element = myParameters.getPosition(); PsiElement xmlText = element.getParent(); if (!(xmlText instanceof XmlText)) { badPlace = true; return this; } PsiElement tagElement = xmlText.getParent(); if (!(tagElement instanceof XmlTag tag)) { badPlace = true; return this; } if (!myTagId.equals(tag.getName())) { badPlace = true; return this; } myProject = element.getProject(); switch (myTagId) { case "artifactId", "groupId", "version" -> checkPlaceForChildrenTags(tag); case "dependency", "extension", "plugin" -> checkPlaceForParentTags(tag); default -> badPlace = true; } return this; }