File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -82,9 +82,19 @@ function try_autoinstall(expr::Expr)
8282end
8383
8484is_repl_ready () = isdefined (Base, :active_repl_backend ) && isdefined (Base. active_repl_backend, :ast_transforms )
85+ function _register_ast_transform_now (ast_transform)
86+ pushfirst! (Base. active_repl_backend. ast_transforms, ast_transform)
87+ # Hack the autolaods into autocompletion by hijacking REPL's list of keywords.
88+ # Workaround for https://github.com/JuliaLang/julia/issues/56101
89+ keywords = typeof (Base. active_repl_backend). name. module. REPLCompletions. sorted_keywords
90+ for trigger in keys (ast_transform. dict)
91+ str = string (trigger)
92+ insert! (keywords, searchsortedfirst (keywords, str), str)
93+ end
94+ end
8595function _register_ast_transform (ast_transform)
8696 if is_repl_ready ()
87- pushfirst! (Base . active_repl_backend . ast_transforms, ast_transform)
97+ _register_ast_transform_now ( ast_transform)
8898 else
8999 t = Task (_WaitRegisterASTTransform (ast_transform))
90100 schedule (t)
@@ -102,7 +112,7 @@ function (wrat::_WaitRegisterASTTransform)()
102112 sleep (.02 * iter)
103113 end
104114 if is_repl_ready ()
105- pushfirst! (Base . active_repl_backend . ast_transforms, wrat. ast_transform)
115+ _register_ast_transform_now ( wrat. ast_transform)
106116 else
107117 @warn " Timed out waiting for `Base.active_repl_backend.ast_transforms` to become available. Autoloads will not work."
108118 @info " If you have a slow startup file, consider moving `register_autoloads` to the end of it."
You can’t perform that action at this time.
0 commit comments