Entities have this nice autocompletion of properties:
How do I define autocompletion for my own boxes that behave the same way?
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityHere is a simple example to implement custom do...end box:
ClearAll@do
SetAttributes[do, HoldAll];
do[var_, begin_, end_, body_] := Do[body, {var, begin, end}]
Hold[do /: MakeBoxes[do[var_, begin_, end_, body_], StandardForm] :=
TemplateBox[MakeBoxes /@ Unevaluated@{var, begin, end, body},
"do", DisplayFunction -> (GridBox[{{RowBox@{RowBox[{style@"do",
" ", #}], "=",
RowBox[{#2, " ", style@"to",
" ", #3}]}}, {RowBox@{"", #4}}, {style@"end"}},
ColumnAlignments -> Left] &)]] /.
style[str_] -> StyleBox[str, FontColor -> Darker@Green] //
ReleaseHold // ReleaseHold
Hold[CurrentValue[EvaluationNotebook[], {InputAliases, "do"}] =
TemplateBox[{"\[SelectionPlaceholder]", "\[Placeholder]",
"\[Placeholder]", "\[Placeholder]"}, "do",
DisplayFunction -> (GridBox[{{RowBox@{RowBox[{style@"do",
" ", #}], "=",
RowBox[{#2, " ", style@"to",
" ", #3}]}}, {RowBox@{"", #4}}, {style@"end"}},
ColumnAlignments -> Left] &)]] /.
style[str_] ->
StyleBox[str, FontColor -> Darker@Green] // ReleaseHold
When using, first press Esc
key, then input do, then press Esc
key to automatically incomplete.
AddSpecialArgCompletion
fromFEPrivate
) to Subvalue functions/boes. $\endgroup$