julia
feca5b8b - Add new public functions `raw_substring` and `unannotate` (#59663)

Commit
43 days ago
Add new public functions `raw_substring` and `unannotate` (#59663) This commit includes several, interlocked changes: 1. It removes an undocumented SubString constructor which triage has agreed can be considered internal and should be removed * EDIT: After triage comments, the method is now deprecated, but not removed. 2. It adds a new public, but unexported function `raw_substring`, which creates a substring without checking for valid string indices. This new function is used in place of the old removed method, internally in Julia. * EDIT: After triage comments, this was renamed from `unsafe_substring` to `raw_substring` 3. It adds a new public, but unexported function `unannotate`, which gives the underlying non-annotated string of an `AnnotatedString` or `SubString{AnnotatedString}`. The reason for this change is that currently, code outside Base (namely, in StyledStrings and JuliaSyntaxHighlighting) relies on this operation. Its current implementation reaches into both `AnnotatedString` and `SubString` internals. Instead, I provide the function here in Base, and let the two stdlibs use it. Also in general, I think it's a completely reasonable basic function to have for annotated strings. For reviewers: We can make these functions exported (I don't have a strong opinion on that). For this PR to land, it also requires compatible PRs in StyledStrings.jl and JuliaSyntaxHighlighting.jl, which uses the removed constructor. This depends on two PRs to be merged first: 1. https://github.com/JuliaLang/JuliaSyntaxHighlighting.jl/pull/13 2. https://github.com/JuliaLang/StyledStrings.jl/pull/125 Supersedes https://github.com/JuliaLang/julia/pull/59606 Supersedes https://github.com/JuliaLang/julia/pull/55458 Closes https://github.com/JuliaLang/julia/issues/59610 Closes https://github.com/JuliaLang/julia/issues/55247
Author
Parents
Loading