Better content assist for pattern matching
If you have the code:
after typing "case [ctrl+space]", there are over 500 suggestions that pop up in the content assist window. However, you almost certainly want one of two possibilities: "Thing1" or "Thing2". This is particularly clear in the case of a sealed trait, but it also would apply if it were not a sealed trait, or if it were an Enumeration.
In this case, I think that "Thing1" and "Thing2" should be the only contents of the content assist window if you were to hit ctrl+space, but at the least they should be at the top of the list rather than just being sorted alphabetically.
object ContentAssist {
val a: Thing = Thing1
a match {
case //<-- cursor is here
}
}
sealed trait Thing
case object Thing1 extends Thing
case object Thing2 extends Thing
after typing "case [ctrl+space]", there are over 500 suggestions that pop up in the content assist window. However, you almost certainly want one of two possibilities: "Thing1" or "Thing2". This is particularly clear in the case of a sealed trait, but it also would apply if it were not a sealed trait, or if it were an Enumeration.
In this case, I think that "Thing1" and "Thing2" should be the only contents of the content assist window if you were to hit ctrl+space, but at the least they should be at the top of the list rather than just being sorted alphabetically.
Leave a comment
I agree with your suggestions. There are some technical limitations based on how much information we can extract from the presentation compiler (we'd need the 'scrutinee' type), but assuming we have that we could increase the relevance for all it's subtypes. Could be a nice pull-request :)