feat: do not use pp.inaccessibleNames = true at getInteractiveTermGoal

See discussion at https://github.com/leanprover/vscode-lean4/issues/76

We also use `pp.inaccessibleNames = false` in error messages. In this
setting, an inaccessible name is displayed in the context only if the
target type depends on it.
This commit is contained in:
Leonardo de Moura 2022-06-02 16:22:43 -07:00
parent 878ef3a281
commit 484e510221
3 changed files with 15 additions and 1 deletions

View file

@ -183,7 +183,7 @@ def getInteractiveTermGoal (p : Lsp.PlainTermGoalParams)
-- for binders, hide the last hypothesis (the binder itself)
let lctx' := if ti.isBinder then i.lctx.pop else i.lctx
let goal ← ci.runMetaM lctx' do
Meta.withPPInaccessibleNames <| Widget.goalToInteractive (← Meta.mkFreshExprMVar ty).mvarId!
Widget.goalToInteractive (← Meta.mkFreshExprMVar ty).mvarId!
let range := if let some r := i.range? then r.toLspRange text else ⟨p.position, p.position⟩
return some { goal with range }
else

View file

@ -0,0 +1,9 @@
def big : IO Unit := do
let x := 10
if true then
IO.println s!"a{x}"
--^ $/lean/plainTermGoal
if false then
IO.println "b"
if 1 < 3 then
IO.println "c"

View file

@ -0,0 +1,5 @@
{"textDocument": {"uri": "file://expectedTypeAsGoal.lean"},
"position": {"line": 3, "character": 5}}
{"range":
{"start": {"line": 3, "character": 4}, "end": {"line": 3, "character": 23}},
"goal": "x : Nat := 10\n⊢ IO Unit"}