completion
Compute text completion candidates.
📝Syntax
r = completion(line)
📥Input Arguments
Parameter Description
line a string: command line prefix to complete.
📤Output Arguments
Parameter Description
r a structure with completion prefix and candidate lists.
📄Description

completion exposes the same completion engine used by the console, GUI terminal, and text editor.

The returned structure contains prefix, showpopup, files, builtin, macros, variables, fields, properties, and methods.

Classdef objects and class names are completed through their public properties and methods, including class constants and static methods.

💡Examples
Complete a classdef object.
clear classes
d = [tempdir(), 'nelson_help_completion_classdef/'];
mkdir(d);
filewrite([d, '/NelsonHelpCompletionPoint.m'], ["classdef NelsonHelpCompletionPoint"; "  properties"; "    X = 0"; "  end"; "  properties (Constant)"; "    Dimension = 2"; "  end"; "  methods"; "    function r = value(obj)"; "      r = obj.X;"; "    end"; "  end"; "  methods (Static)"; "    function obj = origin()"; "      obj = NelsonHelpCompletionPoint();"; "    end"; "  end"; "end"]);
addpath(d);
p = NelsonHelpCompletionPoint();
objectCompletion = completion('p.')
classCompletion = completion('NelsonHelpCompletionPoint.')
🔗See Also
methodspropertiesclassdef
🕔Version History
Version Description
2.0.0 completion engine exposed for tests and scripts
Edit this page on GitHub