@@ -62,7 +62,7 @@ object BspServer {
6262 ): Task [State ] = {
6363 val isCommunicationActive = Atomic (true )
6464 val connectionURI = handle.uri
65-
65+ // Do NOT change this log, it's used by clients to know when to start a connection
6666 logger.info(s " The server is listening for incoming connections at $connectionURI... " )
6767 promiseWhenStarted.foreach(_.success(()))
6868
@@ -87,7 +87,7 @@ object BspServer {
8787 scheduler,
8888 ioScheduler
8989 )
90-
90+ // In this case BloopLanguageServer doesn't use input observable
9191 val server =
9292 new BloopLanguageServer (Observable .never, client, provider.services, ioScheduler, bspLogger)
9393
@@ -96,7 +96,7 @@ object BspServer {
9696 LowLevelMessage
9797 .fromInputStream(in, bspLogger)
9898 .guaranteeCase(_ => monix.eval.Task (inputExit.success(())))
99- .asyncBoundary(OverflowStrategy .Unbounded )
99+ .asyncBoundary(OverflowStrategy .Unbounded ) // allows to catch input stream close earlier
100100 .mapParallelUnordered(4 ) { bytes =>
101101 val msg = LowLevelMessage .toMsg(bytes)
102102 server
@@ -212,6 +212,7 @@ object BspServer {
212212 serverSocket : ServerSocket ,
213213 socketPath : Option [Path ] = None
214214 ): Unit = {
215+ // Close any socket communication asap and swallow exceptions
215216 try {
216217 try socket.close()
217218 catch { case NonFatal (_) => () }
@@ -226,6 +227,7 @@ object BspServer {
226227 }
227228 }
228229 } finally {
230+ // Guarantee that we always schedule the external classes directories deletion
229231 val deleteExternalDirsTasks = latestState.build.loadedProjects.map { loadedProject =>
230232 import bloop .io .Paths
231233 val project = loadedProject.project
@@ -252,4 +254,4 @@ object BspServer {
252254 ()
253255 }
254256 }
255- }
257+ }
0 commit comments