diff --git a/package.json b/package.json index 42f83cdd..b049e5f8 100644 --- a/package.json +++ b/package.json @@ -231,6 +231,20 @@ "scope": "resource", "type": "array" }, + "ruff.format.backend": { + "default": "internal", + "markdownDescription": "The backend to use for formatting.", + "enum": [ + "internal", + "uv" + ], + "enumDescriptions": [ + "Use Ruff's built-in formatter.", + "Use uv for formatting (requires uv >= 0.8.13)" + ], + "scope": "resource", + "type": "string" + }, "ruff.format.preview": { "default": null, "markdownDescription": "Enable [preview mode](https://docs.astral.sh/ruff/settings/#format_preview) for the formatter; enables unstable formatting.\n\n**This setting is used only by the native server.**", diff --git a/src/common/settings.ts b/src/common/settings.ts index e30a8a54..ae986966 100644 --- a/src/common/settings.ts +++ b/src/common/settings.ts @@ -25,6 +25,8 @@ type NativeServer = boolean | "on" | "off" | "auto"; type LogLevel = "error" | "warn" | "info" | "debug" | "trace"; +type FormatterBackend = "internal" | "uv"; + type CodeAction = { disableRuleComment?: { enable?: boolean; @@ -47,6 +49,7 @@ type Lint = { type Format = { args?: string[]; preview?: boolean; + backend?: FormatterBackend; }; export interface ISettings { @@ -171,6 +174,7 @@ export async function getWorkspaceSettings( format: { args: resolveVariables(config.get("format.args") ?? [], workspace), preview: config.get("format.preview"), + backend: config.get("format.backend") ?? "internal", }, enable: config.get("enable") ?? true, organizeImports: config.get("organizeImports") ?? true, @@ -240,6 +244,7 @@ export async function getGlobalSettings(namespace: string): Promise { format: { args: getGlobalValue(config, "format.args", []), preview: getOptionalGlobalValue(config, "format.preview"), + backend: getGlobalValue(config, "format.backend", "internal"), }, enable: getGlobalValue(config, "enable", true), organizeImports: getGlobalValue(config, "organizeImports", true), @@ -281,6 +286,7 @@ export function checkIfConfigurationChanged( `${namespace}.path`, `${namespace}.showNotifications`, `${namespace}.format.preview`, + `${namespace}.format.backend`, `${namespace}.exclude`, `${namespace}.lineLength`, `${namespace}.configurationPreference`,