lean4-htt/tests/lean/interactive/ppShowLetValues.lean
Kyle Miller 921ce7682e
feat: use omission dots for hidden let values in Infoview (#8041)
This PR changes the behavior of `pp.showLetValues` to use a hoverable
`⋯` to hide let values. This is now false by default, and there is a new
option `pp.showLetValues.threshold` for allowing small expressions to be
shown anyway. For tactic metavariables, there is an additional option
`pp.showLetValues.tactic.threshold`, which by default is set to the
maximal value, since in tactic states local values are usually
significant.
2025-05-27 23:09:11 +00:00

81 lines
1.6 KiB
Text

/-!
# Tests of `pp.showLetValues`
-/
-- Ensure default values
set_option pp.showLetValues false
set_option pp.showLetValues.threshold 0
set_option pp.showLetValues.tactic.threshold 255
/-!
Non-tactic context. No let value (see ⋯)
-/
example (x : Nat) : Nat :=
let y := x + x
y
--^ $/lean/plainTermGoal
/-!
Non-tactic context. Enable showing values (see x + x)
-/
set_option pp.showLetValues true in
example (x : Nat) : Nat :=
let y := x + x
y
--^ $/lean/plainTermGoal
/-!
Non-tactic context. Turn up threshold (see x + x)
-/
set_option pp.showLetValues.threshold 10 in
example (x : Nat) : Nat :=
let y := x + x
y
--^ $/lean/plainTermGoal
/-!
Tactic context. See x + x
-/
example (x : Nat) : Nat := by
let y := x + x
exact y
--^ $/lean/plainGoal
/-!
Tactic context. Turn down threshold (see ⋯)
-/
set_option pp.showLetValues.tactic.threshold 0 in
example (x : Nat) : Nat := by
let y := x + x
exact y
--^ $/lean/plainGoal
/-!
Tactic context. Uses max of both thresholds (see x + x)
-/
set_option pp.showLetValues.threshold 10 in
set_option pp.showLetValues.tactic.threshold 0 in
example (x : Nat) : Nat := by
let y := x + x
exact y
--^ $/lean/plainGoal
/-!
Non-tactic context. Atomic always shown (see x)
-/
set_option pp.showLetValues.threshold 0 in
set_option pp.showLetValues.tactic.threshold 0 in
example (x : Nat) : Nat :=
let y := x
y
--^ $/lean/plainTermGoal
/-!
Tactic context. Atomic always shown (see x)
-/
set_option pp.showLetValues.threshold 0 in
set_option pp.showLetValues.tactic.threshold 0 in
example (x : Nat) : Nat := by
let y := x
exact y
--^ $/lean/plainGoal