Skip to content

Commit c3c0c1d

Browse files
authored
Merge pull request #37 from wstevick/master
Add the possibility to configure skip-magic-trailing-comma
2 parents f8a36d5 + 1547ba6 commit c3c0c1d

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

pylsp_black/plugin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def format_text(*, text, config):
8787
line_length=config["line_length"],
8888
is_pyi=config["pyi"],
8989
string_normalization=not config["skip_string_normalization"],
90+
magic_trailing_comma=not config["skip_magic_trailing_comma"],
9091
)
9192
try:
9293
# Black's format_file_contents only works reliably when eols are '\n'. It gives
@@ -131,6 +132,7 @@ def _load_config(filename: str, client_config: Config) -> Dict:
131132
"fast": False,
132133
"pyi": filename.endswith(".pyi"),
133134
"skip_string_normalization": False,
135+
"skip_magic_trailing_comma": False,
134136
"target_version": set(),
135137
"preview": settings.get("preview", False),
136138
}

tests/test_plugin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ def test_load_config(config):
233233
"target_version": set(),
234234
"pyi": True,
235235
"fast": True,
236+
"skip_magic_trailing_comma": False,
236237
"skip_string_normalization": True,
237238
"preview": False,
238239
}
@@ -264,6 +265,7 @@ def test_load_config_defaults(config):
264265
"target_version": set(),
265266
"pyi": False,
266267
"fast": False,
268+
"skip_magic_trailing_comma": False,
267269
"skip_string_normalization": False,
268270
"preview": False,
269271
}

0 commit comments

Comments
 (0)