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 - While loop EOL comment highlighting situationally incorrect. #78

Closed
psmskelton opened this issue Mar 7, 2024 · 2 comments · Fixed by #82
Closed
Labels

Comments

@psmskelton
Copy link

Describe the bug
Syntax highlighting has a few quirky bugs. One I've come across in dealing with other people's code (shudder) is EOL comments on while loops. These only appear to be highlighted if they are preceded by a semicolon, which isn't great.

To Reproduce
Try something bad, like putting EOL comments on while loops. That being said, GitHub's Linguist model is completely broken for comments in MATLAB code, as this demonstrates, so look at the VSCode screenshot below.

    while test % test
        % test
    end
    
    while (test) % test
        % test
    end
    
    while test; % test
        % test
    end

    for i = 1:10 % test
        % test
    end

    if i == 10 % test
        % test
    end

Expected behavior
Consistent highlighting of EOL comments.

Screenshots
Screenshot 2024-03-07 095739

Useful Information

  • OS Version: Microsoft Windows 11 Enterprise (10.0.22631)
  • VS Code Version: 1.87.0
  • MATLAB extension for Visual Studio Code Version: 1.2.0
@psmskelton psmskelton added the bug label Mar 7, 2024
@dklilley
Copy link
Member

dklilley commented Mar 7, 2024

Thanks for reporting this! Moving the issue over to MATLAB-Language-grammar

@dklilley dklilley transferred this issue from mathworks/MATLAB-extension-for-vscode Mar 7, 2024
@psmskelton
Copy link
Author

@dklilley - Apologies for incorrect repo.

There's a discussion on the Linguist repo about issues with other languages, and I added a comment there regarding GitHub's incorrect parsing of MATLAB comments (github-linguist/linguist#6668 (comment)). Is that a Linguist issue, or an issue provided by this grammar engine?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants