private static @NotNull RelatedItemLineMarkerInfo<PsiElement> createLineMarkerInfo(@NotNull PsiElement element,
                                                                                     @NotNull PsiElement relatedElement,
                                                                                     @NotNull String itemTitle) {
    final SmartPointerManager pointerManager = SmartPointerManager.getInstance(element.getProject());
    final SmartPsiElementPointer<PsiElement> relatedElementPointer = pointerManager.createSmartPsiElementPointer(relatedElement);
    final String stubFileName = relatedElement.getContainingFile().getName();
    return new RelatedItemLineMarkerInfo<>(
      element, element.getTextRange(), ICON,
      element1 -> itemTitle + " in " + stubFileName, (e, elt) -> {
        final PsiElement restoredRelatedElement = relatedElementPointer.getElement();
        if (restoredRelatedElement == null) {
          return;
        }
        final int offset = restoredRelatedElement instanceof PsiFile ? -1 : restoredRelatedElement.getTextOffset();
        final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(restoredRelatedElement);
        if (virtualFile != null && virtualFile.isValid()) {
          PsiNavigationSupport.getInstance()
                              .createNavigatable(restoredRelatedElement.getProject(), virtualFile, offset)
                              .navigate(true);
        }
      }, GutterIconRenderer.Alignment.RIGHT, ()->GotoRelatedItem.createItems(Collections.singletonList(relatedElement)));
  }
private static @NotNull RelatedItemLineMarkerInfo<PsiElement> createLineMarkerInfo(@NotNull PsiElement element,
                                                                                     @NotNull PsiElement relatedElement,
                                                                                     @NotNull String itemTitle)