Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'editors/code/src/lang_client.ts')
| -rw-r--r-- | editors/code/src/lang_client.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/editors/code/src/lang_client.ts b/editors/code/src/lang_client.ts new file mode 100644 index 0000000000..09d64efc04 --- /dev/null +++ b/editors/code/src/lang_client.ts @@ -0,0 +1,26 @@ +import * as lc from "vscode-languageclient/node"; +import * as vscode from "vscode"; + +export class RaLanguageClient extends lc.LanguageClient { + override handleFailedRequest<T>( + type: lc.MessageSignature, + token: vscode.CancellationToken | undefined, + error: any, + defaultValue: T, + showNotification?: boolean | undefined, + ): T { + const showError = vscode.workspace + .getConfiguration("rust-analyzer") + .get("showRequestFailedErrorNotification"); + if ( + !showError && + error instanceof lc.ResponseError && + error.code === lc.ErrorCodes.InternalError + ) { + // Don't show notification for internal errors, these are emitted by r-a when a request fails. + showNotification = false; + } + + return super.handleFailedRequest(type, token, error, defaultValue, showNotification); + } +} |