]> git.madduck.net Git - etc/vim.git/commit

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:

Re-implement magic trailing comma handling:
authorŁukasz Langa <lukasz@langa.pl>
Mon, 28 Oct 2019 23:50:42 +0000 (00:50 +0100)
committerŁukasz Langa <lukasz@langa.pl>
Fri, 21 Aug 2020 14:45:30 +0000 (16:45 +0200)
commit788268bc39a87d37a24d203fa5ee7b3953af3446
tree92cac5db00cf1be70d896cf652851d26429d18d2
parent4938cc9e9abf2581cb154c6a8d1ae66eb18e0d65
Re-implement magic trailing comma handling:

- when a trailing comma is specified in any bracket pair, that signals to Black
  that this bracket pair needs to be always exploded, e.g. presented as "one
  item per line";

- this causes some changes to previously formatted code that erroneously left
  trailing commas embedded into single-line expressions;

- internally, Black needs to be able to identify trailing commas that it put
  itself compared to pre-existing trailing commas. We do this by using/abusing
  lib2to3's `was_checked` attribute.  It's True for internally generated
  trailing commas and False for pre-existing ones (in fact, for all
  pre-existing leaves and nodes).

Fixes #1288
19 files changed:
CHANGES.md
gallery/gallery.py
src/black/__init__.py
src/blib2to3/pgen2/driver.py
tests/data/collections.py
tests/data/comments2.py
tests/data/comments7.py
tests/data/expression.diff
tests/data/expression.py
tests/data/fmtonoff4.py
tests/data/function.py
tests/data/function2.py
tests/data/function_trailing_comma.py
tests/data/function_trailing_comma_wip.py [new file with mode: 0644]
tests/data/import_spacing.py
tests/data/long_strings.py
tests/data/long_strings__regression.py
tests/data/long_strings_flag_disabled.py
tests/test_black.py