New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sort auto-completed exhaustive match'es by declaration order #1174
Changes from 11 commits
836bf49
7b22279
cde0baa
bbfaeaa
240dfe2
4c252eb
a70886e
ad787b0
a68027a
45c6c89
707a24f
0d5f96f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,10 @@ package tests.pc | |
import tests.BaseCompletionSuite | ||
|
||
object CompletionMatchSuite extends BaseCompletionSuite { | ||
override def beforeAll(): Unit = { | ||
indexScalaLibrary() | ||
} | ||
|
||
check( | ||
"match", | ||
""" | ||
|
@@ -103,6 +107,63 @@ object CompletionMatchSuite extends BaseCompletionSuite { | |
filter = _.contains("exhaustive") | ||
) | ||
|
||
checkEdit( | ||
"exhaustive-sorting", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add another cross test case for 3rd party defined symbols? Cross tests have the ability to index library dependencies, see |
||
"""package sort | ||
|sealed abstract class TestTree | ||
|case class Branch1(t1: TestTree) extends TestTree | ||
|case class Leaf(v: Int) extends TestTree | ||
|case class Branch2(t1: TestTree, t2: TestTree) extends TestTree | ||
|object App { | ||
| null.asInstanceOf[TestTree] matc@@ | ||
|} | ||
|""".stripMargin, | ||
"""|package sort | ||
|sealed abstract class TestTree | ||
|case class Branch1(t1: TestTree) extends TestTree | ||
|case class Leaf(v: Int) extends TestTree | ||
|case class Branch2(t1: TestTree, t2: TestTree) extends TestTree | ||
|object App { | ||
| null.asInstanceOf[TestTree] match { | ||
|\tcase Branch1(t1) => $0 | ||
|\tcase Leaf(v) => | ||
|\tcase Branch2(t1, t2) => | ||
|} | ||
|} | ||
|""".stripMargin, | ||
filter = _.contains("exhaustive") | ||
) | ||
|
||
if (!isScala211) { | ||
checkEdit( | ||
"exhaustive-sorting-scalalib", | ||
"""package sort | ||
|object App { | ||
| Option(1) matc@@ | ||
|} | ||
|""".stripMargin, | ||
if (!isScala211) | ||
"""package sort | ||
|object App { | ||
| Option(1) match { | ||
|\tcase Some(value) => $0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yay, really excited to finally get the |
||
|\tcase None => | ||
|} | ||
|} | ||
|""".stripMargin | ||
else | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need the else here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops, we don't need it. I meant like this 0d5f96f, thank you for pointing it out :) |
||
"""package sort | ||
|object App { | ||
| Option(1) match { | ||
|\tcase Some(x) => $0 | ||
|\tcase None => | ||
|} | ||
|} | ||
|""".stripMargin, | ||
filter = _.contains("exhaustive") | ||
) | ||
} | ||
|
||
check( | ||
"inner-class", | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clear symbolSearch cache (for dependency sources) on indexing workspace