|
From: | Rik |
Subject: | Re: option for enabling/disabling auto-suggest feature |
Date: | Mon, 30 Apr 2018 14:30:13 -0700 |
On 04/30/2018 12:57 PM, Sudeepam Pandey
wrote:
Yes, there must be an enable/disable feature. I also agree that we should NOT implement an auto-execute option at this time.
This seems correct. This should get us coverage of most of the obvious typos.
This architecture is very similar to the one that Octave already uses for unimplemented functions. See the documentation for missing_function_hook(). The function missing_function_hook() works together with the parser. When the parser doesn't recognize an identifier, it calls whatever has been set up as the callback function in missing_function_hook(). Currently, that function is scripts/help/__unimplemented__. Take a look as well at __unimplemented__.m to see how it operates. The Octave project coding convention is not to use CamelCase so perhaps your function should be __suggestions__ rather than didYouMean? For development, you can quickly substitute your own suggestion function by pointing the missing_function_hook to your own m-file.
It seems to me that there may need to be a missing_property_hook () function, written in C++, that would behave like missing_function_hook when a graphics property is unrecognized.
Sure, this would work. Alternatively, just set missing_component_hook to "" when you don't want to use it.
Take a look at the function menu(). It takes a cell array of strings as input and creates a numbered list, and then returns the selected input. It's already coded and does precisely what you want. --Rik |
[Prev in Thread] | Current Thread | [Next in Thread] |