From 8d848dde201fc659f2932fbc068ec1310e2eb538 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 3e973e043f60a..f3e4b08306bd2 100644 --- a/doc/Manifest.toml +++ b/doc/Manifest.toml @@ -205,7 +205,7 @@ uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" version = "1.11.0" [[deps.REPL]] -deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] +deps = ["InteractiveUtils", "Markdown", "Sockets", "StyledStrings", "Unicode"] uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" version = "1.11.0" @@ -242,6 +242,9 @@ deps = ["ArgTools", "SHA"] uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" version = "1.10.0" +[[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 83c66bd94c702..e5ad59ac3bb32 100644 --- a/pkgimage.mk +++ b/pkgimage.mk @@ -109,7 +109,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 8c55883a04fb9..30b500bf327c1 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 97c494cb331d3..c529cdde7cb3b 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`