X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/b4dca26c7d93f930bbd5a7b552807370b60d4298..f99ef6e190785b3e6a58e83f1382e7d6d3c4881e:/src/black/trans.py?ds=sidebyside diff --git a/src/black/trans.py b/src/black/trans.py index daed264..c0cc926 100644 --- a/src/black/trans.py +++ b/src/black/trans.py @@ -942,6 +942,9 @@ class StringParenStripper(StringTransformer): LL[lpar_or_rpar_idx].remove() # Remove lpar. replace_child(LL[idx], string_leaf) new_line.append(string_leaf) + # replace comments + old_comments = new_line.comments.pop(id(LL[idx]), []) + new_line.comments.setdefault(id(string_leaf), []).extend(old_comments) else: LL[lpar_or_rpar_idx].remove() # This is a rpar.