@@ -102,20 +102,29 @@ on-save by adding `"editor.formatOnSave": true` to your `settings.json`:
102
102
103
103
### Configuration
104
104
105
- The Ruff formatter respects Ruff's [ ` line-length ` ] ( https://docs.astral.sh/ruff/settings/#line-length )
106
- setting, which can be provided via a ` pyproject.toml ` or ` ruff.toml ` file, or on the CLI, as in:
105
+ The Ruff formatter allows configuration of [ indent style] ( https://docs.astral.sh/ruff/settings/#format-indent-style ) ,
106
+ [ line ending] ( https://docs.astral.sh/ruff/settings/#format-line-ending ) , [ quote style] ( https://docs.astral.sh/ruff/settings/#format-quote-style ) ,
107
+ and [ magic trailing comma behavior] ( https://docs.astral.sh/ruff/settings/#format-skip-magic-trailing-comma ) .
108
+ Like the linter, the Ruff formatter reads configuration via ` pyproject.toml ` or ` ruff.toml ` files,
109
+ as in:
110
+
111
+ ``` toml
112
+ [tool .ruff .format ]
113
+ # Use tabs instead of 4 space indentation
114
+ indent-style = " tab"
115
+
116
+ # Prefer single quotes over double quotes
117
+ quote-style = " single"
118
+ ```
119
+
120
+ The Ruff formatter also respects Ruff's [ ` line-length ` ] ( https://docs.astral.sh/ruff/settings/#line-length )
121
+ setting, which also can be provided via a ` pyproject.toml ` or ` ruff.toml ` file, or on the CLI, as
122
+ in:
107
123
108
124
``` console
109
125
ruff format --line-length 100 /path/to/file.py
110
126
```
111
127
112
- In future releases, the Ruff formatter will likely support configuration of:
113
-
114
- - Quote style (single vs. double).
115
- - Line endings (LF vs. CRLF).
116
- - Indentation (tabs vs. spaces).
117
- - Tab width.
118
-
119
128
### Excluding code from formatting
120
129
121
130
Ruff supports Black's ` # fmt: off ` , ` # fmt: on ` , and ` # fmt: skip ` pragmas, with a few caveats.
0 commit comments