List<PsiReference> (@Nullable XmlTag tag, @NotNull VirtualFile pomFile, @NotNull VirtualFile directory) { var references = new ArrayList<PsiReference>(); if (null != tag) { var oldDirectoryPath = Paths.get(directory.getPath()).normalize(); var modulePath = tag.getValue().getTrimmedText(); var tmpPath = Paths.get(pomFile.getParent().getPath()).normalize(); var referencedDirectoryPath = Paths.get(pomFile.getParent().getPath(), modulePath).normalize(); if (referencedDirectoryPath.startsWith(oldDirectoryPath)) { if (tag instanceof ASTNode node) { var textTag = node.findChildByType(XmlElementType.XML_TEXT); if (null != textTag) { var from = textTag.getStartOffsetInParent(); var length = directory.getName().length(); var items = modulePath.split(DELIMITER_REGEX); for (String item : items) { tmpPath = Paths.get(tmpPath.toString(), item).normalize(); if (!DELIMITER.equals(item) && tmpPath.equals(oldDirectoryPath)) { references.add(new MavenModulePsiReference(tag, tag.getText(), new TextRange(from, from + length))); } from += item.length(); } } } } } return references; }