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

Loading external StyledString package removes markdown highlighting #91

Open
KristofferC opened this issue Sep 19, 2024 · 3 comments
Open

Comments

@KristofferC
Copy link
Sponsor Member

image

This is when having this package as the active project and loading it.

@topolarity
Copy link
Member

Do we have a root cause for this yet?

@tecosaur
Copy link
Collaborator

I don't, but I have noticed that with StyledStrings as the active project you can see this in a Julia REPL session:

help?> thing
# Observe working syntax highlighting

julia> using StyledStrings

help?> thing
# Syntax highlighting breaks

julia> using Markdown

help?> thing
# Syntax highlighting works again

Checking Base.loaded_modules_order it seems like two versions of StyledStrings, JuliaSyntaxHighlighting, and Markdown are loaded by doing this:

julia> Base.loaded_modules_order
22-element Vector{Module}:
 Core
 Base
 Main
 FileWatching
 Libdl
 Artifacts
 SHA
 Sockets
 LinearAlgebra
 OpenBLAS_jll
 libblastrampoline_jll
 Random
 Base64
 StyledStrings
 JuliaSyntaxHighlighting
 Markdown
 InteractiveUtils
 Unicode
 REPL
 StyledStrings
 JuliaSyntaxHighlighting
 Markdown
 
julia> length(unique(Base.loaded_modules_order))
22

@topolarity
Copy link
Member

topolarity commented Sep 27, 2024

If I had to guess, StyledStrings has some code that is embedding Face types:

face = Expr(:call, Face, kwargs...)

but then getface here is effectively doing a isa Face check:

face = getface(styles)

which runs into an issue almost exactly like the one I accidentally created with TOML recently (JuliaLang/Pkg.jl#4017 (comment))

Basically require_stdlib means that multiple StyledStrings can exist, which means that the _ansi_writer code has to support the Face type for all of the loaded StyledStrings.

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

No branches or pull requests

3 participants