void (@NotNull PsiElement element, List<PsiReference> refs, int hashIndex, String id) { if (isHttpPath(id)) { refs.add(new WebReference(element, new TextRange(1, hashIndex >= 0 ? hashIndex : id.length() + 1), id)); return; } boolean isCompletion = id.contains(CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED); ContainerUtil.addAll(refs, new FileReferenceSet(id, element, 1, null, true, true, new JsonFileType[]{JsonFileType.INSTANCE}) { @Override public boolean isEmptyPathAllowed() { return true; } @Override protected boolean isSoft() { return true; } @Override public FileReference createFileReference(TextRange range, int index, String text) { if (hashIndex != -1 && range.getStartOffset() >= hashIndex) return null; if (hashIndex != -1 && range.getEndOffset() > hashIndex) { range = new TextRange(range.getStartOffset(), hashIndex); text = text.substring(0, text.indexOf('#')); } return new FileReference(this, range, index, text) { @Override protected Object createLookupItem(PsiElement candidate) { return FileInfoManager.getFileLookupItem(candidate); } @Override public Object @NotNull [] getVariants() { final Object[] fileVariants = super.getVariants(); if (!isCompletion || getRangeInElement().getStartOffset() != 1) { return fileVariants; } return ArrayUtil.mergeArrays(fileVariants, collectCatalogVariants()); } private Object @NotNull [] collectCatalogVariants() { List<LookupElement> elements = new ArrayList<>(); final Project project = getElement().getProject(); final List<JsonSchemaInfo> schemas = JsonSchemaService.Impl.get(project).getAllUserVisibleSchemas(); for (JsonSchemaInfo schema : schemas) { LookupElementBuilder element = LookupElementBuilder.create(schema.getUrl(project)) .withPresentableText(schema.getDescription()) .withLookupString(schema.getDescription()) .withIcon(AllIcons.General.Web) .withTypeText(schema.getDocumentation(), true); if (schema.getName() != null) element = element.withLookupString(schema.getName()); if (schema.getDocumentation() != null) element = element.withLookupString(schema.getDocumentation()); elements.add(PrioritizedLookupElement.withPriority(element, -1)); } return elements.toArray(); } }; } }.getAllReferences()); }