Short Version: How do I turn off (or specify a simple replacement for) Code Assist predictive-interface for a specific input alias?
Longer Version: Using the Notation package I have put together a set of routines that let me, on the fly, specify very general notations and assign them to simple labels. These notations get tagged internally in ways that let them display in their full glory in both input cells and output cells. The trick is to be able to get these tagged-versions into the input cells easily. Based on some clever suggestions by Stack Exchange members, I have three approaches working. The first involves a custom palette. The second is an ActionMenu tied to an InputAlias. The third is a custom routine also tied to an InputAlias that generates a menu that responds to arrow keys for selection. Example usage is shown below:
My question applies to the third of these. The Code Assist predictive interface (turned off in the animation above) takes a good ten seconds or longer for the preview to pop up, hanging the window until it is complete. Is there any way to turn off this predictive interface for this specific Input Alias? Or perhaps even better, to assign text to what will display that summarizes what it does rather than trying to generate a preview?
Edited to Add: I have been able to combine the functionality of the last option with the middle option, so that the choices can be selected either with the keyboard arrow keys or the mouse. It involves the main code for the last original example I used as a base, so the answer to this question has now become even more important.
Some Specifics on Implementation: As @b3m2a1 suggested, some of this code is based on suggestions he made in this thread. I did end up modifying the code somewhat, though, in an effort to make it easier for my students to use this code. Specifically, instead of the final CurrentValue assignment for the input alias, I used the following function that I defined:
EscMenu[shortcut_,tag_,list_]:=
AddInputAlias[
shortcut->
ParsedBoxWrapper[
DynamicBox[
chooserBox[tag,
MapThread[
Style[#1,"chemical"]:>ToBoxes[#2]&,
Transpose[list]],
tag]]]]
This lets me call:
EscMenu["examples","Example Symbols",exampleAssignments]
where exampleAssignments contains a the same list of label/symbol pairs that I used to define notations previously. This worked beautifully except for the aforementioned code assist issue.
When I try to implement @b3m2a1's code in his answer below, I tried this:
EscMenu[shortcut_,tag_,list_]:=
AddInputAlias[
shortcut->
ParsedBoxWrapper[
DynamicBox[
FEPrivate`If[
FrontEnd`SameQ[FrontEnd`EvaluationCell[],$Failed],
PanelBox["\Chem Templates\"",
Appearance->{"Default"->FrontEnd`FileName[
{"Popups","CodeCompletion"},"top_left.9.png"]}],
chooserBox[tag,
MapThread[
Style[#1,"chemical"]:>ToBoxes[#2]&,
Transpose[list]],
tag]]]]]
The Code Assist bit works beautifully. But what is pasted in has an error: "An unknown box name (FEPrivate`If) was sent as the BoxForm for the expression. Check the format rules for the expression." Any thoughts?
Final Solution: I am not sure where the error was, but I tried the following and it worked perfectly. Thank you!
EscMenu[shortcut_, tag_, list_] :=
CurrentValue[EvaluationNotebook[], {InputAliases, shortcut}] =
With[{baseBox =
chooserBox[tag,
MapThread[Style[#1, "chemical"] :> ToBoxes[#2] &,
list\[Transpose]], tag]},
DynamicBox[
FEPrivate`If[FrontEnd`SameQ[FrontEnd`EvaluationCell[], $Failed],
PanelBox["\"Chem Templates\"",
Appearance -> {"Default" ->
FrontEnd`FileName[{"Popups", "CodeCompletion"},
"top_left.9.png"]}],
baseBox]]]

