AddCodeCompletion

Adds code completion to your function’s arguments.

ResourceFunction["AddCodeCompletion"]["function"][arg1,arg2, ]

adds code completions to "function" for each argi.

Details and Options

Each argi can be one of the following:
{string1, string2, }a list of possible string completions
Noneno completion
"AbsoluteFileName"absolute filename completion
"RelativeFileName"relative filename completion
"Color"color completion
"PackageName"package name completion
"DirectoryName"directory name completion
"InterpreterType"interpreter type completion
"Style"style completion

Examples

Basic Examples

Add a list of strings as possible code completions for the ‘ohmy’ function:

In[1]:=
ResourceFunction[ "https://www.wolframcloud.com/objects/arnoudb/DeployedResources/\
Function/AddCodeCompletion"]["ohmy"][{"lions", "tigers", "bears"}]
Out[1]=

Code completions appear when the first double quote is typed:

In[2]:=
\!\(\*
GraphicsBox[
TagBox[RasterBox[CompressedData["
1:eJztmc9v2zYUx43tsuP+hQG5NX/Arrt5pwDdetthLRYWA4oMcwcMA2ar/0DR
Q1K5x55azGvspgUa5BCsbWIlAnYIkKLZkMB2cxiwrduS+kd++OCRFClSEmXE
liVLxCO+NqinR4nvw0c6yPvo2jeX0Xu5XO7mB/jr8tXvPykUrv7w2Yf44srC
za+vL8x/9enCd/PX5wsfX3sfG7/Eny/wh/T3BvcVOngyM7sxYz5Q3x1BD3cP
sdjlYDB4desSnlRlULmSy1269Qpb8BwGKWuxMtm5/evLz+vWt+s7wERiYlvi
krwPwyAsCJtUM1lbzc1uOGIcKJO8Sb6JvfAIG+8UNmYKq8Qyt5qfI/b82oMb
pLN6h0VNL+eeDGMSaGlkIqcEhZNfY0ycYJ+a67nZ9RsHhAmxcH9yiVm5Q+Th
GWdCQ3YX+lHe4aMCxSCQWxwRyR+aGzyRcJI8Hb53Ak1HJvf5E8hYOUmyy8QJ
2Qnf3SYjMXFIkmPHmyQZZsJQsDOWLfRoTJyjRvE7lV0m0eXdgMBEOoVUTPAf
bPbtZ7vhTFLYIgJxdo27iXzaPaztWFgPs8VkvLb52x8aa2wm7d6plgImwCRu
Ju96p1oqEpPuiZaKwuS4e6KlgAkwiZvJ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Tcy0FTIAJMEmeicb6H/tanVE=
"], {{0, 96}, {92, 0}}, {0, 255},
ColorFunction->RGBColor],
BoxForm`ImageTag["Byte", ColorSpace -> "RGB", Interleaving -> True],
Selectable->False],
DefaultBaseStyle->"ImageGraphics",
ImageSizeRaw->{92, 96},
PlotRange->{{0, 92}, {0, 96}}]\)

Add a file name code completion for the “fileopen” function:

In[3]:=
ResourceFunction[ "https://www.wolframcloud.com/objects/arnoudb/DeployedResources/\
Function/AddCodeCompletion"]["fileopen"]["AbsoluteFileName"]

Code completions appear when the beginning of an absolute file name is detected:

In[4]:=
\!\(\*
GraphicsBox[
TagBox[RasterBox[CompressedData["
1:eJztms9PG0cUgK320mOvPlbKMX9AL0XqpaKnSik9pyGFqFJEhVOp6gUhNa16
iXKxLKVS21SVieXQWA2SUapabYAY07oC44DtQkiJMCoQwGCvbeKDO/vTM7sz
64V1Y8/OG32g2dmZWTPfvDdriTcGP7kw/IrP57v2Gvp14dJnbwcClz5//3V0
8cHItY+vjAx99O7Ip0NXhgJvDr6KGt9BP1H0I9dzzdsqNwOzvvMKgUmt8cE0
ujwXmtD7TFx9T+uDNb587mSfIbTLZrMpRVdmBp7sNQ9WB9LpaLUJxXFR13Aq
lPCdT1xdJ9fZbF9h/f65rtpfupGeGXiUHE0stbFfnBofNsqtNP3PR/v/JS10
TxYs8KdvOln/HrC/kGxdyn9D8snM6LbUrG6OGvZV9SznrQL2afbZSd5qX2kx
d1byBtGodOsPTJvPF+twVk+WfWtJ30Lux6eK1jvqtjBuCW5fyfmzGFj+p4a5
uXGy37hUjPc/IPuQjdoeMxrZw9We1iPJiX1FMVU+2CeKXeZ3Yh+LcSN+FWXG
bLpfYqDeSBtO3zwdsm8qYN+9fdxOTgtYW/tGnTbcvX0187c/9cG+S/tqliaP
ZvzLQit1YwNNjebh7u2r+mn+IfPjhWFfDlg8IWPHMdnYNLVrZzT+OkHrhgm1
Du+A/aa+Aczf+MA+Xoig+1/p0FdFx/YdFbDPnf3kaGLhRjz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THMW1feDnt/adL5GH
8Z59AOwDHrdfbwAu4de+VG8ALgH7IsOz/ReAS8C+yIB9kQH7IsOvfaAj/Aei
52P6
"], {{0, 70}, {170, 0}}, {0, 255},
ColorFunction->RGBColor],
BoxForm`ImageTag["Byte", ColorSpace -> "RGB", Interleaving -> True],
Selectable->False],
DefaultBaseStyle->"ImageGraphics",
ImageSizeRaw->{170, 70},
PlotRange->{{0, 170}, {0, 70}}]\)

Add code completion for a function with multiple arguments:

In[5]:=
ResourceFunction[ "https://www.wolframcloud.com/objects/arnoudb/DeployedResources/\
Function/AddCodeCompletion"]["animals"][{"cat", "dog", "mouse"}, {"horse", "cow", "pig"}]

Code completions appear for each argument:

In[6]:=
\!\(\*
GraphicsBox[
TagBox[RasterBox[CompressedData["
1:eJztnU1PG0cYx6320mO/QiVu4QP02hs9RUqbexOVjSpFVHEqVZWKly8Q5UBY
m1tOieoGbBcpFgeUEPDCShyQiKAVEW9SKvUthWDM28F9ZvZtdr1+2WUXs9P/
X3+i8bMzs+b56Zkdh1345Pa3N5QPMpnM/Y/onxu3vv8sm731wxcf04ubI/e/
uTMy/PXnI98N3xnOfnr7Qwp+RV8F+mLtjebjcJ6tZgYXBrQnoQc2n9y9vkBj
wwx/urZHtl42m83XY9foeyo2izczmWtjr5txKNqcraMombG8n2i6RI7cb34Z
6Hn46oOVV1/W9Htzq7FxfDszpiiTK2Lof8rxgg7J0dDdl+ztUtpY1lgW4+IY
cc6WUf3m6C53bqHxbA9lq1Y8+6zdwvgwuzCQrVLnzPXqED86NPs4eM52HGer
Tk/7RO05BovTsTQ289YXsUIrk4pXZjg29Zujm6gZbS4zOHf3jZXtzGD1oRgM
AkEcWTc7yF56WXQevtF8NtSCLyRHE5mvxnyHHWRB9RiT+s6Rp9opH5ejlW1e
L7zK2nAkCizIBjocA+YM5uhWrnuKUBy9nLzh1tKTl6Owb/HVY3SOgXN2uj7y
qrRXgBg48jVUWGGjcOQ7mRBXzKvAUbioxcbRP2e3fQ5fooWeF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jKIXCUQ+Aoh8BRDoGjHAJHOQSOcggc
5VCcHHfYrcjaMjj2QV04LvNnMU7tZzFi4RhqTnDsTd05qpVtnvPYCi2BOcEx
PEd2V2qprFq/mdoqKH6LIxMVmr9C3V9jbXYGxwQU/vrIb17NG3ZbLe2Ih0SO
wtHlgj0kEYNjJI4OLF9NgWPfdGGOHepReLzOt96CY9yiDDROz8OYwdLNNt95
6oGHyDvsOZ2tcJNHNDhG4uhWmR4QZI9ymPj0vCc6vQOOSelC9djZfF/q1KPO
n9ICx4SUIEdfkeaNhCCCY9PkeHKedoMjOMohysDRyXnaDY6c41naDY7gKIfA
UQ6BoxyK9scyrqD/A3TLWJ0=
"], {{0, 96}, {152, 0}}, {0, 255},
ColorFunction->RGBColor],
BoxForm`ImageTag["Byte", ColorSpace -> "RGB", Interleaving -> True],
Selectable->False],
DefaultBaseStyle->"ImageGraphics",
ImageSizeRaw->{152, 96},
PlotRange->{{0, 152}, {0, 96}}]\)

Publisher Information