Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Fix crash while formatting a long `del` statement containing tuples (#4628)
- Fix crash while formatting expressions using the walrus operator in complex
`with` statements (#4630)
- Handle `# fmt: skip` followed by a comment at the end of file (#4635)

### Preview style

Expand Down
2 changes: 1 addition & 1 deletion src/black/comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def _generate_ignored_nodes_from_fmt_skip(
if not comments or comment.value != comments[0].value:
return
if prev_sibling is not None:
leaf.prefix = ""
leaf.prefix = leaf.prefix[comment.consumed :]

if Preview.fix_fmt_skip_in_one_liners not in mode:
siblings = [prev_sibling]
Expand Down
6 changes: 6 additions & 0 deletions tests/data/cases/fmtskip11.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def foo():
pass


# comment 1 # fmt: skip
# comment 2
Loading