]> 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:

Fix a crash when `# fmt: on` is used on a different block level than `# fmt: off...
authorYilei "Dolee" Yang <yileiyang@google.com>
Sat, 24 Sep 2022 03:37:22 +0000 (20:37 -0700)
committerGitHub <noreply@github.com>
Sat, 24 Sep 2022 03:37:22 +0000 (20:37 -0700)
commit55db05519ebfc502680aa55d289b7e47f6b2c6af
treefdfc56754c188a5db3731bbcecb6139c21ac2ba0
parentbfc013ab93d0993a6e24235291dddd4c4ecd64ee
Fix a crash when `# fmt: on` is used on a different block level than `# fmt: off` (#3281)

Previously _Black_ produces invalid code because the `# fmt: on` is used on a different block level.

While _Black_ requires `# fmt: off` and `# fmt: on` to be used at the same block level, incorrect usage shouldn't cause crashes.

The formatting behavior this PR introduces is, the code below the initial `# fmt: off` block level will be turned off for formatting, when `# fmt: on` is used on a different level or there is no `# fmt: on`. This also matches the current behavior when `# fmt: off` is used at the top-level without a matching `# fmt: on`, it turns off formatting for everything below `# fmt: off`.

- Fixes #2567
- Fixes #3184
- Fixes #2985
- Fixes #2882
- Fixes #2232
- Fixes #2140
- Fixes #1817
- Fixes #569
CHANGES.md
docs/contributing/reference/reference_functions.rst
src/black/comments.py
src/black/nodes.py
tests/data/simple_cases/fmtonoff5.py