Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lake-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
"type": "git",
"subDir": null,
"scope": "",
"rev": "847084e80500726e4331dded5f17007ddaf89c31",
"rev": "10caddf4d067ad0f916cbf231f2870a08977124e",
"name": "subverso",
"manifestFile": "lake-manifest.json",
"inputRev": "main",
"inputRev": "sfl-local",
"inherited": false,
"configFile": "lakefile.lean"}],
"name": "verso",
Expand Down
2 changes: 1 addition & 1 deletion lakefile.lean
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Lake
open Lake DSL

require subverso from git "https://github.com/leanprover/subverso"@"main"
require subverso from git "https://github.com/leanprover/subverso"@"sfl-local"
require MD4Lean from git "https://github.com/acmepjz/md4lean"@"main"
require plausible from git "https://github.com/leanprover-community/plausible"@"main"
require illuminate from git "https://github.com/leanprover/illuminate"@"main"
Expand Down
3 changes: 1 addition & 2 deletions src/multi-verso/MultiVerso/NameMap.lean
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,7 @@ public instance : GetElem? (NameMap α) Name α fun xs n => n ∈ xs where
getElem xs x ok :=
if h : isPublic x then
show α from GetElem.getElem (coll := TreeMap PublicName α PublicName.quickCmp) (idx := PublicName) (elem := α) (valid := fun xs x => x ∈ xs) xs ⟨x, h⟩ <| by
simp only [Membership.mem, h, dite_eq_left_of_eq_true] at ok
exact ok
simpa [Membership.mem, h] using ok
else
False.elim <| by
simp only [Membership.mem, h] at ok
Expand Down
17 changes: 12 additions & 5 deletions src/verso-manual/VersoManual/InlineLean.lean
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ meta def elabCommands (config : LeanBlockConfig) (str : StrLit)
let mut cmdState : Command.State := { env := ← getEnv, maxRecDepth := ← MonadRecDepth.getMaxRecDepth, scopes := origScopes }
let mut pstate := { pos := startPos, recovering := false, hasLeading := false }
let mut cmds := #[]
let mut cmdTrees : Array (Option Lean.Elab.InfoTree) := #[]

repeat
let scope := cmdState.scopes.head!
Expand All @@ -291,6 +292,13 @@ meta def elabCommands (config : LeanBlockConfig) (str : StrLit)
let savedTrees := cmdState.infoState.trees
cmdState ← withInfoTreeContext (mkInfoTree := pure ∘ InfoTree.node (.ofCommandInfo {elaborator := `Manual.Meta.lean, stx := cmd})) <|
runCommand (Command.elabCommandTopLevel cmd) cmd cctx cmdState
-- `elabCommandTopLevel` reset the info state, so the trees present now are exactly this
-- command's; record them for the batched highlighting pass below.
cmdTrees := cmdTrees.push <|
match cmdState.infoState.trees.toArray with
| #[t] => some t
| #[] => none
| ts => some (.node (.ofCommandInfo {elaborator := `Manual.Meta.lean, stx := cmd}) ts.toPArray')
cmdState := { cmdState with
messages := savedMsgs ++ cmdState.messages,
infoState := { cmdState.infoState with trees := savedTrees ++ cmdState.infoState.trees }
Expand Down Expand Up @@ -319,12 +327,11 @@ meta def elabCommands (config : LeanBlockConfig) (str : StrLit)
pushInfoTree (disableUnusedVarLinterInInfoTree t)


let mut hls := Highlighted.empty
let nonSilentMsgs := cmdState.messages.toArray.filter (!·.isSilent)
let mut lastPos : String.Pos.Raw := startPos
for cmd in cmds do
hls := hls ++ (← highlightIncludingUnparsed cmd nonSilentMsgs cmdState.infoState.trees (startPos? := lastPos))
lastPos := (cmd.getTrailingTailPos?).getD lastPos
-- One batched highlighting pass shares caches between the whole block's commands.
let hlArr ← highlightMany cmds nonSilentMsgs cmdTrees
(includeUnparsed := true) (startPos? := some startPos)
let hls := hlArr.foldl (· ++ ·) Highlighted.empty

toHighlightedLeanContent config.show hls str
finally
Expand Down
Loading