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 committed Aug 23, 2024
1 parent fa0a35b commit 2a90dab
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 deletions.
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
16 changes: 14 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,13 @@ class CompletionKeywordSuite extends BaseCompletionSuite {
| // tr@@
|}
|""".stripMargin,
""
"",
compat = Map(
"3.3.1" -> """|transient scala
|transparentTrait(): transparentTrait
|transparentTrait - scala.annotation
|""".stripMargin
)
)

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

check(
Expand Down

0 comments on commit 2a90dab

Please sign in to comment.