feat(library/init/lean/elaborator/command): display position information at #resolve_name
This commit is contained in:
parent
4fe9c30d6f
commit
cea1fa3036
2 changed files with 7 additions and 1 deletions
|
|
@ -214,6 +214,11 @@ mkElabAttribute `commandTerm "command" builtinCommandElabTable
|
|||
@[init mkCommandElabAttribute]
|
||||
constant commandElabAttribute : CommandElabAttribute := default _
|
||||
|
||||
def getPosition (pos : Option String.Pos := none) : Elab Position :=
|
||||
do ctx ← read;
|
||||
s ← get;
|
||||
pure $ ctx.fileMap.toPosition (pos.getOrElse s.cmdPos)
|
||||
|
||||
def mkMessage (msg : String) (pos : Option String.Pos := none) : Elab Message :=
|
||||
do ctx ← read;
|
||||
s ← get;
|
||||
|
|
|
|||
|
|
@ -191,7 +191,8 @@ fun _ => do
|
|||
fun n => do
|
||||
let id := n.getIdAt 1;
|
||||
resolvedIds ← resolveName id;
|
||||
runIO (IO.println resolvedIds);
|
||||
pos ← getPosition;
|
||||
runIO (IO.println (toString pos ++ " " ++ toString resolvedIds));
|
||||
pure ()
|
||||
|
||||
/- We just ignore Lean3 notation declaration commands. -/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue