Skip to content

Commit

Permalink
Backport "fix: don't add suffix if brackets already present" to 3.5.2 (
Browse files Browse the repository at this point in the history
…#21461)

Backports #21259 to the 3.5.2 branch.

PR submitted by the release tooling.
[skip ci]
  • Loading branch information
WojciechMazur authored Aug 27, 2024
2 parents 1249c73 + fe42316 commit 1530c63
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ class Completions(
*/
case (fun) :: (appl: GenericApply) :: _ if appl.fun == fun =>
false
/* In case of `T@@[]` we should not add snippets.
*/
case tpe :: (appl: AppliedTypeTree) :: _ if appl.tpt == tpe =>
false
case _ :: (withcursor @ Select(fun, name)) :: (appl: GenericApply) :: _
if appl.fun == withcursor && name.decoded == Cursor.value =>
false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,3 +451,34 @@ class CompletionSnippetSuite extends BaseCompletionSuite:
""".stripMargin,
filter = _.contains("bar: Int")
)

@Test def `brackets-already-present` =
check(
"""|package a
|case class AAA[T]()
|object O {
| val l: AA@@[Int] = ???
|}
|""".stripMargin,
"""|AAA a
|ArrowAssoc scala.Predef
|""".stripMargin,
)

@Test def `brackets-already-present-edit` =
checkEdit(
"""|package a
|case class AAA[T]()
|object O {
| val l: AA@@[Int] = ???
|}
|""".stripMargin,
"""|package a
|case class AAA[T]()
|object O {
| val l: AAA[Int] = ???
|}
|""".stripMargin,
assertSingleItem = false,
)

0 comments on commit 1530c63

Please sign in to comment.