Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement: move bsp responsiveness into status #5660

Merged
merged 7 commits into from Sep 29, 2023

Conversation

kasiaMarek
Copy link
Contributor

@kasiaMarek kasiaMarek commented Sep 21, 2023

Previously a message request would pop up when the build sever was not responding. Now we make this into a status.

Changes in the client API:

  • Adds bspStatusBarProvider field to initialisation params, same as statusBarProvider has possibile values "on", "off", "log-message", "show-message". Default being "show-message".
  • Adds statusType field to MetalsStatusParams, possible values "metals", "bsp".
  • Adds level field to MetalsStatusParams, possible values "info", "warn", "error" (can be mapped by client to e.g. color)
  • Adds commandTooltip field to MetalsStatusParams.

BSP status in VSCode:

  • connected
Screenshot 2023-10-11 at 14 41 20
  • no response

Screenshot 2023-09-27 at 16 07 22

  • default behaviour if the client doesn't support bsp status
    Screenshot 2023-09-28 at 13 07 25

s"BSP ${icons.link}",
"info",
show = true,
tooltip = "Metals is connected to the build server.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps outside the scope of this PR, but would it be possible to include the BSP type (Bloop, SBT, scala-cli, mill, etc.) in the tooltip and/or the main status bar text? 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, that's actually not a problem at all.

@filipwiech
Copy link
Contributor

filipwiech commented Sep 21, 2023

Not sure if I understand everything correctly, but the message popup had the option to restart the build server: is this ability lost now? Would it be possible to maybe somehow keep this user action, like an on click handler for the BSP status bar icon, or a hyperlink in the tooltip ("Broken connection, build sever is not responding, [restart the build server]")? 🤔

@kasiaMarek
Copy link
Contributor Author

Would it be possible to maybe somehow keep this user action

Yes, on click on the status bar item (in VS Code).

Some(reconnect)
)
}
def connectedParams(serverName: String, icons: Icons): MetalsStatusParams =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding the build server name to the status! 👍 Another idea that could be a nice addition: when the Metals is trying to connect to the BSP (for example as a result of the user action after clicking on the status icon, or just in general while waiting for the build server to start) could we show appropriate message and icon, to make the process more visible and to let the user know that something is happening? 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we do show when we're connecting to the build server in metas status now. We could think about moving this to this new bsp status but that's not something I want to think about in this PR.

"error",
show = true,
tooltip =
s"Broken connection, build sever ($serverName) is not responding. Press to reconnect.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question about the "Press to reconnect" part of the tooltip: it will work great for the VSCode, but about the other LSP clients, such as the Neovim with the nvim-metals plugin? It could expose the BSP status bar so that it would be shown in the user's statusline, but the "press" action probably won't be available. Maybe we could make the message more generic, WDYT? 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... right.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added additional field commandTooltip.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! 👍

Copy link
Member

@jkciesluk jkciesluk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! The simplification of liveness monitor is great.

underlying.logMessage(new MessageParams(MessageType.Log, params.text))
} else if (params.logMessage.nonEmpty && !pendingShowMessage.get()) {
if (statusBarState == StatusBarState.ShowMessage) {
underlying.showMessage(new MessageParams(level, params.logMessage))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potentially if we have a command defined, we could do showMessageRequest instead so that users would be able to use the same command in other editora

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The drawback is that I added a new client command, so if the client doesn't implement it yet, pressing Reconnect. will confusingly do nothing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could just use ServerCommands.BuildConnect command directly. If that is added to the capabilities then the editor should now to redirect the command to the server

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, I did that

@kasiaMarek kasiaMarek merged commit 95e42a9 into scalameta:main Sep 29, 2023
22 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants