Add module name for symbol
This commit is contained in:
parent
22202af24e
commit
56b967ee7a
10
Main.lean
10
Main.lean
|
@ -125,7 +125,8 @@ unsafe def execute (command: Command): Subroutine Lean.Json := do
|
||||||
match state.getEnv args.id with
|
match state.getEnv args.id with
|
||||||
| .error error => return Lean.toJson <| errorIndex error
|
| .error error => return Lean.toJson <| errorIndex error
|
||||||
| .ok env =>
|
| .ok env =>
|
||||||
let info? := env.find? <| str_to_name args.symbol
|
let name := str_to_name args.symbol
|
||||||
|
let info? := env.find? name
|
||||||
match info? with
|
match info? with
|
||||||
| none => return Lean.toJson <| errorIndex s!"Symbol not found {args.symbol}"
|
| none => return Lean.toJson <| errorIndex s!"Symbol not found {args.symbol}"
|
||||||
| some info =>
|
| some info =>
|
||||||
|
@ -133,7 +134,12 @@ unsafe def execute (command: Command): Subroutine Lean.Json := do
|
||||||
(env := env)
|
(env := env)
|
||||||
(coreContext := context.coreContext)
|
(coreContext := context.coreContext)
|
||||||
(expr := info.toConstantVal.type)
|
(expr := info.toConstantVal.type)
|
||||||
return Lean.toJson ({ type := format }: InspectResult)
|
let module? := env.getModuleIdxFor? name >>=
|
||||||
|
(λ idx => env.allImportedModuleNames.get? idx.toNat) |>.map toString
|
||||||
|
return Lean.toJson ({
|
||||||
|
type := format,
|
||||||
|
module? := module?
|
||||||
|
}: InspectResult)
|
||||||
proof_start (args: ProofStart): Subroutine Lean.Json := do
|
proof_start (args: ProofStart): Subroutine Lean.Json := do
|
||||||
let context ← read
|
let context ← read
|
||||||
let state ← get
|
let state ← get
|
||||||
|
|
|
@ -45,7 +45,8 @@ structure Inspect where
|
||||||
symbol: String
|
symbol: String
|
||||||
deriving Lean.FromJson
|
deriving Lean.FromJson
|
||||||
structure InspectResult where
|
structure InspectResult where
|
||||||
type: String := ""
|
type: String
|
||||||
|
module?: Option String
|
||||||
deriving Lean.ToJson
|
deriving Lean.ToJson
|
||||||
|
|
||||||
structure ProofStart where
|
structure ProofStart where
|
||||||
|
|
Loading…
Reference in New Issue