Add target_version to formatter options (#9220)

This commit is contained in:
Micha Reiser 2023-12-21 13:05:58 +09:00 committed by GitHub
parent ef4bd8d5ff
commit 8cb7950102
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 103 additions and 10 deletions

View file

@ -175,6 +175,14 @@ impl Configuration {
let formatter = FormatterSettings {
exclude: FilePatternSet::try_from_iter(format.exclude.unwrap_or_default())?,
preview: format_preview,
target_version: match target_version {
PythonVersion::Py37 => ruff_python_formatter::PythonVersion::Py37,
PythonVersion::Py38 => ruff_python_formatter::PythonVersion::Py38,
PythonVersion::Py39 => ruff_python_formatter::PythonVersion::Py39,
PythonVersion::Py310 => ruff_python_formatter::PythonVersion::Py310,
PythonVersion::Py311 => ruff_python_formatter::PythonVersion::Py311,
PythonVersion::Py312 => ruff_python_formatter::PythonVersion::Py312,
},
line_width: self
.line_length
.map_or(format_defaults.line_width, |length| {