We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2d9ca1a + a2c5e60 commit 7c3143aCopy full SHA for 7c3143a
pyls_black/plugin.py
@@ -34,7 +34,16 @@ def format_document(document, range=None):
34
35
try:
36
formatted_text = format_text(text=text, config=config)
37
- except (ValueError, black.NothingChanged, IndentationError, AssertionError):
+ except (
38
+ ValueError,
39
+ # raised when the file is already formatted correctly
40
+ black.NothingChanged,
41
+ # raised when the file being formatted has an indentation error
42
+ IndentationError,
43
+ # raised when black produces invalid Python code or formats the file
44
+ # differently on the second pass
45
+ AssertionError,
46
+ ):
47
return []
48
49
return [{"range": range, "newText": formatted_text}]
0 commit comments