show statement name in command line mode
This commit is contained in:
@@ -188,8 +188,14 @@ function PlayableLevel({worldId, levelId}) {
|
||||
}
|
||||
</div>
|
||||
<div className="exercise">
|
||||
{/* <h4>Aufgabe:</h4> */}
|
||||
<Markdown>{level?.data?.descrText}</Markdown>
|
||||
<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 ref={codeviewRef} className={`codeview ${commandLineMode ? 'hidden' : ''}`}></div>
|
||||
</div>
|
||||
|
||||
@@ -29,6 +29,7 @@ export interface LevelInfo {
|
||||
descrText: null|string,
|
||||
descrFormat: null|string,
|
||||
lemmaTab: null|string,
|
||||
statementName: null|string
|
||||
}
|
||||
|
||||
interface Doc {
|
||||
|
||||
@@ -306,7 +306,7 @@ elab "Statement" statementName:ident ? descr:str ? sig:declSig val:declVal : com
|
||||
| some name => name.getId
|
||||
descrFormat := match statementName with
|
||||
| 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
|
||||
} -- Format.pretty <| format thmStatement.raw }
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ structure LevelInfo where
|
||||
descrText : String := ""
|
||||
descrFormat : String := ""
|
||||
lemmaTab : Option String
|
||||
statementName : Option String
|
||||
deriving ToJson, FromJson
|
||||
|
||||
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⟩
|
||||
return true
|
||||
|
||||
let env ← getEnv
|
||||
|
||||
let levelInfo : LevelInfo :=
|
||||
{ index := lvl.index,
|
||||
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
|
||||
introduction := lvl.introduction
|
||||
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⟩
|
||||
return true
|
||||
| Message.request id "loadDoc" params =>
|
||||
|
||||
Reference in New Issue
Block a user