-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
editor/code: add option to suppress internal error notifications #15846
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guess I was very much tunnel visioning when I looked into how to overwrite this given how simple the solution is after all. Thanks for looking into this!
editors/code/src/lang_client.ts
Outdated
import * as vscode from "vscode"; | ||
|
||
export class RaLanguageClient extends lc.LanguageClient { | ||
override error(message: string, data?: any, showNotification?: boolean | "force"): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know what data might contain? Does it contain the error code by any chance? Would be nice if we could match on that instead, because then we can filter out some specific errors that VSCode raises (on non panicking requests) unconditionally (and log them instead).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this is the ResponseError
emitted by r-a, so it does contain the error code. I changed this to override handleRequestFailed
instead of error
, and set showNotification
to false
if we detect that it's an InternalError
.
Co-authored-by: Lukas Wirth <[email protected]>
@bors r+ |
☀️ Test successful - checks-actions |
Fixes #14193
rust-analyzer.showRequestFailedErrorNotification
configuration option, which defaults totrue
rust-analyzer.showRequestFailedErrorNotification
is set totrue
, the current behavior is preserved.rust-analyzer.showRequestFailedErrorNotification
is set tofalse
, no error toasts will be displayed for any of the failed requests caused by panics in r-a. This only applies to events that are triggered "implicitly", such astextDocument/hover
.To test this, you can manually introduce a panic in one of the language server LSP handlers for non-command events. I added an explicit
panic!()
in thetextDocument/hover
event handler:rust-analyzer.showRequestFailedErrorNotification
set totrue
(default)2023-11-07.17-17-48.webm
rust-analyzer.showRequestFailedErrorNotification
set tofalse
2023-11-07.17-16-49.webm