fix: do not show inferred type on attribute application

This commit is contained in:
Sebastian Ullrich 2022-07-31 11:14:01 +02:00
parent 603b7486e3
commit 759a7d771f
3 changed files with 10 additions and 6 deletions

View file

@ -58,12 +58,9 @@ def elabAttr [Monad m] [MonadEnv m] [MonadResolveName m] [MonadError m] [MonadMa
-- We don't want to create an info tree node from a simple attribute to the generic parser.
let declTarget := if attrSyntaxNodeKind == ``Lean.Parser.Attr.simple then impl.ref else attrSyntaxNodeKind
if (← getEnv).contains declTarget && (← getInfoState).enabled then
pushInfoLeaf <| Info.ofTermInfo {
elaborator := .anonymous
lctx := {}
expr := mkConst declTarget
stx := attrInstance[1][0] -- We want to associate the information to the first atom only
expectedType? := none
pushInfoLeaf <| .ofCommandInfo {
elaborator := declTarget -- not truly an elaborator, but a sensible target for go-to-definition
stx := attrInstance[1][0] -- We want to associate the information to the first atom only
}
/- The `AttrM` does not have sufficient information for expanding macros in `args`.
So, we expand them before here before we invoke the attributer handlers implemented using `AttrM`. -/

View file

@ -160,3 +160,7 @@ def g (n : Nat) : Nat := g 0
termination_by g n => n
decreasing_by have n' := n; admit
--^ textDocument/hover
@[inline]
--^ textDocument/hover
def one := 1

View file

@ -228,3 +228,6 @@ null
{"start": {"line": 160, "character": 25},
"end": {"line": 160, "character": 26}},
"contents": {"value": "```lean\nn : Nat\n```", "kind": "markdown"}}
{"textDocument": {"uri": "file://hover.lean"},
"position": {"line": 163, "character": 2}}
null