Skip to content

Commit c566136

Browse files
committed
add configuration option
1 parent 3e4de96 commit c566136

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

editors/code/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,11 @@
502502
"default": true,
503503
"type": "boolean"
504504
},
505+
"rust-analyzer.showRequestFailedErrorNotification": {
506+
"markdownDescription": "Whether to show panic error notifications.",
507+
"default": true,
508+
"type": "boolean"
509+
},
505510
"rust-analyzer.showDependenciesExplorer": {
506511
"markdownDescription": "Whether to show the dependencies view.",
507512
"default": true,

editors/code/src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { type Config, prepareVSCodeConfig } from "./config";
1010
import { randomUUID } from "crypto";
1111
import { sep as pathSeparator } from "path";
1212
import { unwrapUndefinable } from "./undefinable";
13-
import { RaLanguageClient } from "./base_client";
13+
import { RaLanguageClient } from "./lang_client";
1414

1515
export interface Env {
1616
[name: string]: string;

editors/code/src/base_client.ts renamed to editors/code/src/lang_client.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import * as lc from "vscode-languageclient/node";
2+
import * as vscode from "vscode";
23

34
export class RaLanguageClient extends lc.LanguageClient {
45
override error(message: string, data?: any, showNotification?: boolean | "force"): void {
56
// ignore `Request TYPE failed.` errors
6-
if (message.startsWith("Request") && message.endsWith("failed.")) {
7+
const showError = vscode.workspace
8+
.getConfiguration("rust-analyzer")
9+
.get("showRequestFailedErrorNotification");
10+
if (!showError && message.startsWith("Request") && message.endsWith("failed.")) {
711
return;
812
}
913

0 commit comments

Comments
 (0)