Skip to content

Add different semantic token type for class' properties and method's or normal variables  #3618

@shujaatak

Description

@shujaatak

Problem
I'm always frustrated to see that the semantic token type for both class properties and local variables in class methods are set as variable and hence highlighted with the same color! (I have modified the color, see the below details section)

image

In VS Code, I enabled Developer: Inspect Editors Tokens and Scopes to compare the semantic token type and modifiers for both class properties and variables but unfortunately they are same so one can't set distinct colors for them to easily differentiate them.

Because of the same semantic token type as variable, one can't customize a class property's declaration color using the following:

"property.declaration:dart":{ // bug or missing feature: doesn't work!
    "bold": true,
    "foreground": "#ff0000",  // For property declaration
},  

Solution I'd like
Please set the semantic token type for class properties as property
and set the semantic token type for normal variables as variable.

More details
I added the following to settings.json to highlight variables with this #bc5fd3 color:

"variable.declaration:dart":{
    "bold": true,
    "foreground": "#bc5fd3",  // For variable declaration
}, 

But it highlights the properties of the classes with the same color too!

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editorRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serveris enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions