]>
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:
summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (parent:
665ed8a )
Fixes #215
* fixed non-deterministic formatting when multiple pairs of removable parentheses
were used (#183)
* fixed non-deterministic formatting when multiple pairs of removable parentheses
were used (#183)
+* fixed multiline strings being unnecessarily wrapped in optional
+ parentheses in long assignments (#215)
+
* fixed not splitting long from-imports with only a single name
* fixed Python 3.6+ file discovery by also looking at function calls with
* fixed not splitting long from-imports with only a single name
* fixed Python 3.6+ file discovery by also looking at function calls with
The relevant Python language `keywords` for a given statement will be
NAME leaves within it. This methods puts those on a separate line.
The relevant Python language `keywords` for a given statement will be
NAME leaves within it. This methods puts those on a separate line.
- `parens` holds a set of string leaf values immeditely after which
+ `parens` holds a set of string leaf values immedia tely after which
invisible parens should be put.
"""
normalize_invisible_parens(node, parens_after=parens)
invisible parens should be put.
"""
normalize_invisible_parens(node, parens_after=parens)
rpar = Leaf(token.RPAR, ")")
index = child.remove() or 0
node.insert_child(index, Node(syms.atom, [lpar, child, rpar]))
rpar = Leaf(token.RPAR, ")")
index = child.remove() or 0
node.insert_child(index, Node(syms.atom, [lpar, child, rpar]))
+ elif not (isinstance(child, Leaf) and is_multiline_string(child)) :
# wrap child in invisible parentheses
lpar = Leaf(token.LPAR, "")
rpar = Leaf(token.RPAR, "")
# wrap child in invisible parentheses
lpar = Leaf(token.LPAR, "")
rpar = Leaf(token.RPAR, "")
+def is_multiline_string(leaf: Leaf) -> bool:
+ """Return True if `leaf` is a multiline string that actually spans many lines."""
+ value = leaf.value.lstrip("furbFURB")
+ return value[:3] in {'"""', "'''"} and "\n" in value
+
+
def is_stub_suite(node: Node) -> bool:
"""Return True if `node` is a suite with a stub body."""
if (
def is_stub_suite(node: Node) -> bool:
"""Return True if `node` is a suite with a stub body."""
if (
+ x = """
+ a really long string
+ """
lcomp3 = [
# This one is actually too long to fit in a single line.
element.split("\n", 1)[0]
lcomp3 = [
# This one is actually too long to fit in a single line.
element.split("\n", 1)[0]