scalameta / metals

Scala language server with rich IDE features 🚀

Home Page:https://scalameta.org/metals/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`build/taskProgress` aren't forwarded when status bar is "off"

ckipp01 opened this issue · comments

Describe the bug

When turning off the status bar an LSP client isn't forwarded the actual progress updates from the build server. You can see here:

statusBar.trackFuture(
s"Compiling $name",
promise.future,
showTimer = true,
progress = Some(compilation.progress),
)

That when the task start happens it finds the compilation and calls trackFuture. It's in here that the actual check for "off" is and the progess is created and both the create and notify is done one right after the other:

if (clientConfig.statusBarState == StatusBarState.Off) {
val uuid = UUID.randomUUID().toString()
val token = messages.Either.forLeft[String, Integer](uuid)
val begin = new WorkDoneProgressBegin()
begin.setTitle(message)
val notification =
messages.Either.forLeft[WorkDoneProgressNotification, Object](
begin
)
client.createProgress(new WorkDoneProgressCreateParams(token))
client.notifyProgress(new ProgressParams(token, notification))
value.map { result =>
val end = messages.Either.forLeft[WorkDoneProgressNotification, Object](
new WorkDoneProgressEnd()
)
client.notifyProgress(new ProgressParams(token, end))
result
}
} else {
items.add(Progress(message, value, showTimer, progress))
tickIfHidden()
value
}

Notice that the end is sent once the promise is completed. If you then look at what happens when a build/taskProgress comes in:

report.progress.update(params.getProgress, newTotal = 100)

The progress gets updated, but this will never actual be forwarded to the LSP client since there is no mechanism to check the queue and send them. There is a tick mechanism that at times updates the metals status, but doesn't send progress notifications.

Expected behavior

I'd expect that upon receiving a build/taskProgress with a compilation % that it would be forwarded to the LSP client.

Operating system

macOS

Editor/Extension

Nvim (nvim-metals)

Version of Metals

1.2.2+55-9855505a-SNAPSHOT

Extra context or search terms

No response

I think this: #6144 will resolve that issue as well. So if you feel like reviewing, I encourage you.