From e2645deec688ccd2b6f5ca1bdc451615bb72f727 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..808c3595 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_prompf = Pkg.REPLMode.promptf +else # after https://github.com/JuliaLang/Pkg.jl/pull/3777 + const pkg_prompf = 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