X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/7d062ecd5f14124a99daf452c46054ada656ad8b..658c8d8d96047c5ba77be4aecc2545a22d5e35b9:/src/black/linegen.py?ds=sidebyside diff --git a/src/black/linegen.py b/src/black/linegen.py index 644824a..244dbe7 100644 --- a/src/black/linegen.py +++ b/src/black/linegen.py @@ -179,6 +179,23 @@ class LineGenerator(Visitor[Line]): yield from self.visit(child) + def visit_dictsetmaker(self, node: Node) -> Iterator[Line]: + if Preview.wrap_long_dict_values_in_parens in self.mode: + for i, child in enumerate(node.children): + if i == 0: + continue + if node.children[i - 1].type == token.COLON: + if child.type == syms.atom and child.children[0].type == token.LPAR: + if maybe_make_parens_invisible_in_atom( + child, + parent=node, + remove_brackets_around_comma=False, + ): + wrap_in_parentheses(node, child, visible=False) + else: + wrap_in_parentheses(node, child, visible=False) + yield from self.visit_default(node) + def visit_funcdef(self, node: Node) -> Iterator[Line]: """Visit function definition.""" if Preview.annotation_parens not in self.mode: