Skip to content

Commit

Permalink
feat: show universe args on hover
Browse files Browse the repository at this point in the history
We might also want to replace them with fresh vars to make the hover
completely independent of the context, but this change at least avoids
any hidden information.
  • Loading branch information
Kha committed Dec 20, 2021
1 parent 068ea1b commit 51dc329
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Lean/Server/InfoUtils.lean
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ where
-- types of sorts are funny to look at in widgets, but ultimately not very helpful
return none
let tp ← Meta.inferType ti.expr
let eFmt ← Lean.withOptions (Lean.pp.fullNames.set . true) do
let eFmt ← Lean.withOptions (Lean.pp.fullNames.set · true |> (Lean.pp.universes.set · true)) do
Meta.ppExpr ti.expr
let tpFmt ← Meta.ppExpr tp
-- try not to show too scary internals
let fmt := if isAtomicFormat eFmt then f!"{eFmt} : {tpFmt}" else f!"{tpFmt}"
let fmt := if ti.expr.isConst || isAtomicFormat eFmt then f!"{eFmt} : {tpFmt}" else f!"{tpFmt}"
return some f!"```lean
{fmt}
```"
Expand Down
2 changes: 1 addition & 1 deletion tests/lean/interactive/hover.lean.expected.out
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ null
{"range":
{"start": {"line": 93, "character": 8}, "end": {"line": 93, "character": 10}},
"contents":
{"value": "```lean\nid : ∀ {α : Prop}, α → α\n```", "kind": "markdown"}}
{"value": "```lean\nid.{0} : ∀ {α : Prop}, α → α\n```", "kind": "markdown"}}
{"textDocument": {"uri": "file://hover.lean"},
"position": {"line": 93, "character": 10}}
{"range":
Expand Down

0 comments on commit 51dc329

Please sign in to comment.