diff options
author | Alexandra Dima <alexandra.dima@jetbrains.com> | 2019-07-18 17:05:54 +0200 |
---|---|---|
committer | Samvel Abrahamyan <samvel1024@gmail.com> | 2019-10-12 14:33:06 +0200 |
commit | 90cc85577949416f5a367f86ba040a293915cb31 (patch) | |
tree | 7e72be64cdf67e404b3f8d261758bf6224c8237b | |
parent | 2d03a6ca1706c9c34e4d29414e57031bf084ef21 (diff) | |
download | mill-90cc85577949416f5a367f86ba040a293915cb31.tar.gz mill-90cc85577949416f5a367f86ba040a293915cb31.tar.bz2 mill-90cc85577949416f5a367f86ba040a293915cb31.zip |
Modified the sources and inversed sources requests to be compatible with returing directories of source files rather than individual source files.
-rw-r--r-- | contrib/bsp/src/mill/contrib/bsp/MillBuildServer.scala | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/contrib/bsp/src/mill/contrib/bsp/MillBuildServer.scala b/contrib/bsp/src/mill/contrib/bsp/MillBuildServer.scala index c3273e49..7684ba31 100644 --- a/contrib/bsp/src/mill/contrib/bsp/MillBuildServer.scala +++ b/contrib/bsp/src/mill/contrib/bsp/MillBuildServer.scala @@ -114,6 +114,7 @@ class MillBuildServer(evaluator: Evaluator, files } + //TODO: use mill's sources, same for resources override def buildTargetSources(sourcesParams: SourcesParams): CompletableFuture[SourcesResult] = { def computeSourcesResult: SourcesResult = { @@ -129,12 +130,14 @@ class MillBuildServer(evaluator: Evaluator, Agg.empty[PathRef]). map(pathRef => pathRef.path).toSeq - for (file <- getSourceFiles(sources)) { - itemSources ++= List(new SourceItem(file.toNIO.toAbsolutePath.toUri.toString, SourceItemKind.FILE, false)) + for (source <- sources) { + itemSources ++= List( + new SourceItem(source.toNIO.toAbsolutePath.toUri.toString, SourceItemKind.DIRECTORY, false)) } - for (file <- getSourceFiles(generatedSources)) { - itemSources ++= List(new SourceItem(file.toNIO.toAbsolutePath.toUri.toString, SourceItemKind.FILE, true)) + for (genSource <- generatedSources) { + itemSources ++= List( + new SourceItem(genSource.toNIO.toAbsolutePath.toUri.toString, SourceItemKind.DIRECTORY, true)) } items ++= List(new SourcesItem(targetId, itemSources.asJava)) @@ -154,7 +157,9 @@ class MillBuildServer(evaluator: Evaluator, val targets = (for (targetId <- targetIdToModule.keys if buildTargetSources(new SourcesParams(Collections.singletonList(targetId))). get.getItems.asScala.head.getSources.asScala. - exists(item => item.getUri.equals(textDocument.getUri))) + exists( + item => os.list(os.Path(item.getUri)). + map(dir => dir.toIO.toURI.toString).contains(textDocument.getUri))) yield targetId).toList.asJava new InverseSourcesResult(targets) } |