Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuring can_fancyprint(io::IO) using IOContext #4042

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fonsp
Copy link
Member

@fonsp fonsp commented Oct 11, 2024

Hi!

This PR adds the ability to override can_fancyprint(io::IO) for a self-provided IO by setting an IOContext flag: :Pkg_force_fancyprint can be set to true or false.

Why

My use case is Pluto, where we call Pkg functions like Pkg.precompile() with a buffer as io. Our display (in the browser) supports fancy-printing, but because the buffer is not a <: Base.TTY, Pkg will not fancy-print.

The current workaround in Pluto is to add type piracy to the Pkg.can_fancyprint function, defining a new, more specific method for can_fancyprint(io::IOContext{BufferStream}) where we set it to true, but I want to avoid this solution.

What do you think?

@fonsp
Copy link
Member Author

fonsp commented Oct 11, 2024

Hmm I see that this function was moved/copied to Base in JuliaLang/julia#53403, so I would make a matching PR there. But I'll wait for feedback here before I continue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant