Suppose I have a function like
Options[f] = {foo -> 1};
f[opt : OptionsPattern[{f,g}]] := h@g[Sequence @@ FilterRules[{opt}, Options[g]]]
I purposefully do not want to append Options[g]
to Options[f]
because I want the defaults to be inherited from g
instead of setting them separately for f
.
In this situation, is there a way to use SyntaxInformation
with option highlighting for f
? It seems a naïve attempt results in red colouring for anything that is not in Options[f]
(as the documentation states). But I wanted to ask anyway, just in case I missed something and there's a way to get this working after all.
Example:
Options[g] = {bar -> 2}; (* in practice g could be a builtin *)
SyntaxInformation[f] = {"ArgumentsPattern" -> {OptionsPattern[{f, g}]}};
So it appears that arguments of OptionsPattern
are not supported within SyntaxInformation
(they are ignored).
g
? If so, why? $\endgroup$