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

How to handle cancelled window/showMessageRequest #1501

Open
abhi40308 opened this issue Jun 25, 2024 · 2 comments
Open

How to handle cancelled window/showMessageRequest #1501

abhi40308 opened this issue Jun 25, 2024 · 2 comments
Labels
info-needed Issue requires more information from poster

Comments

@abhi40308
Copy link

abhi40308 commented Jun 25, 2024

We have sentry enabled on our language-server code and its capturing an unhandled error:

Request window/showMessageRequest failed with message: Canceled
Stack Trace Screenshot 2024-06-25 at 5 28 49 PM

There are a lot of instances of this unhandled exception (as its almost always being thrown on initialisation) on sentry and we would like to handle and resolve this properly.

I have traced the request to a notification message we send from the server on connection.onDidChangeConfiguration (which also gets called on connection initialisation), using connection.window.showInformationMessage('some_message')

This is the trace on output console:

[Trace - 17:42:52] Received request 'window/showMessageRequest - (8)'.
Params: {
    "type": 3,
    "message": "DDN CLI path configured successfully.",
    "actions": []
}

I could not see any other trace with a cancelled window/showMessageRequest request. This is the only showMessageRequest that is visible in the VSCode Output channel.

I've tried to wrap the request in a try...catch but with no success, the error still bubbles up on sentry as unhandled :

     try {
        connection.window.showInformationMessage('some_message')
      } catch (err) {
        console.error(err);
      }

From stacktrace it seems like coming from the vscode-jsonrpc package, which is rejecting the promise with error. I guess some handler needs to be installed on the connection object to handle the cancelled request, but could find any resources where something similar is done. Also could not understand from the error message that who is cancelling the request, is it the client or the server.

Any help would be greatly appreciated 🙏. Thanks.

Version: "vscode-languageserver": "7.0.0"

@abhi40308 abhi40308 changed the title how to handle cancelled window/showMessageRequest How to handle cancelled window/showMessageRequest Jun 25, 2024
@dbaeumer
Copy link
Member

"vscode-languageserver": "7.0.0" is a fairly old version. Are you seeing the same behavior on the latest released version 9.0.1 together with the latest client.

And does this happen with VS Code as the client or another editor?

@dbaeumer dbaeumer added the info-needed Issue requires more information from poster label Jun 26, 2024
@abhi40308
Copy link
Author

VS Code is the client editor we support currently (with vscode-languageclient: 7.0.0).

I'll post the results here after upgrading our client and server versions to the latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants