Suggestion/question: User-friendly tab auto-completions

9 ビュー (過去 30 日間)
D. Plotnick
D. Plotnick 2018 年 6 月 28 日
回答済み: Ken Atwell 2018 年 11 月 21 日
Hello, I have a question/suggestion about the tab-to-complete box, and improving its utility. I am submitting this here, as there may be an existing option I am missing: otherwise I shall resubmit to feature requests.
The crux of the matter is that when using tab-to-complete in the command window, the alphabetical listing is actually a major hindrance if my script/function/variable name is similar to a lot of others in the Matlab path. If I have a variable 'plottedData' in my workspace, and I type 'plo-[TAB]' the list is enormous, and most of the words say plot in them; there is also no quick way to visually pick my variable out from all of the m-files (the '.m' at the end is not sufficient). Now I could continue typing my variable name, but that quickly makes auto-complete less useful. As someone who likes verbose function and variable names, AC is a real time saver.
So, the solution would be to allow re-ordering or sectioning of auto-complete suggestions. Say, workspace variables at the top in a block, functions in your custom matlab path in a second block, and functions in the default path at the bottom. (Note that there is an inherent issue with overloaded function names too, so maybe order those in the order they appear in the path list? Not sure, those are more complicated. and how about variable+function overloads?).
Alternatively, color coding variables vs. functions within the auto-complete window would make it easier to pick out.
I am certain that not everyone will want to muck with their AC the same way I do, but it would be nice to have the option. Does it exist?
  8 件のコメント
D. Plotnick
D. Plotnick 2018 年 6 月 28 日
Ah. This is actually an argument for a slightly different autocomplete tweak for sorting variables vs function names vs parameters. Examples:
plot(x)
diary on
edit myFun.m
The first case should default to sorting variables first: i have to pass plot some variable, even if its the output of a nested command: plot(abs(x).
The second case only has a few possible choices: on, off (methods of diary) or folder locations. I just checked and this DOES pick out only those options, not other m-files or variables.
The third too limits itself to suggesting m-files.
So, what this means to me is that there are functioning completion suggestions for these particular functions (I am guessing they use the 'suggestions' method you linked to, but I don't know), but not for my own functions, since I have not created custom code suggestions.
This still argues for being able to prioritize the generic AC window ordering.

サインインしてコメントする。

採用された回答

Ken Atwell
Ken Atwell 2018 年 11 月 21 日
Give the Live Editor a try in a new-ish release of MATLAB; I expect its auto-completion will behave more like you are hoping for.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by