Skip to content

Conversation

@rlivings39
Copy link
Member

Adds support for function argument validation addressing #13 and Gimly/vscode-matlab#90. See screenshot below for vscode highlighting of test file. Also tested in Atom.

function argumentValidation(x,~,v,method,flag, opts)
    % Comment before arguments blocks
    arguments
        % Block comment
        x (1,:) {mustBeNumeric,mustBeReal} % trailing coment
        ~
        % Line comment
        v (1,:) {mustBeNumeric,mustBeReal, mustBeEqualSize(v,x)}
        method (1,:) char {mustBeMember(method,{'linear','cubic','spline'})} = 'linear' % End of line comment
        % End block comment
    end
    arguments (Repeating)
        % Trailing flags
        flag (1,:) string {mustBeMember(flag,["first","second","third"])}
    end
    arguments
        opts.Named (1,:) string {mustBeNumeric(opts.Named), ... Dotdotdot comment
                                 mustBeReal}
    end
end

VSCode screenshot
vscodeArgumentsBlock

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants