chore: idbg refinements (#12691)

This commit is contained in:
Sebastian Ullrich 2026-02-26 08:49:47 +01:00 committed by GitHub
parent d4b560ec4a
commit 65a0c61806
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 2 deletions

View file

@ -235,7 +235,7 @@ def idbgCompileAndEval (α : Type) [Nonempty α]
| .error msg => throw (.userError s!"idbg evalConst failed: {msg}")
/-- Connect to the debug server, receive expressions, evaluate, send results. Loops forever. -/
@[nospecialize] public def idbgClientLoop {α : Type} [Nonempty α]
@[nospecialize, export lean_idbg_client_loop] def idbgClientLoopImpl {α : Type} [Nonempty α]
(siteId : String) (imports : Array Import) (apply : α → String) : IO Unit := do
let baseEnv ← idbgLoadEnv imports
let port := idbgPort siteId

View file

@ -63,7 +63,7 @@ def notFollowedByRedefinedTermToken :=
-- an "open" command follows the `do`-block.
-- If we don't add `do`, then users would have to indent `do` blocks or use `{ ... }`.
notFollowedBy ("set_option" <|> "open" <|> "if" <|> "match" <|> "match_expr" <|> "let" <|> "let_expr" <|> "have" <|>
"do" <|> "dbg_trace" <|> "assert!" <|> "debug_assert!" <|> "for" <|> "unless" <|> "return" <|> symbol "try")
"do" <|> "dbg_trace" <|> "idbg" <|> "assert!" <|> "debug_assert!" <|> "for" <|> "unless" <|> "return" <|> symbol "try")
"token at 'do' element"
@[builtin_doElem_parser] def doLet := leading_parser

View file

@ -33,6 +33,11 @@ structure Import where
deriving Repr, Inhabited, ToJson, FromJson,
BEq, Hashable -- needed by Lake (in `Lake.Load.Elab.Lean`)
-- TODO: move further up into `Init` by using simpler representation for `imports`
@[extern "lean_idbg_client_loop"]
public opaque Idbg.idbgClientLoop {α : Type} [Nonempty α]
(siteId : String) (imports : Array Import) (apply : α → String) : IO Unit
instance : Coe Name Import := ⟨({module := ·})⟩
instance : ToString Import := ⟨fun imp =>