diff --git a/metals/src/main/scala/scala/meta/internal/metals/Compilers.scala b/metals/src/main/scala/scala/meta/internal/metals/Compilers.scala index e885776c562..93ffcd41c1e 100644 --- a/metals/src/main/scala/scala/meta/internal/metals/Compilers.scala +++ b/metals/src/main/scala/scala/meta/internal/metals/Compilers.scala @@ -16,10 +16,12 @@ import scala.util.control.NonFatal import scala.meta.inputs.Input import scala.meta.inputs.Position +import scala.meta.internal.builds.SbtBuildTool import scala.meta.internal.metals.CompilerOffsetParamsUtils import scala.meta.internal.metals.CompilerRangeParamsUtils import scala.meta.internal.metals.Compilers.PresentationCompilerKey import scala.meta.internal.metals.MetalsEnrichments._ +import scala.meta.internal.mtags.MD5 import scala.meta.internal.parsing.Trees import scala.meta.internal.pc.EmptySymbolSearch import scala.meta.internal.pc.JavaPresentationCompiler @@ -28,6 +30,7 @@ import scala.meta.internal.pc.PcSymbolInformation import scala.meta.internal.pc.ScalaPresentationCompiler import scala.meta.internal.worksheets.WorksheetPcData import scala.meta.internal.worksheets.WorksheetProvider +import scala.meta.internal.{semanticdb => s} import scala.meta.io.AbsolutePath import scala.meta.pc.AutoImportsResult import scala.meta.pc.CancelToken @@ -88,7 +91,8 @@ class Compilers( )(implicit ec: ExecutionContextExecutorService, rc: ReportContext) extends Cancelable { val plugins = new CompilerPlugins() - val outlineFilesProvider = new OutlineFilesProvider(buildTargets, buffers) + private val outlineFilesProvider = + new OutlineFilesProvider(buildTargets, buffers) // Not a TrieMap because we want to avoid loading duplicate compilers for the same build target. // Not a `j.u.c.ConcurrentHashMap` because it can deadlock in `computeIfAbsent` when the absent @@ -1486,6 +1490,101 @@ class Compilers( debugItem } + def semanticdbTextDocument( + source: AbsolutePath, + text: String, + ): s.TextDocument = { + val (pc, optBuildTarget) = + loadCompiler(source).getOrElse((fallbackCompiler(source), None)) + + val (prependedLinesSize, modifiedText) = + Option + .when(source.isSbt)( + buildTargets + .sbtAutoImports(source) + ) + .flatten + .fold((0, text))(imports => + (imports.size, SbtBuildTool.prependAutoImports(text, imports)) + ) + + // NOTE(olafur): it's unfortunate that we block on `semanticdbTextDocument` + // here but to avoid it we would need to refactor the `Semanticdbs` trait, + // which requires more effort than it's worth. + val params = new CompilerVirtualFileParams( + source.toURI, + modifiedText, + token = EmptyCancelToken, + outlineFiles = outlineFilesProvider.getOutlineFiles(optBuildTarget), + ) + val bytes = pc + .semanticdbTextDocument(params) + .get( + config.initialConfig.compilers.timeoutDelay, + config.initialConfig.compilers.timeoutUnit, + ) + val textDocument = { + val doc = s.TextDocument.parseFrom(bytes) + if (doc.text.isEmpty()) doc.withText(text) + else doc + } + if (prependedLinesSize > 0) + cleanupAutoImports(textDocument, text, prependedLinesSize) + else textDocument + } + + private def cleanupAutoImports( + document: s.TextDocument, + originalText: String, + linesSize: Int, + ): s.TextDocument = { + + def adjustRange(range: s.Range): Option[s.Range] = { + val nextStartLine = range.startLine - linesSize + val nextEndLine = range.endLine - linesSize + if (nextEndLine >= 0) { + val nextRange = range.copy( + startLine = nextStartLine, + endLine = nextEndLine, + ) + Some(nextRange) + } else None + } + + val adjustedOccurences = + document.occurrences.flatMap { occurence => + occurence.range + .flatMap(adjustRange) + .map(r => occurence.copy(range = Some(r))) + } + + val adjustedDiagnostic = + document.diagnostics.flatMap { diagnostic => + diagnostic.range + .flatMap(adjustRange) + .map(r => diagnostic.copy(range = Some(r))) + } + + val adjustedSynthetic = + document.synthetics.flatMap { synthetic => + synthetic.range + .flatMap(adjustRange) + .map(r => synthetic.copy(range = Some(r))) + } + + s.TextDocument( + schema = document.schema, + uri = document.uri, + text = originalText, + md5 = MD5.compute(originalText), + language = document.language, + symbols = document.symbols, + occurrences = adjustedOccurences, + diagnostics = adjustedDiagnostic, + synthetics = adjustedSynthetic, + ) + } + } object Compilers { diff --git a/metals/src/main/scala/scala/meta/internal/metals/InteractiveSemanticdbs.scala b/metals/src/main/scala/scala/meta/internal/metals/InteractiveSemanticdbs.scala index b99551fe44c..c9753281523 100644 --- a/metals/src/main/scala/scala/meta/internal/metals/InteractiveSemanticdbs.scala +++ b/metals/src/main/scala/scala/meta/internal/metals/InteractiveSemanticdbs.scala @@ -6,7 +6,6 @@ import java.util.Collections import scala.util.Success import scala.util.Try -import scala.meta.internal.builds.SbtBuildTool import scala.meta.internal.metals.MetalsEnrichments._ import scala.meta.internal.mtags.MD5 import scala.meta.internal.mtags.Semanticdbs @@ -139,120 +138,7 @@ final class InteractiveSemanticdbs( javaInteractiveSemanticdb.fold(s.TextDocument())( _.textDocument(source, text) ) - else scalaCompile(source, text) - } - - private def scalaCompile( - source: AbsolutePath, - text: String, - ): s.TextDocument = { - def worksheetCompiler = - if (source.isWorksheet) compilers().loadWorksheetCompiler(source) - else None - def fromTarget = for { - buildTarget <- buildTargets.inverseSources(source) - pc <- compilers().loadCompiler(buildTarget) - } yield (pc, Some(buildTarget)) - - val (pc, optBuildTarget) = worksheetCompiler - .map((_, None)) - .orElse(fromTarget) - .orElse { - // load presentation compiler for sources that were create by a worksheet definition request - tables.worksheetSources - .getWorksheet(source) - .flatMap(compilers().loadWorksheetCompiler) - .map((_, None)) - } - .getOrElse((compilers().fallbackCompiler(source), None)) - - val (prependedLinesSize, modifiedText) = - Option - .when(source.isSbt)( - buildTargets - .sbtAutoImports(source) - ) - .flatten - .fold((0, text))(imports => - (imports.size, SbtBuildTool.prependAutoImports(text, imports)) - ) - - // NOTE(olafur): it's unfortunate that we block on `semanticdbTextDocument` - // here but to avoid it we would need to refactor the `Semanticdbs` trait, - // which requires more effort than it's worth. - val params = new CompilerVirtualFileParams( - source.toURI, - modifiedText, - token = EmptyCancelToken, - outlineFiles = - compilers().outlineFilesProvider.getOutlineFiles(optBuildTarget), - ) - val bytes = pc - .semanticdbTextDocument(params) - .get( - clientConfig.initialConfig.compilers.timeoutDelay, - clientConfig.initialConfig.compilers.timeoutUnit, - ) - val textDocument = { - val doc = s.TextDocument.parseFrom(bytes) - if (doc.text.isEmpty()) doc.withText(text) - else doc - } - if (prependedLinesSize > 0) - cleanupAutoImports(textDocument, text, prependedLinesSize) - else textDocument - } - - private def cleanupAutoImports( - document: s.TextDocument, - originalText: String, - linesSize: Int, - ): s.TextDocument = { - - def adjustRange(range: s.Range): Option[s.Range] = { - val nextStartLine = range.startLine - linesSize - val nextEndLine = range.endLine - linesSize - if (nextEndLine >= 0) { - val nextRange = range.copy( - startLine = nextStartLine, - endLine = nextEndLine, - ) - Some(nextRange) - } else None - } - - val adjustedOccurences = - document.occurrences.flatMap { occurence => - occurence.range - .flatMap(adjustRange) - .map(r => occurence.copy(range = Some(r))) - } - - val adjustedDiagnostic = - document.diagnostics.flatMap { diagnostic => - diagnostic.range - .flatMap(adjustRange) - .map(r => diagnostic.copy(range = Some(r))) - } - - val adjustedSynthetic = - document.synthetics.flatMap { synthetic => - synthetic.range - .flatMap(adjustRange) - .map(r => synthetic.copy(range = Some(r))) - } - - s.TextDocument( - schema = document.schema, - uri = document.uri, - text = originalText, - md5 = MD5.compute(originalText), - language = document.language, - symbols = document.symbols, - occurrences = adjustedOccurences, - diagnostics = adjustedDiagnostic, - synthetics = adjustedSynthetic, - ) + else compilers().semanticdbTextDocument(source, text) } } diff --git a/metals/src/main/scala/scala/meta/internal/metals/OutlineFilesProvider.scala b/metals/src/main/scala/scala/meta/internal/metals/OutlineFilesProvider.scala index e9ec7cdec5a..8a2c7b4ec0e 100644 --- a/metals/src/main/scala/scala/meta/internal/metals/OutlineFilesProvider.scala +++ b/metals/src/main/scala/scala/meta/internal/metals/OutlineFilesProvider.scala @@ -93,18 +93,8 @@ class OutlineFilesProvider( def enrichWithOutlineFiles( path: AbsolutePath - )(vFile: CompilerVirtualFileParams): CompilerVirtualFileParams = { - val optOutlineFiles = - for { - bt <- buildTargets.inferBuildTarget(path) - provider <- outlineFiles.get(bt) - outlineFiles <- provider.outlineFiles() - } yield outlineFiles - - optOutlineFiles - .map(outlineFiles => vFile.copy(outlineFiles = Optional.of(outlineFiles))) - .getOrElse(vFile) - } + )(vFile: CompilerVirtualFileParams): CompilerVirtualFileParams = + enrichWithOutlineFiles(buildTargets.inferBuildTarget(path))(vFile) def clear(): Unit = { outlineFiles.clear() diff --git a/mtags/src/main/scala-2.11/scala/meta/internal/pc/Compat.scala b/mtags/src/main/scala-2.11/scala/meta/internal/pc/Compat.scala index e4e177109fc..b3b68c9534e 100644 --- a/mtags/src/main/scala-2.11/scala/meta/internal/pc/Compat.scala +++ b/mtags/src/main/scala-2.11/scala/meta/internal/pc/Compat.scala @@ -3,8 +3,6 @@ package scala.meta.internal.pc import scala.tools.nsc.reporters.Reporter import scala.tools.nsc.reporters.StoreReporter -import scala.meta.pc.OutlineFiles - trait Compat { this: MetalsGlobal => def metalsFunctionArgTypes(tpe: Type): List[Type] = { val dealiased = tpe.dealiasWiden @@ -21,8 +19,4 @@ trait Compat { this: MetalsGlobal => def isAliasCompletion(m: Member): Boolean = false def constantType(c: ConstantType): ConstantType = c - - def runOutline(files: OutlineFiles): Unit = { - // no outline compilation for 2.11 - } } diff --git a/mtags/src/main/scala-2.11/scala/meta/internal/pc/Outline.scala b/mtags/src/main/scala-2.11/scala/meta/internal/pc/Outline.scala new file mode 100644 index 00000000000..67d16f13761 --- /dev/null +++ b/mtags/src/main/scala-2.11/scala/meta/internal/pc/Outline.scala @@ -0,0 +1,9 @@ +package scala.meta.internal.pc + +import scala.meta.pc.OutlineFiles + +trait Outline { this: MetalsGlobal => + def runOutline(files: OutlineFiles): Unit = { + // no outline compilation for 2.11 + } +} diff --git a/mtags/src/main/scala-2.12/scala/meta/internal/pc/Compat.scala b/mtags/src/main/scala-2.12/scala/meta/internal/pc/Compat.scala index 8532ab9e00d..da02d75b0f9 100644 --- a/mtags/src/main/scala-2.12/scala/meta/internal/pc/Compat.scala +++ b/mtags/src/main/scala-2.12/scala/meta/internal/pc/Compat.scala @@ -1,14 +1,8 @@ package scala.meta.internal.pc -import java.{util => ju} - -import scala.reflect.internal.Reporter +import scala.tools.nsc.reporters.Reporter import scala.tools.nsc.reporters.StoreReporter -import scala.meta.internal.jdk.CollectionConverters._ -import scala.meta.pc.OutlineFiles -import scala.meta.pc.VirtualFileParams - trait Compat { this: MetalsGlobal => def metalsFunctionArgTypes(tpe: Type): List[Type] = definitions.functionOrSamArgTypes(tpe) @@ -22,33 +16,4 @@ trait Compat { this: MetalsGlobal => def isAliasCompletion(m: Member): Boolean = false def constantType(c: ConstantType): ConstantType = c - - def runOutline(files: OutlineFiles): Unit = { - this.settings.Youtline.value = true - runOutline(files.files) - if (files.isFirstCompileSubstitute()) { - // if first compilation substitute we compile all files twice - // first to emit symbols, second so signatures have information about those symbols - // this isn't a perfect strategy but much better than single compile - runOutline(files.files, forceNewUnit = true) - } - this.settings.Youtline.value = false - } - - private def runOutline( - files: ju.List[VirtualFileParams], - forceNewUnit: Boolean = false - ): Unit = { - files.asScala.foreach { params => - val unit = this.addCompilationUnit( - params.text(), - params.uri.toString(), - cursor = None, - isOutline = true, - forceNew = forceNewUnit - ) - this.typeCheck(unit) - this.richCompilationCache.put(params.uri().toString(), unit) - } - } } diff --git a/mtags/src/main/scala-2.12/scala/meta/internal/pc/Outline.scala b/mtags/src/main/scala-2.12/scala/meta/internal/pc/Outline.scala new file mode 100644 index 00000000000..a53f3fabe8f --- /dev/null +++ b/mtags/src/main/scala-2.12/scala/meta/internal/pc/Outline.scala @@ -0,0 +1,38 @@ +package scala.meta.internal.pc + +import java.{util => ju} + +import scala.meta.internal.jdk.CollectionConverters._ +import scala.meta.pc.OutlineFiles +import scala.meta.pc.VirtualFileParams + +trait Outline { this: MetalsGlobal => + def runOutline(files: OutlineFiles): Unit = { + this.settings.Youtline.value = true + runOutline(files.files) + if (files.isFirstCompileSubstitute()) { + // if first compilation substitute we compile all files twice + // first to emit symbols, second so signatures have information about those symbols + // this isn't a perfect strategy but much better than single compile + runOutline(files.files, forceNewUnit = true) + } + this.settings.Youtline.value = false + } + + private def runOutline( + files: ju.List[VirtualFileParams], + forceNewUnit: Boolean = false + ): Unit = { + files.asScala.foreach { params => + val unit = this.addCompilationUnit( + params.text(), + params.uri.toString(), + cursor = None, + isOutline = true, + forceNew = forceNewUnit + ) + this.typeCheck(unit) + this.richCompilationCache.put(params.uri().toString(), unit) + } + } +} diff --git a/mtags/src/main/scala-2.13.5/meta/internal/pc/Compat.scala b/mtags/src/main/scala-2.13.5/meta/internal/pc/Compat.scala index 5f2527b504d..e492071a947 100644 --- a/mtags/src/main/scala-2.13.5/meta/internal/pc/Compat.scala +++ b/mtags/src/main/scala-2.13.5/meta/internal/pc/Compat.scala @@ -1,14 +1,8 @@ package scala.meta.internal.pc -import java.{util => ju} - import scala.reflect.internal.Reporter import scala.tools.nsc.reporters.StoreReporter -import scala.meta.internal.jdk.CollectionConverters._ -import scala.meta.pc.OutlineFiles -import scala.meta.pc.VirtualFileParams - trait Compat { this: MetalsGlobal => def metalsFunctionArgTypes(tpe: Type): List[Type] = definitions.functionOrPfOrSamArgTypes(tpe) @@ -26,32 +20,4 @@ trait Compat { this: MetalsGlobal => def constantType(c: ConstantType): ConstantType = if (c.value.isSuitableLiteralType) LiteralType(c.value) else c - def runOutline(files: OutlineFiles): Unit = { - this.settings.Youtline.value = true - runOutline(files.files) - if (files.isFirstCompileSubstitute()) { - // if first compilation substitute we compile all files twice - // first to emit symbols, second so signatures have information about those symbols - // this isn't a perfect strategy but much better than single compile - runOutline(files.files, forceNewUnit = true) - } - this.settings.Youtline.value = false - } - - private def runOutline( - files: ju.List[VirtualFileParams], - forceNewUnit: Boolean = false - ): Unit = { - files.asScala.foreach { params => - val unit = this.addCompilationUnit( - params.text(), - params.uri.toString(), - cursor = None, - isOutline = true, - forceNew = forceNewUnit - ) - this.typeCheck(unit) - this.richCompilationCache.put(params.uri().toString(), unit) - } - } } diff --git a/mtags/src/main/scala-2.13.6/meta/internal/pc/Compat.scala b/mtags/src/main/scala-2.13.6/meta/internal/pc/Compat.scala index 5f2527b504d..988bd8f2db8 100644 --- a/mtags/src/main/scala-2.13.6/meta/internal/pc/Compat.scala +++ b/mtags/src/main/scala-2.13.6/meta/internal/pc/Compat.scala @@ -1,14 +1,8 @@ package scala.meta.internal.pc -import java.{util => ju} - import scala.reflect.internal.Reporter import scala.tools.nsc.reporters.StoreReporter -import scala.meta.internal.jdk.CollectionConverters._ -import scala.meta.pc.OutlineFiles -import scala.meta.pc.VirtualFileParams - trait Compat { this: MetalsGlobal => def metalsFunctionArgTypes(tpe: Type): List[Type] = definitions.functionOrPfOrSamArgTypes(tpe) @@ -25,33 +19,4 @@ trait Compat { this: MetalsGlobal => def constantType(c: ConstantType): ConstantType = if (c.value.isSuitableLiteralType) LiteralType(c.value) else c - - def runOutline(files: OutlineFiles): Unit = { - this.settings.Youtline.value = true - runOutline(files.files) - if (files.isFirstCompileSubstitute()) { - // if first compilation substitute we compile all files twice - // first to emit symbols, second so signatures have information about those symbols - // this isn't a perfect strategy but much better than single compile - runOutline(files.files, forceNewUnit = true) - } - this.settings.Youtline.value = false - } - - private def runOutline( - files: ju.List[VirtualFileParams], - forceNewUnit: Boolean = false - ): Unit = { - files.asScala.foreach { params => - val unit = this.addCompilationUnit( - params.text(), - params.uri.toString(), - cursor = None, - isOutline = true, - forceNew = forceNewUnit - ) - this.typeCheck(unit) - this.richCompilationCache.put(params.uri().toString(), unit) - } - } } diff --git a/mtags/src/main/scala-2.13.7/meta/internal/pc/Compat.scala b/mtags/src/main/scala-2.13.7/meta/internal/pc/Compat.scala index 1d941c7ebc2..e492071a947 100644 --- a/mtags/src/main/scala-2.13.7/meta/internal/pc/Compat.scala +++ b/mtags/src/main/scala-2.13.7/meta/internal/pc/Compat.scala @@ -1,14 +1,8 @@ package scala.meta.internal.pc -import java.{util => ju} - import scala.reflect.internal.Reporter import scala.tools.nsc.reporters.StoreReporter -import scala.meta.internal.jdk.CollectionConverters._ -import scala.meta.pc.OutlineFiles -import scala.meta.pc.VirtualFileParams - trait Compat { this: MetalsGlobal => def metalsFunctionArgTypes(tpe: Type): List[Type] = definitions.functionOrPfOrSamArgTypes(tpe) @@ -26,33 +20,4 @@ trait Compat { this: MetalsGlobal => def constantType(c: ConstantType): ConstantType = if (c.value.isSuitableLiteralType) LiteralType(c.value) else c - def runOutline(files: OutlineFiles): Unit = { - this.settings.Youtline.value = true - runOutline(files.files) - if (files.isFirstCompileSubstitute()) { - // if first compilation substitute we compile all files twice - // first to emit symbols, second so signatures have information about those symbols - // this isn't a perfect strategy but much better than single compile - runOutline(files.files, forceNewUnit = true) - } - this.settings.Youtline.value = false - } - - private def runOutline( - files: ju.List[VirtualFileParams], - forceNewUnit: Boolean = false - ): Unit = { - files.asScala.foreach { params => - val unit = this.addCompilationUnit( - params.text(), - params.uri.toString(), - cursor = None, - isOutline = true, - forceNew = forceNewUnit - ) - this.typeCheck(unit) - this.richCompilationCache.put(params.uri().toString(), unit) - } - } - } diff --git a/mtags/src/main/scala-2.13/scala/meta/internal/pc/Compat.scala b/mtags/src/main/scala-2.13/scala/meta/internal/pc/Compat.scala index 0b4fe757b10..a4eeed4b00c 100644 --- a/mtags/src/main/scala-2.13/scala/meta/internal/pc/Compat.scala +++ b/mtags/src/main/scala-2.13/scala/meta/internal/pc/Compat.scala @@ -1,14 +1,8 @@ package scala.meta.internal.pc -import java.{util => ju} - import scala.reflect.internal.Reporter import scala.tools.nsc.reporters.StoreReporter -import scala.meta.internal.jdk.CollectionConverters._ -import scala.meta.pc.OutlineFiles -import scala.meta.pc.VirtualFileParams - trait Compat { this: MetalsGlobal => def metalsFunctionArgTypes(tpe: Type): List[Type] = definitions.functionOrPfOrSamArgTypes(tpe) @@ -29,33 +23,4 @@ trait Compat { this: MetalsGlobal => def constantType(c: ConstantType): ConstantType = if (c.value.isSuitableLiteralType) LiteralType(c.value) else c - - def runOutline(files: OutlineFiles): Unit = { - this.settings.Youtline.value = true - runOutline(files.files) - if (files.isFirstCompileSubstitute()) { - // if first compilation substitute we compile all files twice - // first to emit symbols, second so signatures have information about those symbols - // this isn't a perfect strategy but much better than single compile - runOutline(files.files, forceNewUnit = true) - } - this.settings.Youtline.value = false - } - - private def runOutline( - files: ju.List[VirtualFileParams], - forceNewUnit: Boolean = false - ): Unit = { - files.asScala.foreach { params => - val unit = this.addCompilationUnit( - params.text(), - params.uri.toString(), - cursor = None, - isOutline = true, - forceNew = forceNewUnit - ) - this.typeCheck(unit) - this.richCompilationCache.put(params.uri().toString(), unit) - } - } } diff --git a/mtags/src/main/scala-2.13/scala/meta/internal/pc/Outline.scala b/mtags/src/main/scala-2.13/scala/meta/internal/pc/Outline.scala new file mode 100644 index 00000000000..a53f3fabe8f --- /dev/null +++ b/mtags/src/main/scala-2.13/scala/meta/internal/pc/Outline.scala @@ -0,0 +1,38 @@ +package scala.meta.internal.pc + +import java.{util => ju} + +import scala.meta.internal.jdk.CollectionConverters._ +import scala.meta.pc.OutlineFiles +import scala.meta.pc.VirtualFileParams + +trait Outline { this: MetalsGlobal => + def runOutline(files: OutlineFiles): Unit = { + this.settings.Youtline.value = true + runOutline(files.files) + if (files.isFirstCompileSubstitute()) { + // if first compilation substitute we compile all files twice + // first to emit symbols, second so signatures have information about those symbols + // this isn't a perfect strategy but much better than single compile + runOutline(files.files, forceNewUnit = true) + } + this.settings.Youtline.value = false + } + + private def runOutline( + files: ju.List[VirtualFileParams], + forceNewUnit: Boolean = false + ): Unit = { + files.asScala.foreach { params => + val unit = this.addCompilationUnit( + params.text(), + params.uri.toString(), + cursor = None, + isOutline = true, + forceNew = forceNewUnit + ) + this.typeCheck(unit) + this.richCompilationCache.put(params.uri().toString(), unit) + } + } +} diff --git a/mtags/src/main/scala-2/scala/meta/internal/pc/MetalsGlobal.scala b/mtags/src/main/scala-2/scala/meta/internal/pc/MetalsGlobal.scala index 2d2e8c368b6..749bcd142b5 100644 --- a/mtags/src/main/scala-2/scala/meta/internal/pc/MetalsGlobal.scala +++ b/mtags/src/main/scala-2/scala/meta/internal/pc/MetalsGlobal.scala @@ -61,7 +61,8 @@ class MetalsGlobal( with GlobalProxy with AutoImports with Keywords - with WorkspaceSymbolSearch { compiler => + with WorkspaceSymbolSearch + with Outline { compiler => hijackPresentationCompilerThread() val logger: Logger = Logger.getLogger(classOf[MetalsGlobal].getName) diff --git a/tests/unit/src/test/scala/tests/CompilersLspSuite.scala b/tests/unit/src/test/scala/tests/CompilersLspSuite.scala index da4b1c70214..5d4cc8bb33c 100644 --- a/tests/unit/src/test/scala/tests/CompilersLspSuite.scala +++ b/tests/unit/src/test/scala/tests/CompilersLspSuite.scala @@ -228,7 +228,7 @@ class CompilersLspSuite extends BaseCompletionLspSuite("compilers") { } yield () } - test("never-compiling-reverse-order") { + test("never-compiling2") { cleanWorkspace() for { _ <- initialize( @@ -259,8 +259,6 @@ class CompilersLspSuite extends BaseCompletionLspSuite("compilers") { |} |""".stripMargin ) - _ <- server.didOpen("a/src/main/scala/a/A.scala") - _ <- server.didOpen("a/src/main/scala/b/B.scala") _ <- server.didOpen("a/src/main/scala/c/C.scala") _ = assertNoDiff( server.client.workspaceDiagnostics, @@ -285,7 +283,7 @@ class CompilersLspSuite extends BaseCompletionLspSuite("compilers") { } yield () } - test("never-compiling2") { + test("never-compiling-reverse-order") { cleanWorkspace() for { _ <- initialize( @@ -317,8 +315,6 @@ class CompilersLspSuite extends BaseCompletionLspSuite("compilers") { |} |""".stripMargin ) - _ <- server.didOpen("a/src/main/scala/a/A.scala") - _ <- server.didOpen("a/src/main/scala/b/B.scala") _ <- server.didOpen("a/src/main/scala/c/C.scala") _ = assertNoDiff( server.client.workspaceDiagnostics,