void (@NotNull PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider( or(psiElement(YAMLQuotedText.class), psiElement(YAMLPlainTextImpl.class)), new PsiReferenceProvider() { @Override public boolean acceptsTarget(@NotNull PsiElement target) { return false; // web references do not point to any real PsiElement } @Override public PsiReference @NotNull [] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) { if (!(element instanceof YAMLScalar scalarElement)) return PsiReference.EMPTY_ARRAY; if (!element.textContains(':')) return PsiReference.EMPTY_ARRAY; LiteralTextEscaper<? extends PsiLanguageInjectionHost> escaper = scalarElement.createLiteralTextEscaper(); if (!escaper.isOneLine()) return PsiReference.EMPTY_ARRAY; TextRange textRange = escaper.getRelevantTextRange(); if (textRange.isEmpty()) return PsiReference.EMPTY_ARRAY; String textValue = scalarElement.getTextValue(); if (GlobalPathReferenceProvider.isWebReferenceUrl(textValue)) { return new PsiReference[]{new WebReference(scalarElement, textRange, textValue)}; } return PsiReference.EMPTY_ARRAY; } }, PsiReferenceRegistrar.LOWER_PRIORITY); }