5

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?

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
  • 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. – Karsten7 Oct 06 '15 at 11:29
  • 1
    @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. – Szabolcs Oct 06 '15 at 12:43
  • By the way, i notice that if i modify the usage message for f, the autocompletion doesn't take it into account, even if I quit the kernel and enter the same new usage message again ! You have to quit mma and start a new session ! – SquareOne Oct 06 '15 at 12:59
  • 1
    Autocompletion seems to work, the only issue I see is, that the "f[]" part isn't removed from the second line. http://i.stack.imgur.com/arY1E.gif – Karsten7 Oct 06 '15 at 13:00
  • 1
    @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. http://mathematica.stackexchange.com/q/21870/12 – Szabolcs Oct 06 '15 at 13:02
  • 1
    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. – Karsten7 Oct 24 '15 at 01:01

0 Answers0