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

add bracket check in split_line (#1315)
authorwilliamfzc <178894043@qq.com>
Fri, 8 May 2020 13:16:57 +0000 (21:16 +0800)
committerGitHub <noreply@github.com>
Fri, 8 May 2020 13:16:57 +0000 (06:16 -0700)
black.py
tests/data/comments.py

index 7b905eed350967424c6205b674c0e63677cc8c4f..087683a34f5b149ea351979d800faf07917ee43c 100644 (file)
--- a/black.py
+++ b/black.py
@@ -2544,6 +2544,7 @@ def transform_line(
             is_line_short_enough(line, line_length=line_length, line_str=line_str)
             or line.contains_unsplittable_type_ignore()
         )
             is_line_short_enough(line, line_length=line_length, line_str=line_str)
             or line.contains_unsplittable_type_ignore()
         )
+        and not (line.contains_standalone_comments() and line.inside_brackets)
     ):
         # Only apply basic string preprocessing, since lines shouldn't be split here.
         transformers = [string_merge, string_paren_strip]
     ):
         # Only apply basic string preprocessing, since lines shouldn't be split here.
         transformers = [string_merge, string_paren_strip]
index a20e653dae1207d4a78342f60d235e63a916ac0a..c34daaf6f0833d9e7f600f07a03daea03ed64812 100644 (file)
@@ -22,6 +22,11 @@ except ImportError:
 
 
 # Some comment before a function.
 
 
 # Some comment before a function.
+y = 1
+(
+    # some strings
+    y  # type: ignore
+)
 
 
 def function(default=None):
 
 
 def function(default=None):