Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -68,7 +68,7 @@ The plugin follows [python-lsp-server's
configuration](https://github.com/python-lsp/python-lsp-server/#configuration). These are
the valid configuration keys:

- `pylsp.plugins.ruff.enabled`: boolean to enable/disable the plugin. `true` by default.
- `pylsp.plugins.ruff.enabled`: Boolean to enable/disable the plugin. `true` by default.
- `pylsp.plugins.ruff.config`: Path to optional `pyproject.toml` file.
- `pylsp.plugins.ruff.exclude`: Exclude files from being checked by `ruff`.
- `pylsp.plugins.ruff.executable`: Path to the `ruff` executable. Uses `os.executable -m "ruff"` by default.
Expand All@@ -79,7 +79,8 @@ the valid configuration keys:
- `pylsp.plugins.ruff.select`: List of error codes to enable.
- `pylsp.plugins.ruff.extendSelect`: Same as select, but append to existing error codes.
- `pylsp.plugins.ruff.format`: List of error codes to fix during formatting. Empty by default, use `["I"]` here to get import sorting as part of formatting.
- `pylsp.plugins.ruff.unsafeFixes`: boolean that enables/disables fixes that are marked "unsafe" by `ruff`. `false` by default.
- `pylsp.plugins.ruff.unsafeFixes`: Boolean that enables/disables fixes that are marked "unsafe" by `ruff`. `false` by default.
- `pylsp.plugins.ruff.preview`: Boolean that enables/disables rules & fixes that are marked "preview" by `ruff`. `false` by default.
- `pylsp.plugins.ruff.severities`: Dictionary of custom severity levels for specific codes, see [below](#custom-severities).
- `pylsp.plugins.ruff.targetVersion`: The minimum Python version to target.

Expand Down
3 changes: 3 additions & 0 deletions pylsp_ruff/plugin.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -571,6 +571,9 @@ def build_check_arguments(
if settings.line_length:
args.append(f"--line-length={settings.line_length}")

if settings.preview:
args.append("--preview")

if settings.unsafe_fixes:
args.append("--unsafe-fixes")

Expand Down
1 change: 1 addition & 0 deletions pylsp_ruff/settings.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,6 +23,7 @@ class PluginSettings:

format: Optional[List[str]] = None

preview: bool = False
unsafe_fixes: bool = False

severities: Optional[Dict[str, str]] = None
Expand Down