Skip to content

Commit

Permalink
fixes after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
kasiaMarek committed Nov 21, 2023
1 parent 93afe40 commit 83436ad
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
10 changes: 9 additions & 1 deletion metals-bench/src/main/scala/bench/MetalsBench.scala
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,15 @@ class MetalsBench {
@Benchmark
@BenchmarkMode(Array(Mode.SingleShotTime))
def typeHierarchyIndex(): Unit = {
scalaDependencySources.inputs.foreach { Mtags.indexWithOverrides(_) }
scalaDependencySources.inputs.foreach { input =>
implicit val rc: ReportContext = EmptyReportContext
new ScalaToplevelMtags(
input,
includeInnerClasses = true,
includeMembers = false,
dialects.Scala213,
).index()
}
}

@Benchmark
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import scala.util.control.NonFatal

import scala.meta.inputs.Input
import scala.meta.internal.io.FileIO
import scala.meta.internal.metals.Buffers
import scala.meta.internal.metals.BuildTargets
Expand Down Expand Up @@ -417,9 +416,8 @@ final class ImplementationProvider(

private def semanticdbForJarFile(fileSource: AbsolutePath) = {
val dialect = ScalaVersions.dialectForDependencyJar(fileSource.filename)
val text = FileIO.slurp(fileSource, StandardCharsets.UTF_8)
val input = Input.VirtualFile(fileSource.toURI.toString(), text)
val textDocument = Mtags.index(input, dialect)
FileIO.slurp(fileSource, StandardCharsets.UTF_8)
val textDocument = Mtags.index(fileSource, dialect)
textDocument
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ class SymbolIndexBucket(
}

def addSourceFile(
source: AbsolutePath,
sourceDirectory: Option[AbsolutePath],
source: AbsolutePath,
sourceDirectory: Option[AbsolutePath]
): Option[IndexingResult] = {
val IndexingResult(path, topLevels, overrides) = indexSource(source, dialect, sourceDirectory)
val IndexingResult(path, topLevels, overrides) =
indexSource(source, dialect, sourceDirectory)
topLevels.foreach { symbol =>
val acc = toplevels.getOrElse(symbol, Set.empty)
toplevels(symbol) = acc + source
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ class DelegatingGlobalSymbolIndex(
def addSourceFile(
file: AbsolutePath,
sourceDirectory: Option[AbsolutePath],
dialect: Dialect,
dialect: Dialect
): Option[mtags.IndexingResult] = {
underlying.addSourceFile(file, sourceDirectory, dialect)
}
def addSourceJar(
jar: AbsolutePath,
dialect: Dialect,
dialect: Dialect
): List[mtags.IndexingResult] = {
underlying.addSourceJar(jar, dialect)
}
def addSourceDirectory(
dir: AbsolutePath,
dialect: Dialect,
dialect: Dialect
): List[mtags.IndexingResult] = {
underlying.addSourceDirectory(dir, dialect)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/src/test/scala/tests/ToplevelLibrarySuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ToplevelLibrarySuite extends BaseSuite {
assertNoDiff(
obtained.mkString("\n"),
expected.mkString("\n"),
s"${input.text}",
s"${input.path}",
)
}

Expand Down

0 comments on commit 83436ad

Please sign in to comment.