Black adds an extra blank line to an import line that ends with # fmt: skip
#3438
Labels
F: comments
The syntactic kind. Not in the language grammar, always on our minds. Best bugs.
F: fmtskip
fmt: skip implementation
T: bug
Something isn't working
Describe the bug
It reformats:
to:
Example: https://black.vercel.app/?version=stable&state=_Td6WFoAAATm1rRGAgAhARYAAAB0L-Wj4ACSAFtdAD2IimZxl1N_WlwxRhR7MSgE-ANVmAcXiiHH_vLVBv6H9oJYdLgh3uJSbWM1qliEV5h8ji5l4G2iqd5AHPniBCkwXU5Gi97RWyWgW8b3Yvc90k3x9wXSWeryKEAAAIvWais0zjPAAAF3kwEAAAAB02j7scRn-wIAAAAABFla
Expected behavior
# fmt: skip
shouldn't make it add an extra line.Additional context
The issue is Black internally converts the
import re # fmt: skip
line to aSTANDALONE_COMMENT
, and for other "real"STANDALONE_COMMENT
lines it will add the blank line as designed. Maybe internally it needs to distinguish between realSTANDALONE_COMMENT
nodes v.s. converted from fmt off/skip?The text was updated successfully, but these errors were encountered: