flutter-intellij
flutter-intellij copied to clipboard
[Enhancement] Display color icon for variables that can be dereferenced to known colors
Currently, the color selector can be parsed and displayed only when the value of the variable explicit starts with "Color" or "Colors", or "CupertinoColors".
Found a related code at https://github.com/flutter/flutter-intellij/blob/28aaecc3078f0f5d065194d64292e920941640d2/src/io/flutter/editor/FlutterColorProvider.java#L41 which abandoned all values other than these patterns.
Steps to Reproduce
Version info
Flutter 2.0.5.
That's a good idea. It may have performance issues, though.
Not sure how much performance regression will raise if we look up it's superclass to see whether it's a Color
or CupertinoColor
, but at least this is a proper way I think.
I agree. My concern is that we have to start looking at RHS expressions of assignments and dereferencing field references, and possibly more. The implementation will have to carefully code that because this detector gets called a lot. Fortunately, we already have the PSI model to use.
Any plans to implement this recently?
Maybe we can benefit from this: https://github.com/dart-lang/sdk/commit/3238b2c09c1e2fc023363ea33902d93bcc8b3d79