So I can provide some clarification and a workaround
Clarification
First off, this only triggers on the EndPackage
:
For example, this still allows ggg
to autocomplete:
BeginPackage["foo`a`"];
ggg::usage = "asdasd";
EndPackage[];
(*Break this into different cells or the FE acts like EndPackage was called!*)
Abort[]
BeginPackage["foo`", {"foo`a`"}];
But the moment you call EndPackage[]
ggg
stops autocompleting.
Further investigation shows that even simply messing with the $ContextPath
is enough to do it.
BeginPackage["foo`a`"];
ggg::usage = "asdasd";
EndPackage[];
(* again, split these into two cells *)
PrependTo[$ContextPath, "foo`"];
Next, this does not seem to have to do with the standard way the FE handles autocompletions (as I know it at least).
I say this because the following doesn't prevent it from auto-completing (working from a Quit
kernel):
BeginPackage["foo`a`"];
ggg::usage = "asdasd";
EndPackage[];
FrontEndExecute@
FrontEnd`UpdateKernelSymbolContexts[
"foo`",
Join[
{"foo`", "foo`a`"},
$ContextPath
],
{{"foo`", {"aaa"}, {}, {"aaa"}, {}}}
]
And even more to the point, this isn't enough to preserve the autocompletion:
BeginPackage["foo`a`"];
ggg::usage = "asdasd";
EndPackage[];
(* Split the cell here *)
Internal`SymbolList[False]
(* And further split here *)
BeginPackage["foo`"]; EndPackage[]
(* Make sure to call Internal`SymbolList[True] after trying this *)
why this happens is something I haven't been able to figure out. This behavior is a lot like the behavior involved in developerFunctions.m. There doesn't seem to be anything in NeedCurrentFrontEndSymbolsPacket
to explain it.
Workaround
Since this triggers on $ContextPath
edits, you simply need to edit the $ContextPath
again.
This will recover the auto-completion:
BeginPackage["foo`a`"];
EndPackage[];
So after you load your packages, you can use that to get your autocompletions back.