@@ -453,6 +453,19 @@ function Base.show(io::IO, mime::MIME"text/plain", fp::FilteringProxy)
453453 end
454454 else
455455 printstyled (io, " \n No indices matching filter!" , bold= true )
456+ if ! isnothing (fp. compfilter) || ! isnothing (fp. varfilter)
457+ print (" Filtering for " )
458+ fp. states && printstyled (io, " s " , color= :light_green )
459+ fp. parameters && printstyled (io, " p " , color= :light_yellow )
460+ fp. inputs && printstyled (io, " in " , color= :light_magenta )
461+ fp. outputs && printstyled (io, " out " , color= :light_blue )
462+ fp. observables && printstyled (io, " obs " , color= :light_cyan )
463+ if ! isnothing (fp. varfilter)
464+ print (io, " \n - " , _explain_varfilter (fp. varfilter))
465+ end
466+ printstyled (io, " within" , color= :light_black )
467+ print (io, " \n - " , _explain_compfilter (fp. compfilter))
468+ end
456469 end
457470end
458471_print_pattern_hl (io, s, pattern; kw... ) = false
@@ -525,6 +538,60 @@ function _show_component_filter(io::IO, vs::Union{AbstractVector, Tuple})
525538 end
526539 print (io, post)
527540end
541+ _explain_compfilter (x) = repr (x) # fallback
542+ function _explain_compfilter (cf:: AbstractArray )
543+ join (map (_explain_compfilter, cf), " or " )
544+ end
545+ function _explain_compfilter (cf:: VIndex{<:Symbol} )
546+ " vertices named :$(cf. compidx) "
547+ end
548+ function _explain_compfilter (cf:: EIndex{<:Symbol} )
549+ " edges named :$(cf. compidx) "
550+ end
551+ function _explain_compfilter (cf:: VIndex{<:Integer} )
552+ " vertex #$(cf. compidx) "
553+ end
554+ function _explain_compfilter (cf:: EIndex{<:Integer} )
555+ " edge #$(cf. compidx) "
556+ end
557+ function _explain_compfilter (cf:: EIndex{<:Union{AbstractString,Regex}} )
558+ " edges with name containing $(repr (cf. compidx)) "
559+ end
560+ function _explain_compfilter (cf:: VIndex{<:Union{AbstractString,Regex}} )
561+ " vertices with name containing $(repr (cf. compidx)) "
562+ end
563+ function _explain_compfilter (cf:: VIndex{<:UnitRange} )
564+ " vertices $(first (cf. compidx)) -$(last (cf. compidx)) "
565+ end
566+ function _explain_compfilter (cf:: EIndex{<:UnitRange} )
567+ " edges $(first (cf. compidx)) -$(last (cf. compidx)) "
568+ end
569+ function _explain_compfilter (cf:: EIndex{<:Pair} )
570+ " edge $(cf. compidx. first) => $(cf. compidx. second) "
571+ end
572+ _explain_compfilter (cf:: EIndex{Colon} ) = " any edge"
573+ _explain_compfilter (cf:: VIndex{Colon} ) = " any vertex"
574+ function _explain_compfilter (cf:: SymbolicIndex{<:Union{AbstractVector, Tuple}} )
575+ if length (cf. compidx) > 3
576+ repr (cf)
577+ else
578+ join (map (x-> _explain_compfilter (idxtype (cf)(x)), cf. compidx), " or " )
579+ end
580+ end
581+ _explain_compfilter (cf:: AllVertices ) = " any vertex"
582+ _explain_compfilter (cf:: AllEdges ) = " any edge"
583+ _explain_compfilter (:: Nothing ) = " any components"
584+
585+ _explain_varfilter (x) = repr (x) # fallback
586+ _explain_varfilter (:: Nothing ) = " any symbol" # fallback
587+ _explain_varfilter (x:: AbstractArray ) = join (map (_explain_varfilter, x), " or " )
588+ function _explain_varfilter (x:: Symbol )
589+ " symbols named :$x "
590+ end
591+ function _explain_varfilter (x:: Union{Regex, AbstractString} )
592+ " symbols containing $(repr (x)) "
593+ end
594+
528595
529596
530597function print_treelike (io, vec; prefix= " " , infix= " " , rowmax= typemax (Int))
0 commit comments