Skip to content

Commit 204766c

Browse files
committed
Allow clients to configure the preview option
This was added in Black 22.1.0
1 parent 96d8d90 commit 204766c

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

pylsp_black/plugin.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ def _load_config(filename: str, client_config: Config) -> Dict:
115115
"pyi": filename.endswith(".pyi"),
116116
"skip_string_normalization": False,
117117
"target_version": set(),
118+
"preview": settings.get("preview", False),
118119
}
119120

120121
root = black.find_project_root((filename,))

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ classifiers =
1818

1919
[options]
2020
packages = find:
21-
install_requires = python-lsp-server>=1.4.0; black>=19.3b0; toml
21+
install_requires = python-lsp-server>=1.4.0; black>=22.1.0; toml
2222
python_requires = >= 3.7
2323

2424
[options.entry_points]

tests/test_plugin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ def test_load_config(config):
234234
"pyi": True,
235235
"fast": True,
236236
"skip_string_normalization": True,
237+
"preview": False,
237238
}
238239

239240

@@ -264,6 +265,7 @@ def test_load_config_defaults(config):
264265
"pyi": False,
265266
"fast": False,
266267
"skip_string_normalization": False,
268+
"preview": False,
267269
}
268270

269271

0 commit comments

Comments
 (0)