Skip to content

Commit 0336f67

Browse files
Add missing tab-completion help for emoji (#34034)
* Add missing tab-completion help for emoji Closes: #34006 * Add tests for tab-completion on emoji * Drop Base.REPL_MODULE_REF[] as it is a part of REPL * Use colons Signed-off-by: Utkarsh Gupta <[email protected]> * Update docview.jl * fix test Co-authored-by: Steven G. Johnson <[email protected]> Co-authored-by: Steven G. Johnson <[email protected]>
1 parent 2fc3dcd commit 0336f67

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

stdlib/REPL/src/docview.jl

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import Base.Docs: doc, formatdoc, parsedoc, apropos
1111

1212
using Base: with_output_color
1313

14+
import REPL
15+
1416
using InteractiveUtils: subtypes
1517

1618
using Unicode: normalize
@@ -323,7 +325,8 @@ repl_corrections(s) = repl_corrections(stdout, s)
323325
const symbols_latex = Dict{String,String}()
324326
function symbol_latex(s::String)
325327
if isempty(symbols_latex) && isassigned(Base.REPL_MODULE_REF)
326-
for (k,v) in Base.REPL_MODULE_REF[].REPLCompletions.latex_symbols
328+
for (k,v) in Iterators.flatten((REPLCompletions.latex_symbols,
329+
REPLCompletions.emoji_symbols))
327330
symbols_latex[v] = k
328331
end
329332
end

stdlib/REPL/test/docview.jl

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This file is a part of Julia. License is MIT: https://julialang.org/license
2+
3+
using Test
4+
import REPL
5+
6+
@testset "symbol completion" begin
7+
@test startswith(let buf = IOBuffer()
8+
Core.eval(Main, REPL.helpmode(buf, "α"))
9+
String(take!(buf))
10+
end, "\"α\" can be typed by \\alpha<tab>\n")
11+
12+
@test startswith(let buf = IOBuffer()
13+
Core.eval(Main, REPL.helpmode(buf, "🐨"))
14+
String(take!(buf))
15+
end, "\"🐨\" can be typed by \\:koala:<tab>\n")
16+
end

stdlib/REPL/test/runtests.jl

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ end
99
module LineEditTest
1010
include("lineedit.jl")
1111
end
12+
module DocviewTest
13+
include("docview.jl")
14+
end
1215
module TerminalMenusTest
1316
include("TerminalMenus/runtests.jl")
1417
end

0 commit comments

Comments
 (0)