Skip to content

Commit b0d3cb2

Browse files
committed
Add showSyntaxErrors extension setting
1 parent f4e5105 commit b0d3cb2

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ This requires Ruff version `v0.1.3` or later.
8989
| `path` | `[]` | Path to a custom `ruff` executable, e.g., `["/path/to/ruff"]`. |
9090
| `showNotifications` | `off` | Setting to control when a notification is shown: `off`, `onError`, `onWarning`, `always`. |
9191
| `nativeServer` | `false` | Whether to use the Rust-based language server. |
92+
| `showSyntaxErrors` | `true` | Whether to show syntax error diagnostics. _New in Ruff v0.5.0_ |
9293

9394
The following settings are exclusive to the Rust-based language server (`nativeServer: true`), and
9495
are available in addition to those listed above:

package.json

+6
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,12 @@
269269
"additionalProperties": false,
270270
"markdownDescription": "Whether to display Quick Fix actions to disable rules via `noqa` suppression comments."
271271
},
272+
"ruff.showSyntaxErrors": {
273+
"default": true,
274+
"markdownDescription": "Controls whether Ruff should show syntax error diagnostics.",
275+
"scope": "window",
276+
"type": "boolean"
277+
},
272278
"ruff.ignoreStandardLibrary": {
273279
"default": true,
274280
"markdownDescription": "Whether to ignore files that are inferred to be part of the Python standard library.",

src/common/settings.ts

+4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export interface ISettings {
5656
exclude?: string[];
5757
lineLength?: number;
5858
configurationPreference?: ConfigPreference;
59+
showSyntaxErrors: boolean;
5960
}
6061

6162
export function getExtensionSettings(namespace: string): Promise<ISettings[]> {
@@ -156,6 +157,7 @@ export async function getWorkspaceSettings(
156157
lineLength: config.get<number>("lineLength"),
157158
configurationPreference:
158159
config.get<ConfigPreference>("configurationPreference") ?? "editorFirst",
160+
showSyntaxErrors: config.get<boolean>("showSyntaxErrors") ?? true,
159161
};
160162
}
161163

@@ -205,6 +207,7 @@ export async function getGlobalSettings(namespace: string): Promise<ISettings> {
205207
"configurationPreference",
206208
"editorFirst",
207209
),
210+
showSyntaxErrors: getGlobalValue<boolean>(config, "showSyntaxErrors", true),
208211
};
209212
}
210213

@@ -234,6 +237,7 @@ export function checkIfConfigurationChanged(
234237
`${namespace}.exclude`,
235238
`${namespace}.lineLength`,
236239
`${namespace}.configurationPreference`,
240+
`${namespace}.showSyntaxErrors`,
237241
// Deprecated settings (prefer `lint.args`, etc.).
238242
`${namespace}.args`,
239243
`${namespace}.run`,

0 commit comments

Comments
 (0)