Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Possible fix for issue with indentation and fmt: skip (#2281)
Not sure the fix is right. Here is what I found: issue is connected with line first.prefix = prefix[comment.consumed :] in `comments.py`. `first.prefix` is a prefix of the line, that ends with `# fmt: skip`, but `comment.consumed` is the length of the `" # fmt: skip"` string. If prefix length is greater than 14, `first.prefix` will grow every time we apply formatting. Fixes #2254
- Loading branch information
Showing
4 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class A: | ||
def f(self): | ||
for line in range(10): | ||
if True: | ||
pass # fmt: skip | ||
|
||
# output | ||
|
||
class A: | ||
def f(self): | ||
for line in range(10): | ||
if True: | ||
pass # fmt: skip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ | |
"fmtskip3", | ||
"fmtskip4", | ||
"fmtskip5", | ||
"fmtskip6", | ||
"fstring", | ||
"function", | ||
"function2", | ||
|