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

Direct the user to the logs channel when build scripts fail #13995

Closed
OmarTawfik opened this issue Jan 21, 2023 · 4 comments · Fixed by #14007
Closed

Direct the user to the logs channel when build scripts fail #13995

OmarTawfik opened this issue Jan 21, 2023 · 4 comments · Fixed by #14007
Labels
A-vscode vscode plugin issues

Comments

@OmarTawfik
Copy link
Contributor

For the following notification, when build scripts panic:

rust-analyzer failed to run build scripts. Check the server logs for additional info.

image

It wastes users time and effort to hunt for the correct channel and scroll in it when that happens.

  1. Is it possible to reveal that channel when that happens? perhaps by using LogOutputChannel.show(true) (link to API).
  2. If too disruptive, would it be better to put it behind a VS Code configuration setting (false by default)?
  3. If too much work/doesn't work well with current settings, can we at least add a button on that notification box to Show Logs?

Thanks!

@Veykril
Copy link
Member

Veykril commented Jan 21, 2023

These notifications are done by the language client implementation of VSCode https://github.com/microsoft/vscode-languageserver-node, we can't modify it unfortunately. I'd love to add a button to it, but I keep forgetting about opening an issue upstream about this :)

@OmarTawfik
Copy link
Contributor Author

OmarTawfik commented Jan 21, 2023

@Veykril is this the extension point you are talking about?

self.send_notification::<lsp_types::notification::ShowMessage>(
lsp_types::ShowMessageParams { typ: lsp_types::MessageType::ERROR, message },
)

Would it be solved by using lsp_types::request::ShowMessageRequest instead? It supports specifying user actions:

@Veykril
Copy link
Member

Veykril commented Jan 21, 2023

That is unfortunately not necessarily enough (though thanks for bringing the request up, I was only aware of the notification), that request will render a button, but the button press result will be sent back to the server. For opening the logs we'd need to handle this in the client. There is no way to hook into that handling on the VSCode side though unfortunately -> https://github.com/microsoft/vscode-languageserver-node/blob/56c23c557e3568a9f56f42435fd5a80f9458957f/client/src/common/client.ts#L1045-L1077

I suppose we could add an LSP extension for a showLogs notification that the server sends to the client, then we could have an exchange like:

server -> client: ShowMessageRequest
client -> server: ShowMessageResponse with `go to output` button clicked
server -> client: ShowLogsNotification

That seems like a decent solution here actually.

@Veykril Veykril added the A-vscode vscode plugin issues label Jan 21, 2023
@OmarTawfik
Copy link
Contributor Author

OmarTawfik commented Jan 23, 2023

Sounds great! Thank you for looking into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-vscode vscode plugin issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants