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
according to the latest version of the file, void and var are categorized as preemptive type, const has been moved to modifier and the String is highlighted as a normal class.
Sorry for the delay! I think void is is a little different to a normal type (for example there are places where you cannot put void but could put a type). I'm not sure if colouring it like a type is more correct than as a keyword, and some people may prefer it as is (I do - I like being able to see void at a glance and know whether a function is returning a value or not).
If there's demand for being able to colour it like a type, perhaps it would be better to add a modifier to the semantic token so that it can be customised?
@UmairJibran I'll comment on the PR about your change - I'm not sure I entirely understand the goal - although I will note that if we do make changes here, they should also be reflected in LSP semantic tokens, otherwise you'll see them load as one colour, and then change to another colour once the semantic tokens arrive.
@tjx666 I think there are valid arguments for colouring it both ways. Given at least some people prefer it to be coloured like a keyword and that's what people are already used to, I think any change should be opt-in.
Adding a semantic token modifier will allow anyone who wants it to be coloured like a type to change its colour, and the default would remain as-is.
I landed a change in the SDK in dart-lang/sdk@3690f54 that adds a void modifier to the keyword token, so it's now possible to customise the colour of the void keyword in your VS Code settings:
By default void will remain coloured as a keyword, but you're now able to reliably customise it. Unfortunately I don't know a way with VS Code's customisations to map it to another colour so you'll have to put the colour in explicitly. You can find out what your class colour is with the Inspect Editor Tokens and Scopes command and then selected an existing class name and it should show the hex value:
Note: This change is in the SDK, so you may not see it until a future Dart/SDK update (although for testing, it's already in the bleeding-edge Dart builds - ofc they're not recommended for production).
Activity
UmairJibran commentedon May 2, 2021
according to the latest version of the file,
voidandvarare categorized aspreemptive type, const has been moved tomodifierand theStringis highlighted as a normal class.UmairJibran commentedon May 2, 2021
However, I have created a pull request with the requested changes, let's see if they accept it or not.
DanTup commentedon May 3, 2021
Sorry for the delay! I think
voidis is a little different to a normal type (for example there are places where you cannot putvoidbut could put a type). I'm not sure if colouring it like a type is more correct than as a keyword, and some people may prefer it as is (I do - I like being able to seevoidat a glance and know whether a function is returning a value or not).If there's demand for being able to colour it like a type, perhaps it would be better to add a modifier to the semantic token so that it can be customised?
@UmairJibran I'll comment on the PR about your change - I'm not sure I entirely understand the goal - although I will note that if we do make changes here, they should also be reflected in LSP semantic tokens, otherwise you'll see them load as one colour, and then change to another colour once the semantic tokens arrive.
nbros commentedon May 4, 2021
I know
voidis a type in Dart but I still see it as the absence of a type, so I like it colored this way too (like a keyword).tjx666 commentedon May 6, 2021
I see that
voidis colorized as type in typescript file.DanTup commentedon May 7, 2021
@tjx666 I think there are valid arguments for colouring it both ways. Given at least some people prefer it to be coloured like a keyword and that's what people are already used to, I think any change should be opt-in.
Adding a semantic token modifier will allow anyone who wants it to be coloured like a type to change its colour, and the default would remain as-is.
[-]void is a type but syntax highlight is colorized like a keyword[/-][+]Allow void to be coloured like a type[/+][analyzer] Mark void keyword with a modifier for LSP semantic tokens
DanTup commentedon Jun 10, 2021
I landed a change in the SDK in dart-lang/sdk@3690f54 that adds a
voidmodifier to thekeywordtoken, so it's now possible to customise the colour of thevoidkeyword in your VS Code settings:By default
voidwill remain coloured as a keyword, but you're now able to reliably customise it. Unfortunately I don't know a way with VS Code's customisations to map it to another colour so you'll have to put the colour in explicitly. You can find out what your class colour is with the Inspect Editor Tokens and Scopes command and then selected an existing class name and it should show the hex value:Note: This change is in the SDK, so you may not see it until a future Dart/SDK update (although for testing, it's already in the bleeding-edge Dart builds - ofc they're not recommended for production).