]>
git.madduck.net Git - etc/vim.git/blobdiff - src/black/lines.py
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:
should_split_rhs: bool = False
magic_trailing_comma: Optional[Leaf] = None
should_split_rhs: bool = False
magic_trailing_comma: Optional[Leaf] = None
- def append(self, leaf: Leaf, preformatted: bool = False) -> None:
+ def append(
+ self, leaf: Leaf, preformatted: bool = False, track_bracket: bool = False
+ ) -> None:
"""Add a new `leaf` to the end of the line.
Unless `preformatted` is True, the `leaf` will receive a new consistent
"""Add a new `leaf` to the end of the line.
Unless `preformatted` is True, the `leaf` will receive a new consistent
leaf.prefix += whitespace(
leaf, complex_subscript=self.is_complex_subscript(leaf)
)
leaf.prefix += whitespace(
leaf, complex_subscript=self.is_complex_subscript(leaf)
)
- if self.inside_brackets or not preformatted:
+ if self.inside_brackets or not preformatted or track_bracket :
self.bracket_tracker.mark(leaf)
if self.mode.magic_trailing_comma:
if self.has_magic_trailing_comma(leaf):
self.bracket_tracker.mark(leaf)
if self.mode.magic_trailing_comma:
if self.has_magic_trailing_comma(leaf):
and (self.semantic_leading_comment is None or before)
):
self.semantic_leading_comment = block
and (self.semantic_leading_comment is None or before)
):
self.semantic_leading_comment = block
- elif not current_line.is_decorator:
+ # `or before` means this decorator already has an empty line before
+ elif not current_line.is_decorator or before:
self.semantic_leading_comment = None
self.previous_line = current_line
self.semantic_leading_comment = None
self.previous_line = current_line