Skip to content

Commit

Permalink
Add compat for 3.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kasiaMarek authored and tgodzik committed Sep 9, 2024
1 parent 5e36b7b commit 362fce5
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 3 deletions.
6 changes: 6 additions & 0 deletions mtags/src/main/scala-3.2/scala/meta/internal/pc/Compat.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
package scala.meta.internal.pc

import dotty.tools.dotc.CompilationUnit
import dotty.tools.dotc.core.Comments.Comment

object Compat:
val EvidenceParamName = dotty.tools.dotc.core.NameKinds.EvidenceParamName

extension (unit: CompilationUnit)
def getComments(): List[Comment] = Nil
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
package scala.meta.internal.pc

import dotty.tools.dotc.CompilationUnit
import dotty.tools.dotc.core.Comments.Comment

object Compat:
val EvidenceParamName = dotty.tools.dotc.core.NameKinds.EvidenceParamName
extension (unit: CompilationUnit)
def getComments(): List[Comment] = Nil
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
package scala.meta.internal.pc

import dotty.tools.dotc.CompilationUnit
import dotty.tools.dotc.core.Comments.Comment

object Compat:
val EvidenceParamName = dotty.tools.dotc.core.NameKinds.ContextBoundParamName
extension (unit: CompilationUnit)
def getComments(): List[Comment] = unit.comments
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
package scala.meta.internal.pc

import dotty.tools.dotc.CompilationUnit
import dotty.tools.dotc.core.Comments.Comment

object Compat:
val EvidenceParamName = dotty.tools.dotc.core.NameKinds.ContextBoundParamName
extension (unit: CompilationUnit)
def getComments(): List[Comment] = unit.comments
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import scala.meta.internal.metals.ReportContext
import scala.meta.internal.mtags.MtagsEnrichments.*
import scala.meta.internal.pc.AutoImports.AutoImportEdits
import scala.meta.internal.pc.AutoImports.AutoImportsGenerator
import scala.meta.internal.pc.Compat.*
import scala.meta.internal.pc.printer.MetalsPrinter
import scala.meta.pc.CompletionItemPriority
import scala.meta.pc.OffsetParams
Expand Down Expand Up @@ -86,7 +87,7 @@ class CompletionProvider(
autoImportsGen,
driver.settings,
referenceCounter,
unit.comments
unit.getComments()
).completions()

val items = completions.zipWithIndex.map { case (item, idx) =>
Expand Down
18 changes: 16 additions & 2 deletions tests/cross/src/test/scala/tests/pc/CompletionKeywordSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@ class CompletionKeywordSuite extends BaseCompletionSuite {
| // tr@@
|}
|""".stripMargin,
""
"",
compat = Map(
"3" -> """|transient scala
|transparentTrait(): transparentTrait
|transparentTrait - scala.annotation
|""".stripMargin,
">=3.3.2" -> ""
)
)

check(
Expand All @@ -54,7 +61,14 @@ class CompletionKeywordSuite extends BaseCompletionSuite {
| **/
|}
|""".stripMargin,
""
"",
compat = Map(
"3" -> """|transient scala
|transparentTrait(): transparentTrait
|transparentTrait - scala.annotation
|""".stripMargin,
">=3.3.2" -> ""
)
)

check(
Expand Down

0 comments on commit 362fce5

Please sign in to comment.