Wolfram Research

AddCodeCompletion

Contributed by: Arnoud Buzing

Source Notebook

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:
{ string 1 , string 2 , } a list of possible string completions
None no 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["AddCodeCompletion"]["ohmy"][{"lions", "tigers", "bears"}]
Out[1]=

Code completions appear when the first double quote is typed:

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

In[2]:=
ResourceFunction["AddCodeCompletion"]["fileopen"]["AbsoluteFileName"]
Out[2]=

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

Add code completion for a function with multiple arguments:

In[3]:=
ResourceFunction["AddCodeCompletion"]["animals"][{"cat", "dog", "mouse"}, {"horse", "cow", "pig"}]
Out[3]=

Code completions appear for each argument:

Resource History