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

More tests for `# fmt: off`
authorŁukasz Langa <lukasz@langa.pl>
Wed, 20 Jun 2018 06:46:58 +0000 (23:46 -0700)
committerŁukasz Langa <lukasz@langa.pl>
Wed, 20 Jun 2018 06:46:58 +0000 (23:46 -0700)
Two more known limitations that I don't feel like solving now.  Probably very
low priority.

black.py
tests/data/fmtonoff.py

index 0f966aeaadd1a3d6274772621806109e4018b57c..f1b1c3003e78f09b5a76a8d949cdc4e9965be777 100644 (file)
--- a/black.py
+++ b/black.py
@@ -2577,6 +2577,9 @@ def convert_one_fmt_off_pair(node: Node) -> bool:
                         continue
 
                 ignored_nodes = list(generate_ignored_nodes(leaf))
                         continue
 
                 ignored_nodes = list(generate_ignored_nodes(leaf))
+                if not ignored_nodes:
+                    continue
+
                 first = ignored_nodes[0]  # Can be a container node with the `leaf`.
                 parent = first.parent
                 prefix = first.prefix
                 first = ignored_nodes[0]  # Can be a container node with the `leaf`.
                 parent = first.parent
                 prefix = first.prefix
index 373e5c7090396e994b19e2048271ded0aad5bc5a..74b52ec28e05ac4793a283ef5c6bdeba8285cce3 100644 (file)
@@ -53,6 +53,27 @@ def example(session):
         .order_by(models.Customer.id.asc())\
         .all()
     # fmt: on
         .order_by(models.Customer.id.asc())\
         .all()
     # fmt: on
+def off_and_on_without_data():
+    """All comments here are technically on the same prefix.
+
+    The comments between will be formatted. This is a known limitation.
+    """
+    # fmt: off
+
+
+        #hey, that won't work
+
+
+    # fmt: on
+    pass
+def on_and_off_broken():
+    """Another known limitation."""
+    # fmt: on
+    # fmt: off
+    this=should.not_be.formatted()
+    but=it  is  formatted
+    because . the . handling . inside . generate_ignored_nodes()
+    doesnt . consider . ordering . within . one . prefix
 def long_lines():
     if True:
         typedargslist.extend(
 def long_lines():
     if True:
         typedargslist.extend(
@@ -201,6 +222,29 @@ def example(session):
     # fmt: on
 
 
     # fmt: on
 
 
+def off_and_on_without_data():
+    """All comments here are technically on the same prefix.
+
+    The comments between will be formatted. This is a known limitation.
+    """
+    # fmt: off
+
+    # hey, that won't work
+
+    # fmt: on
+    pass
+
+
+def on_and_off_broken():
+    """Another known limitation."""
+    # fmt: on
+    # fmt: off
+    this = should.not_be.formatted()
+    but = it is formatted
+    because.the.handling.inside.generate_ignored_nodes()
+    doesnt.consider.ordering.within.one.prefix
+
+
 def long_lines():
     if True:
         typedargslist.extend(
 def long_lines():
     if True:
         typedargslist.extend(