From 38d25b35eba6e2d92a25dd8260ed611629299e0b Mon Sep 17 00:00:00 2001 From: Shuhei Kadowaki Date: Mon, 12 Feb 2024 20:21:45 +0900 Subject: [PATCH] adjustment to JuliaLang/Pkg.jl#3777 --- src/BracketInserter.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/BracketInserter.jl b/src/BracketInserter.jl index 14ad3384..90a98260 100644 --- a/src/BracketInserter.jl +++ b/src/BracketInserter.jl @@ -46,6 +46,11 @@ enable_autocomplete_brackets(v::Bool) = AUTOMATIC_BRACKET_MATCH[] = v const pkgmode = Ref{Any}() import Pkg +@static if isdefined(Pkg.REPLMode, :promptf) + const pkg_promptf = Pkg.REPLMode.promptf +else # after https://github.com/JuliaLang/Pkg.jl/pull/3777 + const pkg_promptf = Base.get_extension(Pkg, :REPLExt).promptf +end function insert_into_keymap!(D::Dict) left_brackets = ['(', '{', '['] right_brackets = [')', '}', ']'] @@ -81,7 +86,7 @@ function insert_into_keymap!(D::Dict) found_pkg = false for mode in Base.active_repl.interface.modes if mode isa LineEdit.Prompt - if mode.prompt == Pkg.REPLMode.promptf + if mode.prompt == pkg_promptf found_pkg = true pkgmode[] = mode end