]>
git.madduck.net Git - etc/vim.git/commitdiff
madduck's git repository
Every one of the projects in this repository is available at the canonical
URL git://git.madduck.net/madduck/pub/<projectpath> — see
each project's metadata for the exact URL.
All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@ git. madduck. net .
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
SSH access, as well as push access can be individually
arranged .
If you use my repositories frequently, consider adding the following
snippet to ~/.gitconfig and using the third clone URL listed for each
project:
[url "git://git.madduck.net/madduck/"]
insteadOf = madduck:
summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (parent:
86e1c36 )
Fixes #224
* fixed invalid code produced when standalone comments were present in a trailer
that was omitted from line splitting on a large expression (#237)
* fixed invalid code produced when standalone comments were present in a trailer
that was omitted from line splitting on a large expression (#237)
+* fixed optional parentheses being removed within `# fmt: off` sections (#224)
+
-def generate_comments(leaf: Leaf ) -> Iterator[Leaf]:
+def generate_comments(leaf: LN ) -> Iterator[Leaf]:
"""Clean the prefix of the `leaf` and generate comments from it, if any.
Comments in lib2to3 are shoved into the whitespace prefix. This happens
"""Clean the prefix of the `leaf` and generate comments from it, if any.
Comments in lib2to3 are shoved into the whitespace prefix. This happens
Standardizes on visible parentheses for single-element tuples, and keeps
existing visible parentheses for other tuples and generator expressions.
"""
Standardizes on visible parentheses for single-element tuples, and keeps
existing visible parentheses for other tuples and generator expressions.
"""
+ try:
+ list(generate_comments(node))
+ except FormatOff:
+ return # This `node` has a prefix with `# fmt: off`, don't mess with parens.
+
check_lpar = False
for child in list(node.children):
if check_lpar:
check_lpar = False
for child in list(node.children):
if check_lpar:
typedargslist.extend(
gen_annotated_params(ast_args.kwonlyargs, ast_args.kw_defaults, parameters, implicit_default=True)
)
typedargslist.extend(
gen_annotated_params(ast_args.kwonlyargs, ast_args.kw_defaults, parameters, implicit_default=True)
)
+ # fmt: off
+ a = (
+ unnecessary_bracket()
+ )
+ # fmt: on
_type_comment_re = re.compile(
r"""
^
_type_comment_re = re.compile(
r"""
^
- """, re.MULTILINE | re.VERBOSE
+ """, # fmt: off
+ re.MULTILINE | re.VERBOSE
def single_literal_yapf_disable():
"""Black does not support this."""
BAZ = {
def single_literal_yapf_disable():
"""Black does not support this."""
BAZ = {
implicit_default=True,
)
)
implicit_default=True,
)
)
+ # fmt: off
+ a = (
+ unnecessary_bracket()
+ )
+ # fmt: on
_type_comment_re = re.compile(
r"""
^
_type_comment_re = re.compile(
r"""
^
re.MULTILINE | re.VERBOSE,
)
re.MULTILINE | re.VERBOSE,
)
def single_literal_yapf_disable():
def single_literal_yapf_disable():