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
Color Preview in VSCode is fooled when using custom classes ending with "Colors". #2857
Describe the bug
If the name of the class finishes with Colors, VSCode shows a preview as if the class name was Colors. (see the screenshot)
To Reproduce
You can use this code:
import 'dart:ui';
class MyColors {
static const red = Color(0xff00ff00);
}
class NoColorHere {
static const red = Color(0xff00ff00);
}
void somefunction() {
final someOtherColor = NoColorHere.red;
final someColor = MyColors.red;
}
Expected behavior
Preferably it should show the actual color in all cases, but a quick fix could be to not show the color preview when the class is not "Colors".
Screenshots
Versions (please complete the following information):
I'll fix this to only allow Colors, though I don't think we can make this completely reliably (some colours may not be known statically, and you could also create your own Colors class too). In the future this may move into the server (with LSP), so perhaps it will be easier to make it more reliable there (that's #2167).
Activity
DanTup commentedon Oct 8, 2020
I'll fix this to only allow
Colors, though I don't think we can make this completely reliably (some colours may not be known statically, and you could also create your ownColorsclass too). In the future this may move into the server (with LSP), so perhaps it will be easier to make it more reliable there (that's #2167).