When defining function i make use of SyntaxInfromation
a lot for front-end highlighting of inputs. I know I can use ArgumentsOptions
and CheckArguments
to do internal validation of the input. However, I do also like for the front-end to correctly know how many inputs are needed. This works correctly for only non-option arguments and for options when OptionsPattern[]
is specified. But when OptionsPattern[]
is specified the argument count is not highlighted correctly. An OptionsPattern is defined as a Sequence of rules that the function recognizes but the front-end highlighting does not.
ClearAll[f]
Options[f] = {aaa -> 1, bbb -> 2};
SyntaxInformation[f] = {"ArgumentsPattern" -> {_, _.}};
(*arguments correct but not aware of options*)
{f[], f[x], f[x, y], f[a, y, z], f[x, y, z, w]};
f[x, y, aab -> 2, aaa -> 3, bba -> 4];
ClearAll[f]
Options[f] = {aaa -> 1, bbb -> 2};
SyntaxInformation[f] = {"ArgumentsPattern" -> {_, _., OptionsPattern[f]}};
(*arguremnts not correct but aware of options*)
{f[], f[x], f[x, y], f[x, y, z], f[x, y, z, w]};
f[x, y, aab -> 2, aaa -> 3, bba -> 4];
Is this intended or am I doing something wrong?