AdvancedExpressionFolding
AdvancedExpressionFolding copied to clipboard
Fold the @Nullable and @NotNull annotations
For example:
- fold
@Nullable FootoFoo? - fold
@NotNull FootoFoo! - fold
@NotNull Map<@NotNull String, @Nullable Object>toMap!<String!, Object?>
In addition to the Jetbrains annotations, support all nullability annotations that are supported by IDEA (i.e. Findbugs, Checker Framework, etc).
"Foo!" may be confusing as such syntax is not used in any language...
In Kotlin, Foo! means platform type, i.e. the compiler doesn't known whether it's nullable or not. Kotlin has the !! operator that asserts that a value is not null. Maybe it would be better to use its syntax.
Perhaps use the double exclamation mark glyph ‼ (U+203C)?
It takes slightly less space than !!
https://en.wikipedia.org/wiki/!!
I think it would be better to use what is "valid" code (at least in one language), and use a font like FiraCode if you want to collapse !! to ‼.
I also think it would be better to not use any suffix at all on @NotNull, as normal rules assume any unannotated field is @NotNull by default. The only place where you might need to differentiate is a @NotNull method/parameter overriding a @Nullable method/parameter.
I also think folding @Nullable would be confusing given Foo? already has a well-defined meaning.
Do you think it's worth to also highlight nullable with special foreground/background different from non-nullable?
Highlighting might actually be nice. My first thought would be fold away @NonNull and apply the "bold underscored" effect, and "dotted line" effect for @Nullable. Not immediately sure what colors on those underline effects would be most appropriate though, given they might need to be different for Darcula and light color schemes.
If implemented, pulling the same annotations from "@NotNull/@Nullable problems" inspection would be nice.
As someone who made a color scheme, please allow modification if you use special highlighting
On Fri, Jun 23, 2017, 5:33 AM Gordon [email protected] wrote:
Highlighting might actually be nice. My first thought would be fold away @nonnull https://github.com/nonnull and apply the "bold underscored" effect, and "dotted line" effect for @nullable https://github.com/nullable. Not immediately sure what colors on those underline effects would be most appropriate though, given they might need to be different for Darcula and light color schemes.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cheptsov/AdvancedExpressionFolding/issues/26#issuecomment-310494753, or mute the thread https://github.com/notifications/unsubscribe-auth/AITcNXGQWJVeFMtcdEMNTNN2_DZwOJ60ks5sGs-sgaJpZM4MWOk7 .