File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
src/main/dotty/tools/pc/completions
test/dotty/tools/pc/tests/completion Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,10 @@ class Completions(
6565 */
6666 case (fun) :: (appl : GenericApply ) :: _ if appl.fun == fun =>
6767 false
68+ /* In case of `T@@[]` we should not add snippets.
69+ */
70+ case tpe :: (appl : AppliedTypeTree ) :: _ if appl.tpt == tpe =>
71+ false
6872 case _ :: (withcursor @ Select (fun, name)) :: (appl : GenericApply ) :: _
6973 if appl.fun == withcursor && name.decoded == Cursor .value =>
7074 false
Original file line number Diff line number Diff line change @@ -451,3 +451,34 @@ class CompletionSnippetSuite extends BaseCompletionSuite:
451451 """ .stripMargin,
452452 filter = _.contains(" bar: Int" )
453453 )
454+
455+ @ Test def `brackets-already-present` =
456+ check(
457+ """ |package a
458+ |case class AAA[T]()
459+ |object O {
460+ | val l: AA@@[Int] = ???
461+ |}
462+ |""" .stripMargin,
463+ """ |AAA a
464+ |ArrowAssoc scala.Predef
465+ |""" .stripMargin,
466+ )
467+
468+ @ Test def `brackets-already-present-edit` =
469+ checkEdit(
470+ """ |package a
471+ |case class AAA[T]()
472+ |object O {
473+ | val l: AA@@[Int] = ???
474+ |}
475+ |""" .stripMargin,
476+ """ |package a
477+ |case class AAA[T]()
478+ |object O {
479+ | val l: AAA[Int] = ???
480+ |}
481+ |""" .stripMargin,
482+ assertSingleItem = false ,
483+ )
484+
You can’t perform that action at this time.
0 commit comments