private static boolean refMatch(@NotNull Document document, VirtualFile file, @NotNull DocumentReference ref) {
    return file != null && file.equals(ref.getFile()) || ref.getDocument() == document;
  }
private static boolean refMatch(@NotNull Document document, VirtualFile file, @NotNull DocumentReference ref)