Skip to content

Commit

Permalink
bugfix: Start http server earlier
Browse files Browse the repository at this point in the history
Previously, it would be accessed by the doctor before ready. Now, it will not print a flaky warning about http being disabled.
  • Loading branch information
tgodzik committed Jan 3, 2025
1 parent 843d80f commit 6635872
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1263,8 +1263,8 @@ class WorkspaceLspService(
workDoneProgress.start(sh, 0, 1, ju.concurrent.TimeUnit.SECONDS)
for {
_ <- userConfigSync.initSyncUserConfiguration(folderServices)
_ <- Future.sequence(folderServices.map(_.initialized()))
_ <- Future(startHttpServer())
_ <- Future.sequence(folderServices.map(_.initialized()))
} yield ()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class HeadDoctor(
httpServer: () => Option[MetalsHttpServer],
clientConfig: ClientConfiguration,
languageClient: MetalsLanguageClient,
isHttpEnabled: Boolean,
) {
private val isVisible = new AtomicBoolean(false)

Expand Down Expand Up @@ -85,10 +86,14 @@ class HeadDoctor(
httpServer() match {
case Some(server) =>
onServer(server)
case None =>
case None if !isHttpEnabled =>
scribe.warn(
"Unable to run doctor. Make sure `isHttpEnabled` is set to `true`."
)
case None =>
scribe.info(
"Doctor was not yet started, check logs to make sure it's running"
)
}
}
}
Expand Down

0 comments on commit 6635872

Please sign in to comment.