fix: improve Name.isMetaprogramming (#12767)

This PR makes sure that identifiers with `Meta` or `Simproc` in their
name do not show up in library search results.

For example, `Nat.Simproc.eq_add_gt` can currently be suggested by
library search, even though it is an implementation detail.
Additionally, there are various declarations in mathlib in the
`Mathlib.Meta` namespace that we do not want to suggest.
This commit is contained in:
Jovan Gerbscheid
2026-03-10 21:35:47 +00:00
committed by GitHub
parent 2ea4d016c4
commit bb047b8725

View File

@@ -205,7 +205,7 @@ def anyS (n : Name) (f : String → Bool) : Bool :=
/-- Return true if the name is in a namespace associated to metaprogramming. -/
def isMetaprogramming (n : Name) : Bool :=
let components := n.components
components.head? == some `Lean || (components.any fun n => n == `Tactic || n == `Linter)
components.head?.any (· == `Lean) || (components.any (· matches `Tactic | `Linter | `Simproc | `Meta))
end Name
end Lean