In a recent thread, I came across a mention of a new feature in R2018a: tab completion suggestions for user-defined functions. (release notes link to this feature)
I applaud this development. I know I am not the only one complaining that it didn't already exist. So I immediately tried to check it out. I used the guide linked in the release notes, which states: "To experiment with code suggestions, start to call the function from a live script and observe the suggestions."
That suggests that it's also possible to use this outside of live scripts, but they just suggest you use that. I don't appear to be the only one thinking that, as suggested by Sean de Wolski: "While I can't talk about the future, if you look at 18a, there is new infrastructure for adding function signatures for code complete/suggest especially in regards to the live editor."
But I failed to get it to work. In the normal editor I only got the normal header-derived hint, and in the live script I could only get a single input type, instead of the two included in my JSON file. What am I doing wrong? Or is the feature not yet at the level the documentation has us believe? Is this a bug that I should report (there aren't any about this yet)?
(Function header, result in live script, and JSON file below and in zip)
function outfilename=WBM(filename,url_part,varargin)% syntax:
% outfilename=WBM(filename,url_part)
% outfilename=WBM(___,options)
% outfilename=WBM(___,Name,Value)
.
{ "WBM": { "inputs": [ {"name":"filename", "kind":"required", "type":["char"], "purpose":"Target file name"}, {"name":"url_part", "kind":"required", "type":["char"], "purpose":"URL of the file/website"}, {"name":"options", "kind":"ordered", "type":["struct"], "purpose":"Struct containing the options"} ] }, "WBM": { "inputs": [ {"name":"filename", "kind":"required", "type":["char"], "purpose":"Target file name"}, {"name":"url_part", "kind":"required", "type":["char"], "purpose":"URL of the file/website"}, {"name":"date_part", "kind":"namevalue", "type":["char"], "purpose":"Partial or complete date of the capture"}, {"name":"tries", "kind":"namevalue", "type":["numeric","numel=3"], "purpose":"Number of times a [load,save,timeout] is allowed"}, {"name":"verbose", "kind":"namevalue", "type":["numeric","scalar","integer"], "purpose":"The amount of text displayed"}, {"name":"m_date_r", "kind":"namevalue", "type":["char", "choices={'ignore','warning','error'}"], "purpose":"Missing date response"}, {"name":"response", "kind":"namevalue", "type":["char"], "purpose":"Cell with responses"}, {"name":"ignore", "kind":"namevalue", "type":["char"], "purpose":"HTML error codes to be ignored"} ] }}
Best Answer