add command LemmaTab to specify default tab when loading level
This commit is contained in:
@@ -400,6 +400,12 @@ elab "LemmaDoc" name:ident "as" displayName:str "in" category:str content:str :
|
||||
category := category.getString,
|
||||
content := content.getString })
|
||||
|
||||
/-- Define which tab of Lemmas is opened by default. Usage: `LemmaTab "Nat"`.
|
||||
|
||||
If omitted, the first tab will be open by default. -/
|
||||
elab "LemmaTab" category:str : command =>
|
||||
modifyCurLevel fun level => pure {level with lemmaTab := category.getString}
|
||||
|
||||
/-- Declare lemmas that are introduced by this level. -/
|
||||
elab "NewLemma" args:ident* : command => do
|
||||
let names := args.map (·.getId)
|
||||
|
||||
@@ -157,6 +157,7 @@ structure GameLevel where
|
||||
tactics: InventoryInfo := default
|
||||
definitions: InventoryInfo := default
|
||||
lemmas: InventoryInfo := default
|
||||
lemmaTab: Option String := none
|
||||
hints: Array GoalHintEntry := default
|
||||
/-- The statement in Lean. -/
|
||||
goal : TSyntax `Lean.Parser.Command.declSig := default
|
||||
|
||||
@@ -49,6 +49,7 @@ structure LevelInfo where
|
||||
conclusion : String
|
||||
descrText : String := ""
|
||||
descrFormat : String := ""
|
||||
lemmaTab : Option String
|
||||
deriving ToJson, FromJson
|
||||
|
||||
structure LoadLevelParams where
|
||||
@@ -128,7 +129,8 @@ partial def handleServerEvent (ev : ServerEvent) : GameServerM Bool := do
|
||||
descrText := lvl.descrText,
|
||||
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 }
|
||||
conclusion := lvl.conclusion
|
||||
lemmaTab := lvl.lemmaTab }
|
||||
c.hOut.writeLspResponse ⟨id, ToJson.toJson levelInfo⟩
|
||||
return true
|
||||
| Message.request id "loadDoc" params =>
|
||||
|
||||
Reference in New Issue
Block a user