Skip to content

Commit 23774e4

Browse files
committed
Fix latex symbol completion
Broken by JuliaLang/julia#54800
1 parent 4390ef4 commit 23774e4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/handlers.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ ind2chr(m::Msg, str::String, i::Integer) = i == 0 ? 0 :
5151
import REPL: REPLCompletions
5252
import REPL.REPLCompletions: sorted_keywords, emoji_symbols, latex_symbols
5353

54+
if isdefined(REPLCompletions, :named_completion)
55+
# julia#54800 (julia 1.12)
56+
repl_completion_text(c) = REPLCompletions.named_completion(c).completion::String
57+
else
58+
# julia#26930
59+
repl_completion_text(c) = REPLCompletions.completion_text(c)
60+
end
61+
5462
complete_type(::Type{<:Function}) = "function"
5563
complete_type(::Type{<:Type}) = "type"
5664
complete_type(::Type{<:Tuple}) = "tuple"
@@ -130,7 +138,7 @@ function complete_request(socket, msg)
130138

131139
codestart = find_parsestart(code, cursorpos)
132140
comps_, positions, should_complete = REPLCompletions.completions(code[codestart:end], cursorpos-codestart+1, current_module[])
133-
comps = unique!(REPLCompletions.completion_text.(comps_)) # julia#26930
141+
comps = unique!(repl_completion_text.(comps_))
134142
# positions = positions .+ (codestart - 1) on Julia 0.7
135143
positions = (first(positions) + codestart - 1):(last(positions) + codestart - 1)
136144
metadata = Dict()

0 commit comments

Comments
 (0)