Skip to main content

front end - Having variables appear aqua in user defined function



In many of the inbuilt mathematica function, variables appear aqua like in:


enter image description here



However, when creating your own function, variables no longer have that green coloring and are instead colored like an undefined variable


enter image description here


Is there any way to define functions so that variables used in arguments like in the manner above can get the aqua syntax coloring?



Answer



You can use SyntaxInformation. In this case,


SyntaxInformation[Lim] = {"ArgumentsPattern" -> {_, _, OptionsPattern[]}, 
"LocalVariables" -> {"Limit", {2}}}

does what you want.


Comments