lean4-htt/tests/lean/run/library_suggestions_persistent_module.lean
Kim Morrison e8d35a1d77
fix: make library suggestions available in module files (#11373)
This PR makes the library suggestions extension state available when
importing from `module` files.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-26 05:39:27 +00:00

36 lines
1.3 KiB
Text

module
import Lean
/-!
# Test that library suggestions persist across file boundaries
This test verifies that the default library suggestion engine set in
`Lean.LibrarySuggestions.Default` is correctly persisted when imported via `Lean.LibrarySuggestions`.
We do NOT call `set_library_suggestions` in this file - the selector should
already be set from importing Lean.LibrarySuggestions (which imports Default).
-/
/--
info: ✓ Selector found in imported state: (Term.open
"open"
(Command.openSimple [`Lean.LibrarySuggestions])
"in"
(Term.app `sineQuaNonSelector.filterGrindAnnotated.intersperse [`currentFile]))
---
info: ✓ Successfully retrieved selector using getSelector!
-/
#guard_msgs in
open Lean Lean.LibrarySuggestions in
run_cmd do
let stx? := librarySuggestionsExt.getState (← getEnv)
match stx? with
| none => Lean.logInfo "❌ No selector found in imported state!"
| some stx =>
Lean.logInfo s!"✓ Selector found in imported state: {stx}"
-- Try to retrieve the selector using getSelector
Elab.Command.liftTermElabM do
let selector? ← getSelector
match selector? with
| none => Lean.logInfo " ❌ getSelector returned none"
| some _ => Lean.logInfo " ✓ Successfully retrieved selector using getSelector!"