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: Send error back to client to show #5853

Closed
wants to merge 1 commit into from

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Nov 17, 2023

Previously, it would be very difficult to show a proper error message to the user. Especially in VS Code a generic message was show, which was very confusing for users.

Now, we send the error message in the response so that the client can handle it as they want.

I wonder if we should keep displaying the message, but not sure if it's not better to just change the clients here to show the error.

Related to scalameta/metals-vscode#1438

@tgodzik
Copy link
Contributor Author

tgodzik commented Nov 17, 2023

@ckipp01 what do you think, should we keep displaying the error message? via the standard showMessage mechanism?

@ckipp01
Copy link
Member

ckipp01 commented Nov 19, 2023

I wonder if we should keep displaying the message, but not sure if it's not better to just change the clients here to show the error.

Yea I think maybe this might be best? I think each of the clients that are doing any DAP related stuff will have an extension that can probably handle this in an appropriate way for that client.

Previously, it would be very difficult to show a proper error message to the user. Especially in VS Code a generic message was show, which was very confusing for users.

Now, we send the error message in the response so that the client can handle it as they want.

I wonder if we should keep displaying the message, but not sure if it's not better to just change the clients here to show the error.
@filipwiech
Copy link
Contributor

filipwiech commented Nov 21, 2023

My 2 cents: could we still retain the message sent through the standard LSP (maybe as an option or in addition to the custom one)? 🙂

The reason I ask is that the more bespoke solutions like that are used, the more they require support and maintenance in all the clients. Scala is not as popular as some other languages (think for example Python, Rust, Go) and as a result it often doesn't get first-class support out of the box. The community has limited manpower to add and update special handling. While VSCode and Neovim do get great support from you (big thanks to everyone involved and to @ckipp01 for his awesome Neovim plugin!) there are other editors which do not (like Helix, Emacs and many others, including Fleet and maybe even IntelliJ in the future). I believe the more common protocol is used the better it is for the overall user experience. No need to proliferate plugins, duplicate work or custom configuration. 🙂

Perhaps sending a message to the user is a basic enough action that we could employ the LSP integration here. Sorry for the long message or if I misunderstood the proposed approach. 🙂

@tgodzik
Copy link
Contributor Author

tgodzik commented Nov 21, 2023

@filipwiech thinking it over I realized we can rely on lsp4j's own exception, which will be sent properly to the client (so using normal LSP mechanisms). Did another PR since it's totally different #5864

It might need to fixes to tests, but looks to be working pretty well.

@tgodzik tgodzik closed this Nov 21, 2023
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.

3 participants