Skip to content

Commit 3a9cbb7

Browse files
nsicchaclaude
andcommitted
Fix autoprint losing types in multiline output
indent() for non-StanIO was creating a StanIO, causing StanExpr show to omit types. Use IOContext instead to preserve the original IO type while tracking indent level. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fcfcde5 commit 3a9cbb7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/slic_stan/slic.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,10 +732,10 @@ struct StanIO{P} <: WrappedIO
732732
StanIO(parent; kwargs...) = new{typeof(parent)}(parent, kwargs)
733733
end
734734
remake(io::StanIO, p=parent(io); kwargs...) = StanIO(p; io.info..., kwargs...)
735-
current_indent(io) = ""
735+
current_indent(io) = repeat(" ", get(io, :_autoprint_indent, 0))
736736
current_indent(io::StanIO) = repeat(" ", current_indent_level(io))
737737
current_indent_level(io::StanIO) = get(io.info, :current_indent_level, 0)
738-
indent(io) = StanIO(io; current_indent_level=1)
738+
indent(io) = IOContext(io, :_autoprint_indent => 1 + get(io, :_autoprint_indent, 0))
739739
indent(io::StanIO) = remake(io; current_indent_level=1+current_indent_level(io))
740740
maybe_indent(io, x::StanBlock) = indent(io)
741741
maybe_indent(io, x::FunctionsBlock) = io

0 commit comments

Comments
 (0)