Skip to content

MATLAB Syntax Highlighting Incorrectly Identifies Variables as Functions #239

@Airloss

Description

@Airloss

Description

I'm experiencing an issue with the MATLAB syntax highlighting in VS Code where variables are incorrectly identified as functions. This causes my custom styling for functions to be incorrectly applied to variables, making the code harder to read.

Current Behavior
A variable is incorrectly identified with the scope entity.name.function.matlab in certain contexts, especially when it's used with parentheses for array indexing. This causes it to be styled as a function even though it's a variable.

Expected Behavior
Variables should be consistently identified with scopes like variable.other.readwrite.matlab or meta.assignment.variable.single.matlab regardless of whether they're being indexed with parentheses. Function styling should only apply to actual function names.

Additional Information
When inspecting the token scopes using the "Developer: Inspect Editor Tokens and Scopes" command:

  • The same variable is sometimes identified as variable.other.readwrite.matlab or meta.assignment.variable.single.matlab
  • But when used with parentheses for indexing, it's identified as entity.name.function.matlab

I've tried creating explicit style rules for variables, but the inconsistent scope identification makes it impossible to style functions and variables distinctly.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions