From 8f7b078d77107c29eac327fa8787c5ff9a621180 Mon Sep 17 00:00:00 2001 From: TEC Date: Wed, 25 Oct 2023 23:51:33 +0800 Subject: [PATCH] Load StyledStrings in REPL By loading the StyledStrings stdlib in REPL, we load the privateered print/show methods for the Annotated{String,Char} types defined there. This is nice to have, because it means that styled annotated strings can be constructed in Base and elsewhere without loading the StyledStrings stdlib, but they will be displayed as intended in the REPL. --- doc/Manifest.toml | 5 ++++- pkgimage.mk | 2 +- stdlib/REPL/Project.toml | 1 + stdlib/REPL/src/REPL.jl | 2 +- stdlib/REPL/src/precompile.jl | 1 + 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/Manifest.toml b/doc/Manifest.toml index 31eb3634fa709..a2d330413eef3 100644 --- a/doc/Manifest.toml +++ b/doc/Manifest.toml @@ -94,7 +94,7 @@ deps = ["Unicode"] uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" [[deps.REPL]] -deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] +deps = ["InteractiveUtils", "Markdown", "Sockets", "StyledStrings", "Unicode"] uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" [[deps.Random]] @@ -111,6 +111,9 @@ uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" [[deps.Sockets]] uuid = "6462fe0b-24de-5631-8697-dd941f90decc" +[[deps.StyledStrings]] +uuid = "f489334b-da3d-4c2e-b8f0-e476e12c162b" + [[deps.Test]] deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/pkgimage.mk b/pkgimage.mk index 0b46531cfa137..d77962bfe45a1 100644 --- a/pkgimage.mk +++ b/pkgimage.mk @@ -107,7 +107,7 @@ $(eval $(call stdlib_builder,InteractiveUtils,Markdown)) # 3-depth packages $(eval $(call stdlib_builder,LibGit2_jll,MbedTLS_jll LibSSH2_jll Artifacts Libdl)) $(eval $(call stdlib_builder,LibCURL_jll,LibSSH2_jll nghttp2_jll MbedTLS_jll Zlib_jll Artifacts Libdl)) -$(eval $(call stdlib_builder,REPL,InteractiveUtils Markdown Sockets Unicode)) +$(eval $(call stdlib_builder,REPL,InteractiveUtils Markdown Sockets StyledStrings Unicode)) $(eval $(call stdlib_builder,SharedArrays,Distributed Mmap Random Serialization)) $(eval $(call stdlib_builder,TOML,Dates)) $(eval $(call stdlib_builder,Test,Logging Random Serialization InteractiveUtils)) diff --git a/stdlib/REPL/Project.toml b/stdlib/REPL/Project.toml index 77eca2bfe4240..6318bd0258ab3 100644 --- a/stdlib/REPL/Project.toml +++ b/stdlib/REPL/Project.toml @@ -6,6 +6,7 @@ version = "1.11.0" InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240" Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" Sockets = "6462fe0b-24de-5631-8697-dd941f90decc" +StyledStrings = "f489334b-da3d-4c2e-b8f0-e476e12c162b" Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" [extras] diff --git a/stdlib/REPL/src/REPL.jl b/stdlib/REPL/src/REPL.jl index 25b2ff00602d6..33b812cd4ee1e 100644 --- a/stdlib/REPL/src/REPL.jl +++ b/stdlib/REPL/src/REPL.jl @@ -34,7 +34,7 @@ end Base.Experimental.@optlevel 1 Base.Experimental.@max_methods 1 -using Base.Meta, Sockets +using Base.Meta, Sockets, StyledStrings import InteractiveUtils export diff --git a/stdlib/REPL/src/precompile.jl b/stdlib/REPL/src/precompile.jl index 1b22eb77953a3..7b4a1c4710292 100644 --- a/stdlib/REPL/src/precompile.jl +++ b/stdlib/REPL/src/precompile.jl @@ -16,6 +16,7 @@ end using Base.Meta import Markdown +import StyledStrings ## Debugging options # Disable parallel precompiles generation by setting `false`