fix: swallow exception on hover formatting

This commit is contained in:
Sebastian Ullrich 2021-06-23 23:29:46 +02:00
parent a379d2db5e
commit fc821745ae
3 changed files with 10 additions and 2 deletions

View file

@ -131,8 +131,10 @@ partial def InfoTree.hoverableInfoAt? (t : InfoTree) (hoverPos : String.Pos) : O
def Info.fmtHover? (ci : ContextInfo) (i : Info) : IO (Option Format) := do
ci.runMetaM i.lctx do
let mut fmts := #[]
if let some f ← fmtTerm? then
fmts := fmts.push f
try
if let some f ← fmtTerm? then
fmts := fmts.push f
catch _ => pure ()
if let some f ← fmtDoc? then
fmts := fmts.push f
if fmts.isEmpty then

View file

@ -0,0 +1,3 @@
inductive Foo
| mk : (a b : Bar) → Foo
--^ textDocument/hover

View file

@ -0,0 +1,3 @@
{"textDocument": {"uri": "file://hoverException.lean"},
"position": {"line": 1, "character": 14}}
null