Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax highlighting for arguments block and improvements for property validation #14

Merged
merged 1 commit into from
Oct 15, 2019

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