void (@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) { PsiElement position = parameters.getPosition(); IElementType type = position.getNode().getElementType(); if (type != XmlTokenType.XML_DATA_CHARACTERS && type != XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN) { return; } if ((position.getPrevSibling() != null && position.getPrevSibling().textMatches("&")) || position.textContains('&')) { PrefixMatcher matcher = result.getPrefixMatcher(); String prefix = matcher.getPrefix(); if (prefix.startsWith("&")) { prefix = prefix.substring(1); } else if (prefix.contains("&")) { prefix = prefix.substring(prefix.indexOf("&") + 1); } matcher = matcher.cloneWithPrefix(prefix); if (parameters.getInvocationCount() == 0) { matcher = new StartOnlyMatcher(matcher); } addEntityRefCompletions(position, result.withPrefixMatcher(matcher)); } }