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
Feature Request: Turn Of Code Highlights for Classes unkown to Dart. #2241
Since some Flutter and Dart Classnames can become quite Long I would like to request, that Classes which are not implemented won't be highlighted as Classes any longer.
This would make it easier to spot typos ( I type mostly faster than autocomplete reacts)
and to avoid wrong conclusions like following example:
classBaa{
};
classFoo<TextendsBaa> {
}
...
var myfoo =newFoo<Baar>()
Why does Foo<T> doesnt accept my Baa class as a Type did i do something wrong in the template?
While the while problem lies in me writing Baar instead ..
So it would be nice to only highlight Words starting with a Capital Letter as Classes if they can be identified. Would that be possible? :)
This isn't currently possible, as the highlighting is done with TextMate grammars and has no access to type info. There's an open PR to move to server-based highlighting when VS Code finalises the API, however I'm not sure if the server highlights differentiate between resolved/unresolved classes either. If not, maybe using the new API we could use the diagnostics (errors) to apply additional colouring rules? I'll have to do some testing.
In order to get the fix you'll need Dart-Code v3.18.0 (a preview release should be available later today/tomorrow), be using LSP Preview, and have a Dart SDK from after yesterday (the most recent nightly works, and of course the next releases of Dart/Flutter SDKs will include this).
With all this active, you'll be able to override the colours supplied by the textMate grammar (for example here I've set classes that come from the grammar as red), and the Semantic Tokens will then be layered over the top (and re-color known classes as classes):
(probably you'd just want a slightly faded colour or something though, rather than red).
Note: The overridden colour will be used for all types until semantic tokens are available, so when you first open a file you'd see them all like that, and then they'd be updated once the token data arrived.
Due to some last minute issues, support for LSP 3.16 (which supports semantic tokens) won't be included in v3.18, but hopefully the next release after that.
Activity
DanTup commentedon Jan 30, 2020
This isn't currently possible, as the highlighting is done with TextMate grammars and has no access to type info. There's an open PR to move to server-based highlighting when VS Code finalises the API, however I'm not sure if the server highlights differentiate between resolved/unresolved classes either. If not, maybe using the new API we could use the diagnostics (errors) to apply additional colouring rules? I'll have to do some testing.
DanTup commentedon Dec 15, 2020
This will be achievable with the semantic token work in dart-lang/sdk@cb2ede5.
In order to get the fix you'll need Dart-Code v3.18.0 (a preview release should be available later today/tomorrow), be using LSP Preview, and have a Dart SDK from after yesterday (the most recent nightly works, and of course the next releases of Dart/Flutter SDKs will include this).
With all this active, you'll be able to override the colours supplied by the textMate grammar (for example here I've set classes that come from the grammar as red), and the Semantic Tokens will then be layered over the top (and re-color known classes as classes):
(probably you'd just want a slightly faded colour or something though, rather than red).
Note: The overridden colour will be used for all types until semantic tokens are available, so when you first open a file you'd see them all like that, and then they'd be updated once the token data arrived.
DanTup commentedon Dec 22, 2020
Due to some last minute issues, support for LSP 3.16 (which supports semantic tokens) won't be included in v3.18, but hopefully the next release after that.