show statement name in command line mode
This commit is contained in:
@@ -188,8 +188,14 @@ function PlayableLevel({worldId, levelId}) {
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div className="exercise">
|
<div className="exercise">
|
||||||
{/* <h4>Aufgabe:</h4> */}
|
<Markdown>
|
||||||
<Markdown>{level?.data?.descrText}</Markdown>
|
{(level?.data?.statementName ?
|
||||||
|
`**Theorem** \`${level?.data?.statementName}\`: `
|
||||||
|
:
|
||||||
|
level?.data?.descrText && "**Exercise**: ")
|
||||||
|
+ `${level?.data?.descrText}`
|
||||||
|
}
|
||||||
|
</Markdown>
|
||||||
<div className={`statement ${commandLineMode ? 'hidden' : ''}`}><code>{level?.data?.descrFormat}</code></div>
|
<div className={`statement ${commandLineMode ? 'hidden' : ''}`}><code>{level?.data?.descrFormat}</code></div>
|
||||||
<div ref={codeviewRef} className={`codeview ${commandLineMode ? 'hidden' : ''}`}></div>
|
<div ref={codeviewRef} className={`codeview ${commandLineMode ? 'hidden' : ''}`}></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ export interface LevelInfo {
|
|||||||
descrText: null|string,
|
descrText: null|string,
|
||||||
descrFormat: null|string,
|
descrFormat: null|string,
|
||||||
lemmaTab: null|string,
|
lemmaTab: null|string,
|
||||||
|
statementName: null|string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Doc {
|
interface Doc {
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ elab "Statement" statementName:ident ? descr:str ? sig:declSig val:declVal : com
|
|||||||
| some name => name.getId
|
| some name => name.getId
|
||||||
descrFormat := match statementName with
|
descrFormat := match statementName with
|
||||||
| none => "example " ++ (toString <| reprint sig.raw) ++ " := by"
|
| none => "example " ++ (toString <| reprint sig.raw) ++ " := by"
|
||||||
| some name => (Format.join ["lemma ", reprint name.raw, " ", reprint sig.raw, " := by"]).pretty 10 -- "lemma " ++ (toString <| reprint name.raw) ++ " " ++ (Format.pretty (reprint sig.raw) 40) ++ " := by"
|
| some name => (Format.join ["theorem ", reprint name.raw, " ", reprint sig.raw, " := by"]).pretty 10 -- "lemma " ++ (toString <| reprint name.raw) ++ " " ++ (Format.pretty (reprint sig.raw) 40) ++ " := by"
|
||||||
hints := hints
|
hints := hints
|
||||||
} -- Format.pretty <| format thmStatement.raw }
|
} -- Format.pretty <| format thmStatement.raw }
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ structure LevelInfo where
|
|||||||
descrText : String := ""
|
descrText : String := ""
|
||||||
descrFormat : String := ""
|
descrFormat : String := ""
|
||||||
lemmaTab : Option String
|
lemmaTab : Option String
|
||||||
|
statementName : Option String
|
||||||
deriving ToJson, FromJson
|
deriving ToJson, FromJson
|
||||||
|
|
||||||
structure LoadLevelParams where
|
structure LoadLevelParams where
|
||||||
@@ -117,6 +118,8 @@ partial def handleServerEvent (ev : ServerEvent) : GameServerM Bool := do
|
|||||||
c.hOut.writeLspResponseError ⟨id, .invalidParams, s!"Level not found: world {p.world}, level {p.level}", none⟩
|
c.hOut.writeLspResponseError ⟨id, .invalidParams, s!"Level not found: world {p.world}, level {p.level}", none⟩
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
let env ← getEnv
|
||||||
|
|
||||||
let levelInfo : LevelInfo :=
|
let levelInfo : LevelInfo :=
|
||||||
{ index := lvl.index,
|
{ index := lvl.index,
|
||||||
title := lvl.title,
|
title := lvl.title,
|
||||||
@@ -127,7 +130,16 @@ partial def handleServerEvent (ev : ServerEvent) : GameServerM Bool := do
|
|||||||
descrFormat := lvl.descrFormat --toExpr <| format (lvl.goal.raw) --toString <| Syntax.formatStx (lvl.goal.raw) --Syntax.formatStx (lvl.goal.raw) , -- TODO
|
descrFormat := lvl.descrFormat --toExpr <| format (lvl.goal.raw) --toString <| Syntax.formatStx (lvl.goal.raw) --Syntax.formatStx (lvl.goal.raw) , -- TODO
|
||||||
introduction := lvl.introduction
|
introduction := lvl.introduction
|
||||||
conclusion := lvl.conclusion
|
conclusion := lvl.conclusion
|
||||||
lemmaTab := lvl.lemmaTab }
|
lemmaTab := lvl.lemmaTab
|
||||||
|
statementName := match lvl.statementName with
|
||||||
|
| .anonymous => none
|
||||||
|
| name => match (inventoryDocExt.getState env).find?
|
||||||
|
(fun x => x.name == name && x.type == .Lemma) with
|
||||||
|
| some n => n.displayName
|
||||||
|
| none => name.toString
|
||||||
|
-- Note: we could call `.find!` because we check in `Statement` that the
|
||||||
|
-- lemma doc must exist.
|
||||||
|
}
|
||||||
c.hOut.writeLspResponse ⟨id, ToJson.toJson levelInfo⟩
|
c.hOut.writeLspResponse ⟨id, ToJson.toJson levelInfo⟩
|
||||||
return true
|
return true
|
||||||
| Message.request id "loadDoc" params =>
|
| Message.request id "loadDoc" params =>
|
||||||
|
|||||||
Reference in New Issue
Block a user