autocomplete filenames paths function input
显示 更早的评论
I am trying to get custom function input autocompletion for a filename and can't get it to work how I want:
- I have a function like "dir", so I want it to have autocompletion for the target folder as "dir" does, but I also want to be able to pass optional arguments to extend its functionality
- I want to use the arguments block as much as possible, and functionSignatures.json if needed
The function itself would be something like
function mydir(target,opts)
arguments
target
opts.ShowHidden
opts.Blahblah
end
% do stuff
end
Some things that don't work:
- I tried to make a functionSignature for the "mydir" function itself, but only for the "target" variable. Then I do get the tab-autocomplete behavior I want, and wildcards work. However, I don't get tab-autocomplete on my optional arguments. I could not figure out how to do the structure-based name/value pair function signatures, as that does not seem to be covered in the documentation.
- Within the arguments block, I noticed that using the "mustBeFolder" validator makes it possible to tab-autocomplete the input target. However, I cannot then include wildcards because once wildcards are in, then the folder doesn't exist anymore.
- So I tried to create a custom "mustBeValidPathName" validator and created a functionSignatures.json entry for it, but then the tab-autocomplete doesn't work anymore. Calling "mustBeValidPathName" by itself, however, does give me the tab-autocomplete behavior I want.
How can I get both the file name autocompletion, that accepts wildcards, and be able to also auto-complete optional arguments using the arguments block framework?
There are 2 other Matlab Answers pages on the topic but first one doesn't seem to answer the question, and second one is reference by the first but is outdated/incomplete
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Install Products 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!