File tree Expand file tree Collapse file tree 5 files changed +88
-6
lines changed 
src/main/dotty/tools/pc/printer 
test/dotty/tools/pc/tests Expand file tree Collapse file tree 5 files changed +88
-6
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package dotty.tools.pc.printer
33import  scala .collection .mutable 
44import  scala .meta .internal .jdk .CollectionConverters .* 
55import  scala .meta .internal .metals .ReportContext 
6+ import  scala .meta .internal .mtags .KeywordWrapper 
67import  scala .meta .pc .SymbolDocumentation 
78import  scala .meta .pc .SymbolSearch 
89
@@ -64,6 +65,11 @@ class ShortenedTypePrinter(
6465
6566  private  val  foundRenames  =  collection.mutable.LinkedHashMap .empty[Symbol , String ]
6667
68+   override  def  nameString (name : Name ):  String  = 
69+     val  nameStr  =  super .nameString(name)
70+     if  (nameStr.nonEmpty) KeywordWrapper .Scala3Keywords .backtickWrap(nameStr)
71+     else  nameStr
72+ 
6773  def  getUsedRenames :  Map [Symbol , String ] = 
6874    foundRenames.toMap.filter { case  (k, v) =>  k.showName !=  v }
6975
Original file line number Diff line number Diff line change @@ -437,6 +437,7 @@ class CompletionKeywordSuite extends BaseCompletionSuite:
437437         |given 
438438         |extension 
439439         |type 
440+          |opaque type 
440441         |class 
441442         |enum 
442443         |case class 
Original file line number Diff line number Diff line change @@ -1135,7 +1135,7 @@ class CompletionSuite extends BaseCompletionSuite:
11351135          |  scala@@ 
11361136          |} 
11371137          | """ .stripMargin,
1138-       """ |scala <root>
1138+       """ |scala ` <root>` 
11391139         |"""  .stripMargin
11401140    )
11411141
@@ -1725,8 +1725,8 @@ class CompletionSuite extends BaseCompletionSuite:
17251725    check(
17261726      """ |import @@
17271727         |"""  .stripMargin,
1728-       """ |java <root>
1729-          |javax <root> 
1728+       """ |java ` <root>` 
1729+          |javax ` <root>`  
17301730         |"""  .stripMargin,
17311731      filter =  _.startsWith(" java" 
17321732    )
@@ -1744,8 +1744,8 @@ class CompletionSuite extends BaseCompletionSuite:
17441744    check(
17451745      """ |export @@
17461746         |"""  .stripMargin,
1747-       """ |java <root>
1748-          |javax <root> 
1747+       """ |java ` <root>` 
1748+          |javax ` <root>`  
17491749         |"""  .stripMargin,
17501750      filter =  _.startsWith(" java" 
17511751    )
Original file line number Diff line number Diff line change @@ -597,6 +597,78 @@ class InsertInferredTypeSuite extends BaseCodeActionSuite:
597597         |"""  .stripMargin
598598    )
599599
600+   @ Test  def  `backticks-4`  = 
601+   checkEdit(
602+     """ |case class `Foo-Foo`(i: Int)
603+        |object O{ 
604+        |  val <<foo>> = `Foo-Foo`(1) 
605+        |}"""  .stripMargin,
606+     """ |case class `Foo-Foo`(i: Int)
607+        |object O{ 
608+        |  val foo: `Foo-Foo` = `Foo-Foo`(1) 
609+        |} 
610+        |"""  .stripMargin
611+   )
612+ 
613+ 
614+   @ Test  def  `backticks-5`  = 
615+     checkEdit(
616+       """ |object A{
617+          |  case class `Foo-Foo`(i: Int) 
618+          |} 
619+          |object O{ 
620+          |  val <<foo>> = A.`Foo-Foo`(1) 
621+          |}"""  .stripMargin,
622+       """ |import A.`Foo-Foo`
623+          |object A{ 
624+          |  case class `Foo-Foo`(i: Int) 
625+          |} 
626+          |object O{ 
627+          |  val foo: `Foo-Foo` = A.`Foo-Foo`(1) 
628+          |} 
629+          |"""  .stripMargin
630+     )
631+ 
632+ 
633+   @ Test  def  `backticks-6`  = 
634+     checkEdit(
635+       """ |object A{
636+          |  case class `Foo-Foo`[A](i: A) 
637+          |} 
638+          |object O{ 
639+          |  val <<foo>> = A.`Foo-Foo`(1) 
640+          |}"""  .stripMargin,
641+       """ |import A.`Foo-Foo`
642+          |object A{ 
643+          |  case class `Foo-Foo`[A](i: A) 
644+          |} 
645+          |object O{ 
646+          |  val foo: `Foo-Foo`[Int] = A.`Foo-Foo`(1) 
647+          |} 
648+          |"""  .stripMargin
649+     )
650+ 
651+   @ Test  def  `backticks-7`  = 
652+     checkEdit(
653+       """ |object A{
654+          |  class `x-x` 
655+          |  case class Foo[A](i: A) 
656+          |} 
657+          |object O{ 
658+          |  val <<foo>> = A.Foo(new A.`x-x`) 
659+          |}"""  .stripMargin,
660+       """ |import A.Foo
661+          |import A.`x-x` 
662+          |object A{ 
663+          |  class `x-x` 
664+          |  case class Foo[A](i: A) 
665+          |} 
666+          |object O{ 
667+          |  val foo: Foo[`x-x`] = A.Foo(new A.`x-x`) 
668+          |} 
669+          |"""  .stripMargin
670+     )
671+ 
600672  @ Test  def  `literal-types1`  = 
601673    checkEdit(
602674      """ |object O {
Original file line number Diff line number Diff line change @@ -262,6 +262,9 @@ object Build {
262262      //  sbt will complain if we don't exclude them here.
263263      Keys .scalaSource, Keys .javaSource
264264    ),
265+ 
266+     //  This is used to download nightly builds of the Scala 2 library in `scala2-library-bootstrapped`
267+     resolvers +=  " scala-integration" " https://scala-ci.typesafe.com/artifactory/scala-integration/" 
265268  )
266269
267270  lazy  val  disableDocSetting  = 
@@ -1181,7 +1184,7 @@ object Build {
11811184      BuildInfoPlugin .buildInfoDefaultSettings
11821185
11831186  lazy  val  presentationCompilerSettings  =  {
1184-     val  mtagsVersion  =  " 1.3.5 " 
1187+     val  mtagsVersion  =  " 1.4.1 " 
11851188    Seq (
11861189      libraryDependencies ++=  Seq (
11871190        " org.lz4" %  " lz4-java" %  " 1.8.0" 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments