Skip to content

Commit

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

Backports #21259 to the 3.3.5.

PR submitted by the release tooling.
[skip ci]
  • Loading branch information
WojciechMazur authored Dec 3, 2024
2 parents 0b24d81 + a975681 commit 50f9b55
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 50f9b55

Please sign in to comment.