Skip to content

Commit 2ae438d

Browse files
smarterbishabosha
authored andcommitted
Compile the language server with the 2.13 stdlib
No cross-compilation needed since it's a bootstrapped-only project.
1 parent 1ac18ba commit 2ae438d

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

language-server/src/dotty/tools/languageserver/DottyLanguageServer.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,9 @@ class DottyLanguageServer extends LanguageServer
432432

433433
val changes =
434434
refs.groupBy(ref => toUriOption(ref.source))
435-
.flatMap((uriOpt, ref) => uriOpt.map(uri => (uri.toString, ref)))
436-
.mapValues(refs =>
437-
refs.flatMap(ref =>
438-
range(ref.namePos).map(nameRange => new TextEdit(nameRange, newName))).distinct.asJava)
435+
.flatMap { case (uriOpt, refs) => uriOpt.map(uri => (uri.toString, refs)) }
436+
.transform((_, refs) => refs.flatMap(ref =>
437+
range(ref.namePos).map(nameRange => new TextEdit(nameRange, newName))).distinct.asJava)
439438

440439
new WorkspaceEdit(changes.asJava)
441440
}
@@ -584,7 +583,7 @@ class DottyLanguageServer extends LanguageServer
584583
definition <- definitions.toSet
585584
uri <- toUriOption(definition.pos.source).toSet
586585
config = configFor(uri)
587-
project <- dependentProjects(config) + config
586+
project <- dependentProjects(config) union Set(config)
588587
} yield project
589588
}
590589
}

language-server/test/dotty/tools/languageserver/util/actions/CodeRename.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ class CodeRename(override val marker: CodeMarker,
4848

4949
val results = query.get()
5050

51-
val changes = results.getChanges.asScala.mapValues(_.asScala.toSet.map(ch => (ch.getNewText, ch.getRange)))
52-
val expectedChanges = expected.groupBy(_.file.uri).mapValues(_.map(range => (newName, range.toRange)))
51+
val changes = results.getChanges.asScala.view.mapValues(_.asScala.toSet.map(ch => (ch.getNewText, ch.getRange))).toMap
52+
val expectedChanges = expected.groupBy(_.file.uri).view.mapValues(_.map(range => (newName, range.toRange))).toMap
5353

5454
assertNull(results.getDocumentChanges)
5555
assertEquals(expectedChanges, changes)

language-server/test/dotty/tools/languageserver/util/actions/Implementation.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Implementation(override val range: CodeRange, expected: List[CodeRange]) e
2323

2424
override def onMarker(marker: CodeMarker): Exec[Unit] = {
2525
val expectedLocations = expected.map(_.toLocation)
26-
val results: Seq[org.eclipse.lsp4j.Location] = server.implementation(marker.toTextDocumentPositionParams).get().asScala
26+
val results: Seq[org.eclipse.lsp4j.Location] = server.implementation(marker.toTextDocumentPositionParams).get().asScala.toSeq
2727

2828
assertEquals(expectedLocations.length, results.length)
2929
expectedLocations.sorted.zip(results.sorted).foreach {

language-server/test/dotty/tools/languageserver/util/server/TestServer.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ class TestServer(testFolder: Path, projects: List[Project]) {
4141
* @return A JSON object representing the configuration for this project.
4242
*/
4343
def projectSetup(project: Project): String = {
44-
def showSeq[T](lst: Seq[T]): String =
44+
def showSeq[T](lst: collection.Seq[T]): String =
4545
lst
46-
.map(elem => '"' + elem.toString.replace('\\', '/') + '"')
46+
.map(elem => s"'${elem.toString.replace('\\', '/')}'")
4747
.mkString("[ ", ", ", " ]")
4848

4949
if (project.sources.exists(_.isInstanceOf[TastyWithPositions])) {
@@ -117,7 +117,7 @@ class TestServer(testFolder: Path, projects: List[Project]) {
117117
project.dependsOn.flatMap { dep =>
118118
classDirectory(dep, wipe = false).toString +: dependencyClasspath(dep)
119119
}
120-
}.distinct
120+
}.distinct.toSeq
121121

122122
private def sourceDirectory(project: Project, wipe: Boolean): Path = {
123123
val path = TestFile.sourceDir.resolve(project.name).toAbsolutePath

0 commit comments

Comments
 (0)