You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add different semantic token type for class' properties and method's or normal variables #3618
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)
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!
This was done deliberately, though I now think it was incorrect.
Getters and setters are currently categories as property, with fields (as in your example) categorised as variable. This seemed to make sense, however looking at the VS Code docs it says property should also be used for fields/member variables:
property - For identifiers that declare or reference a member property, member field, or member variable.
Reacted by Shujaat Ali Khan and Ravi Teja Gudapati
Activity
DanTup commentedon Oct 18, 2021
This was done deliberately, though I now think it was incorrect.
Getters and setters are currently categories as
property, with fields (as in your example) categorised asvariable. This seemed to make sense, however looking at the VS Code docs it sayspropertyshould also be used for fields/member variables:shujaatak commentedon Oct 18, 2021
@DanTup Can you please have a look at this #3621 and it would be so kind of you if you please add it to the v3.28.0 milestone.
[analysis_server] Change LSP semantic tokens to use Property for clas…
DanTup commentedon Oct 26, 2021
This is fixed in dart-lang/sdk@fa5f6fc. Since it's in the language server, it'll require a future SDK release not a VS Code extension release.