Update: I think the more general question I should have asked is: How should I write usage messages to work well with auto-completion? Is there documentation on how to prepare a package for convenient auto-completion?

If I make a small function with a usage message, Mathematica will automatically extract the argument pattern from the usage message and offer it for auto-completion:

f[] := 1
f::usage = "f[] returns the value.";

Notice that the complete usage message is echoed under the completion patters, `"f[] returns the value.", including "f[]".

This is not the case for builtins. The argument pattern is not repeated in the description. Can I achieve this for user-defined functions?

  • $\begingroup$ Even using the usage messages of a built-in function in the string representation of boxes doesn't result in the desired behavior. To me it looks like the FrontEnd doesn't process user defined usage messages properly. $\endgroup$
    – Karsten7
    Oct 6, 2015 at 11:29
  • 1
    $\begingroup$ @Karsten7. Or maybe the reason is that it doesn't process built-in usage messages at all. Instead it gets the autocompletion information for builtins from elsewhere. $\endgroup$
    – Szabolcs
    Oct 6, 2015 at 12:43
  • 1
    $\begingroup$ Autocompletion seems to work, the only issue I see is, that the "f[]" part isn't removed from the second line. i.stack.imgur.com/arY1E.gif $\endgroup$
    – Karsten7
    Oct 6, 2015 at 13:00
  • 1
    $\begingroup$ @SquareOne Since I think 9.0.1, there's a separate auxiliary kernel the front end uses for this task. That may be the reason why quitting the kernel doesn't fix it. mathematica.stackexchange.com/q/21870/12 $\endgroup$
    – Szabolcs
    Oct 6, 2015 at 13:02
  • 1
    $\begingroup$ I think some of the informations for built-in functions are stored in FileNameJoin[{$InstallationDirectory, "SystemFiles", "Kernel", "TextResources", "English"}]. Especially FunctionInformation2.m seems to contain the informations for the auto-completion floating box. $\endgroup$
    – Karsten7
    Oct 24, 2015 at 1:01