Skip to content

Commit

Permalink
fix: Move to preview style
Browse files Browse the repository at this point in the history
Signed-off-by: RedGuy12 <paul@reid-family.org>
  • Loading branch information
RedGuy12 committed Jan 15, 2024
1 parent e87f634 commit a231d50
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/black/comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,11 @@ def convert_one_fmt_off_pair(
standalone_comment_prefix += fmt_off_prefix
hidden_value = comment.value + "\n" + hidden_value
if _contains_fmt_skip_comment(comment.value, mode):
hidden_value += comment.leading_whitespace + comment.value
hidden_value += (
comment.leading_whitespace
if Preview.no_normalize_fmt_skip_whitespace in mode
else " "
) + comment.value
if hidden_value.endswith("\n"):
# That happens when one of the `ignored_nodes` ended with a NEWLINE
# leaf (possibly followed by a DEDENT).
Expand Down
1 change: 1 addition & 0 deletions src/black/mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ class Preview(Enum):
allow_form_feeds = auto()
unify_docstring_detection = auto()
respect_east_asian_width = auto()
no_normalize_fmt_skip_whitespace = auto()


class Deprecated(UserWarning):
Expand Down
1 change: 1 addition & 0 deletions tests/data/cases/fmtskip9.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flags: --preview
print () # fmt: skip
print () # fmt:skip

Expand Down

0 comments on commit a231d50

Please sign in to comment.