fix: do not show type of sort in hover

Fixes #896
This commit is contained in:
Sebastian Ullrich 2021-12-19 11:03:15 +01:00
parent f4a73889e7
commit 5f96a9fc4d
3 changed files with 14 additions and 0 deletions

View file

@ -171,6 +171,9 @@ where
fmtTerm? : MetaM (Option Format) := do
match i with
| Info.ofTermInfo ti =>
if ti.expr.isSort then
-- 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
Meta.ppExpr ti.expr

View file

@ -134,3 +134,6 @@ instance : ToString Nat := ⟨toString⟩
--^ textDocument/hover
instance f : ToString Nat := ⟨toString⟩
--^ textDocument/hover
example : Type 0 := Nat
--^ textDocument/hover

View file

@ -159,3 +159,11 @@ null
"end": {"line": 134, "character": 10}},
"contents":
{"value": "```lean\nBar.f : ToString Nat\n```", "kind": "markdown"}}
{"textDocument": {"uri": "file://hover.lean"},
"position": {"line": 137, "character": 10}}
{"range":
{"start": {"line": 137, "character": 10},
"end": {"line": 137, "character": 16}},
"contents":
{"value": "A type universe. `Type ≡ Type 0`, `Type u ≡ Sort (u + 1)`. ",
"kind": "markdown"}}