-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Respect client capabilities for completion item snippets (#1057)
Respect client capabilities for completion item snippets
- Loading branch information
Showing
9 changed files
with
149 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
tests/cross/src/test/scala/tests/pc/CompletionSnippetNegSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package tests.pc | ||
|
||
import tests.BaseCompletionSuite | ||
import scala.meta.pc.PresentationCompilerConfig | ||
import scala.meta.internal.pc.PresentationCompilerConfigImpl | ||
|
||
object CompletionSnippetNegSuite extends BaseCompletionSuite { | ||
|
||
override def config: PresentationCompilerConfig = | ||
PresentationCompilerConfigImpl( | ||
isCompletionSnippetsEnabled = false | ||
) | ||
|
||
checkSnippet( | ||
"member", | ||
""" | ||
|object Main { | ||
| List.appl@@ | ||
|} | ||
|""".stripMargin, | ||
"""|apply | ||
|unapplySeq | ||
|""".stripMargin, | ||
compat = Map( | ||
"2.13" -> | ||
// the second apply is from scala/collection/BuildFrom#apply(), introduced in 2.13 | ||
"""|apply | ||
|unapplySeq | ||
|apply | ||
|""".stripMargin | ||
) | ||
) | ||
|
||
checkSnippet( | ||
"scope", | ||
""" | ||
|object Main { | ||
| printl@@ | ||
| | ||
|} | ||
|""".stripMargin, | ||
"""|println() | ||
|println | ||
|""".stripMargin | ||
) | ||
|
||
checkSnippet( | ||
"java-nullary", | ||
""" | ||
|class Foo { | ||
| override def toString = "Foo" | ||
|} | ||
|object Main { | ||
| new Foo().toStrin@@ | ||
| | ||
|} | ||
|""".stripMargin, | ||
// even if `Foo.toString` is nullary, it overrides `Object.toString()` | ||
// which is a Java non-nullary method with an empty parameter list. | ||
"""|toString() | ||
|""".stripMargin | ||
) | ||
|
||
checkSnippet( | ||
"type", | ||
s"""|object Main { | ||
| val x: scala.IndexedSe@@ | ||
|} | ||
|""".stripMargin, | ||
// It's expected to have two separate results, one for `object IndexedSeq` and one for `type IndexedSeq[T]`. | ||
"""|IndexedSeq | ||
|IndexedSeq | ||
|""".stripMargin | ||
) | ||
|
||
} |